Function autograd::ops::variable
[−]
[src]
pub fn variable<T>(arr: Array<f32, T>) -> Tensor where
T: Dimension,
Creates a shared variable tensor from rust-ndarray's array object.
The shared variable behaves like any other tensors, except that
it can be optimized with gradient descent methods
implemented in autograd::gradient_descent
.
For the usages, see https://github.com/perrier1034/rust-autograd/tree/master/examples
extern crate ndarray; extern crate autograd as ag; let ref x: ag::Tensor = ag::variable(ndarray::arr1(&[2.])); let ref y: ag::Tensor = 3 * x; assert_eq!(6., y.eval(&[]).unwrap()[0]);