Function autograd::ops::floor [] [src]

pub fn floor(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 mut ctx = ag::Context::new();
let ref a = ag::constant(ndarray::arr1(&[-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]), &mut ctx);
let ref b = ag::floor(a);
assert_eq!(
    b.eval(&mut ctx).as_slice().unwrap(),
    &[-2., -2., -1.,  0.,  1.,  1.,  2.]
);