A minimal scalar-valued autograd engine written in Rust
Project description
Key Features
- Forward and Backward pass on scalar values
- Backpropagation with a computation graph
- Activation Functions:
- Sigmoid
- ReLU
Installing
Python 3.9 or higher is required
# using pip
pip install oxigrad
# using uv
uv add oxigrad
Quick Example
from oxigrad import Value, Activation
x1 = Value(1.7, label="x1")
x2 = Value(-0.3, label="x2")
w1 = Value(-1.5, label="w1")
w2 = Value(0.1, label="w2")
b = Value(0.5, label="b")
# Set a label after an operation
x1w1 = (x1 * w1).set_label("x1w1")
x2w2 = x2 * w2
xwb = x1w1 + x2w2 + b
z = Activation.Sigmoid(xwb).set_label("z")
# Run backpropagation
# All gradients will be calculated wrt z (dz/dw1, dz/dw2, etc.,)
z.backward()
print(z) # Value(data=0.8889, grad=1.0000, label='z', operation='SIGMOID')
print(w1) # Value(data=-1.5000, grad=0.1678, label='w1')
print(w2) # Value(data=0.1000, grad=-0.0296, label='w2')
print(b) # Value(data=0.5000, grad=0.0987, label='b')
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
oxigrad-0.2.2.tar.gz
(10.8 kB
view details)
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 oxigrad-0.2.2.tar.gz.
File metadata
- Download URL: oxigrad-0.2.2.tar.gz
- Upload date:
- Size: 10.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.9.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bca88ec4be6427c897e773ee9ae419241d06053ec79fb1540cee3fd6e56bea91
|
|
| MD5 |
23e753e7082f772198da63f4da74f9f9
|
|
| BLAKE2b-256 |
10fd4ab9e70c08fc4cc94914d526b15d900fc1c5da1b2ab0a45e34a5c9898381
|
File details
Details for the file oxigrad-0.2.2-cp39-abi3-win_amd64.whl.
File metadata
- Download URL: oxigrad-0.2.2-cp39-abi3-win_amd64.whl
- Upload date:
- Size: 153.2 kB
- Tags: CPython 3.9+, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.9.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a357f04823a06176a668b02e1341f644eb2d9fa04bd3cd2fb2a9c0243fbbf85
|
|
| MD5 |
5dc5c2f7bc93cc86abd8b27b310743e0
|
|
| BLAKE2b-256 |
d3dc12b845830fca40ad5b455e4d03dd58a1fdaa31347c6dc4285ed3e498b1a8
|