// numpy-only · zero dependencies
picodl is a from-scratch autograd engine and neural network stack - every gradient traced by hand, every op built on plain numpy. No hidden framework underneath.
$ pip install picodl-nn
// what's inside
Each piece does one job and hands a plain Tensor
to the next. Nothing is generated for you - every layer, loss, and optimizer is code you can read start to finish.
tensor.py
Tracks every op into a graph, topologically sorts on .backward()
. 25+ differentiable ops: matmul, conv2d, softmax, attention primitives, and more.
layers.py
Linear, Conv2D, Embedding, LayerNorm, BatchNorm2D, MaxPool2D, AvgPool2D, GlobalAvgPool, Dropout, GELU, TiedLinear.
loss.py
MSE, BinaryCrossEntropy, NLLLoss, CrossEntropyLoss - built from the same primitive ops as everything else.
optim.py
SGD, RMSprop, Adam, AdamW - decoupled weight decay included, per-parameter state tracked by identity.
nn.py
Chains layers, exposes params for the optimizer, saves and loads weights to any file extension you like.
data.py / train.py
BatchIterator for mini-batches, a train loop that accepts raw numpy or Tensor input directly.
// thirty seconds in
A small classifier - GELU hidden layer, Adam optimizer, saved to disk when done.
from picodl.nn import NeuralNet
from picodl.layers import Linear, GELU
from picodl.loss import CrossEntropyLoss
from picodl.optim import AdamW
from picodl.train import train
net = NeuralNet([
Linear(784, 128),
GELU(),
Linear(128, 10),
])
train(net, x_train, y_train,
num_epochs=10,
loss=CrossEntropyLoss(),
optimizer=AdamW(lr=0.001, weight_decay=0.01))
net.save("model.picodl")