I wrote a deep-learning framework to understand autograd.
I used to work out gradients by hand and thought autograd was magic. Neograd was how I found out: a framework in plain Python and NumPy, small enough to read.
- Stack
- Python, NumPy
- Status
- On PyPI
- Year
- 2022
What it does
Automatic differentiation for scalars, vectors and matrices with NumPy broadcasting, custom operations defined by a forward and a backward method, and gradient checking to confirm that gradients flow correctly.
Forward, then backward
Filmxx
WW
matmulmatmul
relurelu
lossloss
Has its gradient
One walk back gives every node its gradient.
xx
WW
matmulmatmul
relurelu
lossloss
Has its gradient
One walk back gives every node its gradient.
Forward. x and W run through matmul and relu to the loss.
What sits on top
A PyTorch-like API with layers, activations, losses and optimizers such as Adam, and saving, loading and checkpoints during training.
How it ships
Tests run in CI, the documentation is on Read the Docs, and the package is on PyPI. It is meant for learning, not as a replacement for PyTorch.