Function autograd::ops::flatten [] [src]

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

Flattens input tensor into 1-ranked (vector)

extern crate autograd as ag;

let mut ctx = ag::Context::new();
let ref x = ag::zeros(&[3, 2, 2]);
let ref z = ag::flatten(x);
assert_eq!(z.eval(&mut ctx).shape(), &[12]);