simplegrad is a deep learning framework designed to be read. Every layer, every gradient, every optimizer — written from scratch on top of NumPy so you can trace exactly what happens when a neural network learns.
It's not a toy. It ships a full autograd engine, conv layers, optimizers, schedulers, lazy execution, experiment tracking, and a web dashboard. But the source stays small enough to understand in an afternoon.
The package is not yet published to PyPI. Clone the repo and install in editable mode:
git clone https://github.com/gri-sha/simplegrad.git
cd simplegrad
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -e .For CUDA support:
pip install -e ".[cuda]" # CUDA 12.xFor development: pip install -e ".[dev,docs,cuda]"
import simplegrad as sg
x = sg.Tensor([[1.0, 2.0], [3.0, 4.0]], label="x")
w = sg.Tensor([[0.5], [-0.5]], label="w")
y = sg.mean(x @ w)
y.backward()
print(x.grad) # d(mean(x @ w)) / dx
print(w.grad) # d(mean(x @ w)) / dw| Module | What it gives you |
|---|---|
core/ |
Tensor, autograd engine, lazy execution |
functions/ |
Math, activations, losses, conv, pooling |
nn/ |
Linear, Conv2d, Embedding, Dropout, ... |
optimizers/ |
SGD, Adam |
schedulers/ |
Linear, Exponential, Cosine, ReduceOnPlateau |
track/ |
SQLite-backed experiment tracking |
simpleboard/ |
Web dashboard for tracked runs |
Full API reference, architecture walkthrough, and training examples at the documentation site.
