regrad 0.2.0

A simple library to backpropagate gradients through a computation graph
Documentation
  • Coverage
  • 0%
    0 out of 7 items documented0 out of 0 items with examples
  • Size
  • Source code size: 9.74 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.37 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 9s Average build duration of successful builds.
  • all releases: 9s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • ostadgeorge

regrad

backtrack in rust

Usage

Add to Cargo.toml

cargo add regrad

Example

use regrad::Value;

fn main() {
    let v1 = Value::from(1.2);
    let v2 = Value::from(3.4);
    let v3 = &(&v1 * &v1) * &v2;

    dbg!(v3.data());
    assert_eq!(v3.data(), 4.896);

    v3.backward();
    dbg!(v1.gradient());
    dbg!(v2.gradient());
    dbg!(v3.gradient());

    assert_eq!(v1.gradient(), 8.16);
    assert_eq!(v2.gradient(), 1.44);
    assert_eq!(v3.gradient(), 1.0);
}

TODO

  • Add more operations
  • Add Tensor support
  • Add more tests
  • Add more examples
  • Add more documentation
  • Add GPU support
  • Crates.io publish