[][src]Function autograd::ops::square

pub fn square<T: Float, A: AsRef<Tensor<T>>>(a: A) -> Tensor<T>

Takes square of the input.

extern crate ndarray;
extern crate autograd as ag;

let ref a = ag::constant(ndarray::arr1(&[2., 3.]));
let ref b = ag::square(a);
assert_eq!(
    b.eval(&[]),
    Some(ndarray::arr1(&[4., 9.]).into_dyn())
);