Function autograd::ops::neg [] [src]

pub fn neg(a: &Tensor) -> Tensor

Performs the - operation.

extern crate ndarray;
extern crate autograd as ag;

let ref a = ag::constant(ndarray::arr1(&[2., 3.]));
let ref b = ag::neg(a);
assert_eq!(
    b.eval(&[]),
    Ok(ndarray::arr1(&[-2., -3.]).into_dyn())
);