pub fn mean<T: Tensor<Dtype = f32>>(t: T) -> Tensor0D<T::Tape>
Expand description

Average of all elements in the tensor. Returns a Tensor0D (i.e. one number).

Example:

let t = Tensor2D::new([[1.0, 2.0, 3.0], [-1.0, -2.0, -3.0]]);
let r: Tensor0D = t.mean();
assert_eq!(r.data(), &0.0);