Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/adelsz/oxigrad
Toy autodifferentiation engine in Rust
https://github.com/adelsz/oxigrad
Last synced: 2 days ago
JSON representation
Toy autodifferentiation engine in Rust
- Host: GitHub
- URL: https://github.com/adelsz/oxigrad
- Owner: adelsz
- License: mit
- Created: 2024-02-01T22:22:50.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-02-01T22:25:55.000Z (10 months ago)
- Last Synced: 2024-10-29T12:16:14.589Z (14 days ago)
- Language: Rust
- Size: 7.42 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Oxigrad - toy automatic differentiation engine in Rust
This is a self-contained toy automatic differentiation engine written in Rust.
Built for learning purposes and partially inspired by [micrograd](https://github.com/karpathy/micrograd).
API is focused on ease of use and educational clarity, performance was not a priority.## Usage
```rust
#[test]
fn backprop_test() {
let a = Value::new(2.0);
let b = Value::new(1.0);
// z = (a * b + a) * (a * b + b) = a^2 * b^2 + a^2 * b + a * b^2 + a * b
let z = (&a * &b + &a) * (&a * &b + &b);
backprop(&z);
// dz/da = 2ab^2 + 2ab + b^2 + b = 2*2*1 + 2*2 + 1 + 1 = 10
assert_eq!(a.grad().get(), 10.0);
}
```## Basic neural network training
There is a basic neural network training example in `src/neuron.rs` and plots the training progress in a GIF file.