| Crates.io | mgrad |
| lib.rs | mgrad |
| version | 0.1.5 |
| created_at | 2025-04-27 10:52:21.282138+00 |
| updated_at | 2025-04-30 14:21:38.715362+00 |
| description | A minimal automatic differentiation library. |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1651016 |
| size | 74,164 |
A minimal automatic scalar differentiation library.
All code are in a single file (src/mgrad.rs) to easily copy-paste into other projects.
use mgrad::nn;
fn main() {
let x = nn::variable(1);
let y = x.sin() + nn::constant(1);
let y = (x.pow(2) * y).ln();
y.backward(1);
println!("dy/dx at x=1 is: {:?}", x.grad);
}
Run with cargo doc --open to see the documentation.
More examples can be found in the examples folder.