Function autograd::run
[−]
[src]
pub fn run(tensors: &[&Tensor], ctx: &mut Context)
Evaluates endpoints tensors
.
extern crate ndarray; extern crate autograd as ag; let mut ctx = ag::Context::new(); let a = ag::variable(ndarray::arr1(&[1., 1.]), &mut ctx); let b = ag::ones(&[2]); let c = ag::sub_inplace(a, &b); // runs inplace op. ag::run(&[&c], &mut ctx); // pull out shared variable let should_be_zeros = ctx.variables.remove(&c).unwrap(); assert_eq!(should_be_zeros, ndarray::arr1(&[0., 0.]).into_dyn());