Trait dfdx::tensor_ops::StddevTo

source ·
pub trait StddevTo<E: Dtype>: HasErr + HasShape {
    // Required method
    fn try_stddev<Dst: Shape, Ax: Axes>(
        self,
        epsilon: impl Into<f64>
    ) -> Result<Self::WithShape<Dst>, Self::Err>
       where Self::Shape: HasAxes<Ax> + ReduceShapeTo<Dst, Ax>;

    // Provided method
    fn stddev<Dst: Shape, Ax: Axes>(
        self,
        epsilon: impl Into<f64>
    ) -> Self::WithShape<Dst>
       where Self::Shape: HasAxes<Ax> + ReduceShapeTo<Dst, Ax> { ... }
}
Expand description

Reduction along multiple axes using standard deviation.

Required Methods§

source

fn try_stddev<Dst: Shape, Ax: Axes>( self, epsilon: impl Into<f64> ) -> Result<Self::WithShape<Dst>, Self::Err>where Self::Shape: HasAxes<Ax> + ReduceShapeTo<Dst, Ax>,

Fallible version of StddevTo::stddev

Provided Methods§

source

fn stddev<Dst: Shape, Ax: Axes>( self, epsilon: impl Into<f64> ) -> Self::WithShape<Dst>where Self::Shape: HasAxes<Ax> + ReduceShapeTo<Dst, Ax>,

Standard deviation reduction.

Pytorch equivalent: t.std(Axes, unbiased=False)

Examples:

let t = dev.tensor([[2.0, 3.0, 4.0], [3.0, 6.0, 9.0]]);
let r = t.stddev::<Rank1<2>, _>(0.0); // or `stddev::<_, Axis<1>>(0.0)`
assert_eq!(r.array(), [0.6666667_f32.sqrt(), 6.0_f32.sqrt()]);

Implementors§

source§

impl<S: Shape, E: Dtype, D: Device<E>, T: Tape<E, D>> StddevTo<E> for Tensor<S, E, D, T>