Features
Hand-written autograd
Every differentiable operation wraps its inputs in a dedicated *Backward node
that implements the local gradient rule. The full reverse-mode chain is explicit
and readable — backpropagation is a simple walk over the graph each op builds.
Tensorwithrequires_grad,.backward(),.grad, and PyTorch-style operators:+,@,*, indexing,sin,cos,exp,log,sqrt,tanh,sigmoid,relu,softmax,mean,max,min,norm,abs, and more.- Non-scalar outputs require an explicit
gradientargument tobackward().
Neural networks
nn.Linear,nn.Sequential, activations (ReLU,Tanh,Sigmoid,Softmax,LeakyReLU, …) and losses (MSELoss,CrossEntropyLoss,BCELoss,L1Loss).state_dict/save/loadfor checkpointing — keys use0.weight-style prefixes for sub-modules.- Functional helpers:
jacobian,vectorize_parameters,one_hot.
14 optimizers
SGD, SGD with momentum, Adam, Adamax, NAdam, AMSGrad, RMSprop, Adagrad,
Adadelta, Nesterov, PID, Levenberg–Marquardt, and more — all sharing a single
Optimizer base with a standard step() / zero_grad() interface.
Control-flavoured tools
KalmanFilter— linear-Gaussian state estimation.EKFOptimizer— extended-Kalman neural identification of nonlinear plants.RLS— recursive least squares for online system identification.- Hand-rolled
jacobianfor exact gradients of network outputs w.r.t. parameters.
Verified by finite differences
The test suite checks the gradient of every operation against numeric differentiation, so the math is not just claimed — it is measured. The suite currently has 108 passing tests covering tensors, modules, optimizers, and the control tools.
Quality
- Linting and formatting via
ruff(clean). - CI on GitHub Actions across Python 3.10–3.13.
- MIT licensed.