Skip to main content

normalize

Function normalize 

Source
pub fn normalize(
    input: &ArrayD<f64>,
    mean: &[f64],
    std: &[f64],
) -> Result<ArrayD<f64>, AugmentationError>
Expand description

Normalize input: (x − mean[c]) / std[c].

For a [B, C, H, W] or [C, H, W] tensor the normalization is per-channel. If mean and std have length 1 the same value is applied to all channels. For 1-D or 2-D tensors element-wise normalization uses the first element of mean/std.