Getting Started¶
Installation¶
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.
Or install from source:
Source installation compiles the optional native training extension and therefore requires a C/C++ build toolchain.
Dependencies¶
| Package | Purpose |
|---|---|
| numpy ≥ 1.24 | Tensor computation |
| matplotlib ≥ 3.7 | Training plots |
| pyvis ≥ 0.3 | Interactive graph rendering |
Project Layout¶
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
Your First Computation¶
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.0
Disabling Gradient Tracking¶
Use no_grad for inference to save memory and speed up computation:
Next Steps¶
- Autograd System — understand how the computation graph works
- Neural Networks — build and train models
- Examples — runnable code samples