Tiny scalar autograd engine and neural network library with a PyTorch-like API
open sourceMITfree
micrograd is Andrej Karpathy's tiny autograd engine: it implements backpropagation (reverse-mode autodiff) over a dynamically built graph of scalar values, with a small neural network library on top that has a PyTorch-like API, in about 100 and 50 lines of code. It's enough to train small neural nets, such as a binary classifier in its demo notebook, and its maker describes it as potentially useful for education.
Problems it solves
- understand how backpropagation works by reading a tiny implementation
- minimal autograd engine to learn from
- build a small neural net from scratch in Python
Features
- reverse-mode autodiff over scalar values
- small neural network library
- PyTorch-like API
- about 150 lines of code
Limitations
Alternatives
The same job
These do what micrograd does.
- tinygrad Small, hackable deep learning framework and compiler, between PyTorch and micrograd
