pub fn sum_last_dim<T: Tensor<Dtype = f32>>(t: T) -> T::LastDimReduced
Expand description

Calls [Device::sum_last_dim()] on the underlying array. Result Tensor has smaller number of dimensions.

Examples:

let t = Tensor2D::new([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]]);
let r: Tensor1D<2> = sum_last_dim(t);
assert_eq!(r.data(), &[6.0, 15.0]);