Skip to main content

A minimal scalar-valued autograd engine written in Rust

Project description

Project Description

A minimal scalar-valued autograd engine written in Rust

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.1.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

oxigrad-0.2.1-cp39-abi3-win_amd64.whl (153.2 kB view details)

Uploaded CPython 3.9+Windows x86-64

File details

Details for the file oxigrad-0.2.1.tar.gz.

File metadata

  • Download URL: oxigrad-0.2.1.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.9.0

File hashes

Hashes for oxigrad-0.2.1.tar.gz
Algorithm Hash digest
SHA256 1c85a767a7a4d28cb4106b887e63a2b78cf866ef944cf5826d7f2867053b61ed
MD5 e45a73cdc43b7c5714595a7edb3249d2
BLAKE2b-256 967c1bf391eaeb38f53e3a5c7e9a6040b39c29af6b01a46f0972b5cb958eaf8e

See more details on using hashes here.

File details

Details for the file oxigrad-0.2.1-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: oxigrad-0.2.1-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

Hashes for oxigrad-0.2.1-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 f9ee0c36b37ad68889307c746b2cf2e5b85771e07ca4a9dd3e95be6a77a699aa
MD5 7e2db5a31eb8b210992441e27975e536
BLAKE2b-256 e481c207972f209868a66e28bcf33c871484d48fd66a188de251c938464f1475

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page