reverse 0.1.0

Reverse mode automatic differentiation.
Documentation

reverse

Crates.io Documentation License

Reverse mode automatic differentiation in Rust.

To use this in your crate, add the following to Cargo.toml:

[dependencies]
reverse = "0.1"

Examples

use reverse::*;

fn main() {
  let graph = Graph::new();
  let a = graph.add_var(2.5);
  let b = graph.add_var(14.);
  let c = (a.sin() + b.ln() * 3.) - 5.;
  let gradients = c.backward();

  assert_eq!(gradients.wrt(&a), 2.5_f64.cos());
  assert_eq!(gradients.wrt(&b), 3. / 14.);
}