A tiny educational autograd library.
Project description
hobbitgrad
hobbitgrad is a tiny educational autograd library written in pure Python. It includes a small NDArray, a Tensor type with backpropagation, a linear layer, SGD, and mean squared error loss.
Install
pip install hobbitgrad
Example
from hobbitgrad import Linear, SGD, Tensor, mse
x = Tensor([[0, 0], [0, 1], [1, 0], [1, 1]])
y = Tensor([[0], [0], [0], [1]])
model = Linear(2, 1)
optimizer = SGD(model.parameters(), lr=0.1)
for _ in range(100):
pred = model.forward(x)
loss = mse(pred, y)
loss.backward()
optimizer.step()
optimizer.zero_grad()
print(loss.data.data[0])
Current Scope
hobbitgrad currently supports a small set of tensor operations, broadcasting, matrix multiplication, scalar reductions, a linear layer, SGD, and MSE loss.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hobbitgrad-0.0.2.tar.gz.
File metadata
- Download URL: hobbitgrad-0.0.2.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd966a4c12519080362f0b163406951f5025acb7d1028bc38b41d85ad454f41e
|
|
| MD5 |
a492b4222a65d094de6569012f452a44
|
|
| BLAKE2b-256 |
f5ffd7acc50ce3df6d4d7ff975cb5b180d85fb7ab4c2fa431671f4159c50e3cb
|
Provenance
The following attestation bundles were made for hobbitgrad-0.0.2.tar.gz:
Publisher:
publish.yml on creasac/hobbitgrad
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hobbitgrad-0.0.2.tar.gz -
Subject digest:
fd966a4c12519080362f0b163406951f5025acb7d1028bc38b41d85ad454f41e - Sigstore transparency entry: 1953024674
- Sigstore integration time:
-
Permalink:
creasac/hobbitgrad@9a457ec791bbed81ca7714c50f9c6801e30e0a58 -
Branch / Tag:
refs/tags/v0.0.2 - Owner: https://github.com/creasac
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9a457ec791bbed81ca7714c50f9c6801e30e0a58 -
Trigger Event:
push
-
Statement type:
File details
Details for the file hobbitgrad-0.0.2-py3-none-any.whl.
File metadata
- Download URL: hobbitgrad-0.0.2-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
480650b49aeffefc39767164e1dff8ba1b3bf75b80a536bcbf21a633d5b5f1d7
|
|
| MD5 |
0b13e3c54452b6760cc53fe163fc43ec
|
|
| BLAKE2b-256 |
982bc96efc5265b11d13012a69d797a4dfa0f8b6d9a867edd12966659e265369
|
Provenance
The following attestation bundles were made for hobbitgrad-0.0.2-py3-none-any.whl:
Publisher:
publish.yml on creasac/hobbitgrad
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hobbitgrad-0.0.2-py3-none-any.whl -
Subject digest:
480650b49aeffefc39767164e1dff8ba1b3bf75b80a536bcbf21a633d5b5f1d7 - Sigstore transparency entry: 1953024881
- Sigstore integration time:
-
Permalink:
creasac/hobbitgrad@9a457ec791bbed81ca7714c50f9c6801e30e0a58 -
Branch / Tag:
refs/tags/v0.0.2 - Owner: https://github.com/creasac
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9a457ec791bbed81ca7714c50f9c6801e30e0a58 -
Trigger Event:
push
-
Statement type: