ferris_grad 0.1.0

A PyTorch-like autograd engine in under 1000 lines of Rust code.🦀
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use anyhow::Result;
use ferris_grad::Tensor;

fn main() -> Result<()> {
    let a = Tensor::from_vec(vec![1.0.into(), 2.0.into(), 3.0.into()], [3, 1].into())?;
    let b = Tensor::rand([3, 1].into())?;
    let c = &a * &b;
    println!("{}", c);
    c[(1, 0)].backward();
    println!("{}", a[(1, 0)].grad());
    Ok(())
}