Function autograd::ops::expand_dims [] [src]

pub fn expand_dims<T: ArrayLike>(x: &Tensor, axes: &T) -> Tensor

Expands specified dims.

Each axis can be negative.

extern crate autograd as ag;

let mut ctx = ag::Context::new();
let ref a = ag::zeros(&[3]);
let ref b = ag::expand_dims(a, &[0, 2]);

assert_eq!(b.eval(&mut ctx).shape(), &[1, 3, 1]);