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 ref a = ag::constant(ndarray::arr1(&[2.]));
let ref b = ag::reciprocal(a);
assert_eq!(
    b.eval(&[]),
    Ok(ndarray::arr1(&[0.5]).into_dyn())
);