Function autograd::ops::reciprocal
[−]
[src]
pub fn reciprocal(x: &Tensor) -> Tensor
Returns the 1/x, element-wise.
extern crate ndarray; extern crate autograd as ag; let mut ctx = ag::Context::new(); let ref a = ag::constant(ndarray::arr1(&[2.]), &mut ctx); let ref b = ag::reciprocal(a); assert_eq!( b.eval(&mut ctx).as_slice().unwrap(), &[0.5] );