fn norm(x: ArrayView1<'_, f64>, scale: ArrayView1<'_, f64>) -> f64 {
    debug_assert_eq!(x.len(), scale.len());
    (Zip::from(x)
        .and(scale)
        .fold_while(0., |acc, &x, &scale| {
            let scaled = x / scale;
            FoldWhile::Continue(acc + scaled * scaled)
        })
        .into_inner()
        / x.len() as f64)
        .sqrt()
}
/// Computes RMS norm of scaled values.
Computes RMS norm of scaled values.
Computes RMS norm of scaled values .
fn norm(x: ArrayView1<'_, f64>, scale: ArrayView1<'_, f64>) -> f64 {
    debug_assert_eq!(x.len(), scale.len());
    (Zip::from(x)
        .and(scale)
        .fold_while(0., |acc, &x, &scale| {
            let scaled = x / scale;
            FoldWhile::Continue(acc + scaled * scaled)
        })
        .into_inner()
        / x.len() as f64)
        .sqrt()
}
fn norm ( x : ArrayView1 < ' _ , f64 > , scale : ArrayView1 < ' _ , f64 > ) -> f64 { debug_assert_eq ! ( x len ( ) scale len ( ) ) ; ( Zip :: from ( x ) . and ( scale ) . fold_while ( 0. , | acc , & x , & scale | { let scaled = x / scale ; FoldWhile :: Continue ( acc + scaled * scaled ) } ) . into_inner ( ) / x . len ( ) as f64 ) . sqrt ( ) }
Computes RMS norm of scaled values.
Computes RMS norm of scaled values .
x
ArrayView1<'_, f64>
scale
ArrayView1<'_, f64>
x
ArrayView1<'_, f64>
scale
ArrayView1<'_, f64>