Function autograd::ops::shape [] [src]

pub fn shape(x: &Tensor) -> Tensor

Returns the (symbolic) shape of input tensor

extern crate autograd as ag;

let ref x = ag::zeros(&[2, 3]);
let ref s = ag::shape(x);

let mut ctx = ag::Context::new();
assert_eq!(&[2., 3.], s.eval(&mut ctx).as_slice().unwrap());