MiniTorchBR is available on PyPI and requires Python 3.10+. Release wheels target Linux x86-64, Windows x64, and 64-bit Intel/Apple silicon macOS.
pip install minitorchbrOr install from source:
git clone https://github.com/BriceLucifer/MiniTorch.git
cd MiniTorch
uv venv
uv syncSource installation compiles the optional native training extension and therefore requires a C/C++ build toolchain.
| Package | Purpose |
|---|---|
| numpy ≥ 1.24 | Tensor computation |
| matplotlib ≥ 3.7 | Training plots |
| pyvis ≥ 0.3 | Interactive graph rendering |
MiniTorch/
├── core/ # Variable (tensor) + Function (op base)
├── ops/ # 20+ differentiable operations
├── nn/ # Module, Linear, Sequential
├── optim/ # SGD, Adam
├── native/ # Compiled dense-classifier training
├── visualization/ # Interactive model explorer
├── data/ # MNIST loader, DataLoader
└── utils/ # Graph viz, training viz, numerical diff
import numpy as np
from MiniTorch.core.variable import Variable
# Scalars
a = Variable(np.array(2.0))
b = Variable(np.array(3.0))
c = a * b + a # c = a*b + a → dc/da = b+1 = 4, dc/db = a = 2
c.backward()
print(a.grad.data) # 4.0
print(b.grad.data) # 2.0Use no_grad for inference to save memory and speed up computation:
from MiniTorch.core.config import no_grad
with no_grad():
out = model(x) # no graph is built- Autograd System — understand how the computation graph works
- Neural Networks — build and train models
- Examples — runnable code samples