Function autograd::ops::reshape [] [src]

pub fn reshape<T: ArrayLike>(x: &Tensor, shape: &T) -> Tensor

Reshapes input tensor.

Only one element in shape can be -1.

extern crate ndarray;
extern crate autograd as ag;

let mut ctx = ag::Context::new();
let ref x = ag::zeros(&[3, 2, 2]);
let ref y = ag::reshape(&x, &[3, -1]);

assert_eq!(y.eval(&mut ctx), ag::ndarray_ext::zeros(&[3, 4]));