[][src]Function autograd::ops::size

pub fn size<T: Float, A: AsRef<Tensor<T>>>(x: A) -> Tensor<T>

Returns the (symbolic) size of input tensor

extern crate ndarray;
extern crate autograd as ag;

let ref a: ag::Tensor<f32> = ag::zeros(&[4, 3]);
let ref b = ag::size(a);

assert_eq!(12., b.eval(&[]).unwrap()[ndarray::IxDyn(&[])]);