Function dfdx::tensor_ops::mean
source · [−]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);