Function autograd::ops::abs [] [src]

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

Returns the largest integer less than or equal to a number, element-wise.

extern crate ndarray;
extern crate autograd as ag;

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