[][src]Function autograd::ops::rank

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

Returns the (symbolic) rank of input tensor

extern crate ndarray;
extern crate autograd as ag;

let ref x: ag::Tensor<f32> = ag::zeros(&[2, 3, 4]);
let ref r = ag::rank(x);

assert_eq!(3., r.eval(&[]).unwrap()[ndarray::IxDyn(&[])]);