Function dfdx::tensor_ops::std_axis
source · [−]pub fn std_axis<T, const I: isize>(t: T, epsilon: T::Dtype) -> T::Reduced where
T: Reduce1<I>,
T::Array: HasAxis<I>,
Expand description
Reduces dimension I
of T
by computing std deviation of all values in that dimension.
Result Tensor has smaller number of dimensions.
Pytorch equivalent: t.std(I, unbiased=False)
Related functions: var_axis(), sqrt().
Examples:
let t: Tensor2D<2, 3> = Tensor2D::new([[2.0, 3.0, 4.0], [3.0, 6.0, 9.0]]);
let r: Tensor1D<2> = t.std_axis::<-1>(0.0);
assert_eq!(r.data(), &[0.6666667_f32.sqrt(), 6.0_f32.sqrt()]);