weiyu322 / tinynn

A lightweight deep learning library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tinynn

Build Status

tinynn is a lightweight deep learning framework written in Python3 (with NumPy).

tinynn-architecture

Getting Started

Install

pip install tinynn

Run examples

git clone https://github.com/borgwang/tinynn.git
cd tinynn/examples

# MNIST classification
python mnist/run.py  

# a toy regression task
python nn_paint/run.py  

# reinforcement learning demo (gym environment required)
python rl/run.py

Intuitive APIs

# define a model
net = Net([Dense(50), ReLU(), Dense(100), ReLU(), Dense(10)]) 
model = Model(net=net, loss=MSE(), optimizer=Adam(lr))

# train
for batch in iterator(train_x, train_y):
    preds = model.forward(batch.inputs)
    loss, grads = model.backward(preds, batch.targets)
    model.apply_grads(grads)

Components

  • layers: Dense, Conv2D, ConvTranspose2D, RNN, MaxPool2D, Dropout, BatchNormalization
  • activation: ReLU, LeakyReLU, Sigmoid, Tanh, Softplus
  • losses: SoftmaxCrossEntropy, SigmoidCrossEntropy, MAE, MSE, Huber
  • optimizer: RAdam, Adam, SGD, Momentum, RMSProp, Adagrad, Adadelta

Contribute

Please follow the Google Python Style Guide for Python coding style.

License

MIT

About

A lightweight deep learning library

License:MIT License


Languages

Language:Python 100.0%