Function autograd::ops::reduce_sum [] [src]

pub fn reduce_sum<T: ArrayLike>(x: &Tensor, axes: &T, keep_dims: bool) -> Tensor

Takes sum along specified axes.

Elements of axes can be negative.

extern crate ndarray;
extern crate autograd as ag;

let mut ctx = ag::Context::new();
let ref x = ag::constant(ndarray::arr2(&[[2., 4.], [3., 1.]]), &mut ctx);
let ref y = ag::reduce_sum(&x, &[1], false);

assert_eq!(y.eval(&mut ctx), ndarray::arr1(&[6., 4.]).into_dyn());