Tardigrad
A small PyTorch-like autograd engine and neural network library.
"As far as we tardigrades are concerned, Pluto is and always will be a planet. End of discussion."
― Zeno Alexander, The Library of Ever
Features
- Automatic differentiation for scalar (
Value) and tensor (Tensor) operations - Neural network layers (
Linear,Sequential) - SGD optimizer with gradient zeroing
- Lightweight with minimal dependencies (NumPy, SciPy)
Quick Start
Scalar Autograd
from tardigrad.value import Value
a = Value(2.0, label='a')
b = Value(3.0, label='b')
c = a * b + Value(1.0)
c.backward()
print(c.data) # 7.0
print(a.grad) # 3.0
print(b.grad) # 2.0
Tensor Operations
from tardigrad.tensor import Tensor
x = Tensor([[1, 2], [3, 4]])
y = Tensor([[5, 6], [7, 8]])
z = x.matmul(y)
z.backward()
print(z.data)
print(x.grad)
Neural Network
from tardigrad.layers import Linear, Sequential
from tardigrad.tensor import Tensor
from tardigrad.optim import SGD
model = Sequential([
Linear(2, 3),
Linear(3, 1)
])
optimizer = SGD(model.get_params(), alpha=0.01)
# Training loop
for epoch in range(10):
y_pred = model.forward(x_train)
loss = ((y_pred - y_train) ** 2).sum()
loss.backward()
optimizer.step()
Project Structure
tardigrad/
├── value.py # Scalar autograd engine
├── tensor.py # Multi-dimensional tensor autograd
├── layers.py # Neural network layers (Linear, Sequential)
└── optim.py # SGD optimizer
References
- micrograd by Andrej Karpathy
- Grokking Deep Learning by Andrew Trask
Metadata
Release files for tardigrad 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tardigrad-0.1.0.tar.gz | 2.9 MB | Without provenance | Details for tardigrad-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tardigrad-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for tardigrad-0.1.0-py3-none-any.whl |
Total release size: 2.9 MB
Release files / tardigrad-0.1.0.tar.gz
| Download URL | tardigrad-0.1.0.tar.gz |
|---|---|
| Size | 2.9 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
79673c21a5f52f1f530f1d9c3446a90aa59a9d8ae1c1a4afe6101d3cf8253328
|
|
BLAKE2b-256 checksum How to use checksums |
7728c504061212f1b2af24b0f9f6ed6d3d1509d1c4a3c422de3056cfc5943e3e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.7
|
Release files / tardigrad-0.1.0-py3-none-any.whl
| Download URL | tardigrad-0.1.0-py3-none-any.whl |
|---|---|
| Size | 8.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0edbc7918bb3039fad8754c048da71fda2448a85bfbbf6700631d0d241751ab9
|
|
BLAKE2b-256 checksum How to use checksums |
73ab4d63f5840dd769d569d6d79be319fc6e3e2f4769180f1e56bdf8106d8ebd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.7
|
Security for tardigrad 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.