Function autograd::ops::constant [] [src]

pub fn constant<T>(arr: Array<f32, T>) -> Tensor where
    T: Dimension

Creates a constant tensor.

extern crate ndarray;
extern crate autograd as ag;

let arr = ndarray::arr1(&[0., 0., 0.]);
let ref con = ag::constant(arr.clone());
assert_eq!(con.eval(&[]), Ok(arr.into_dyn()))