pub struct RmsNorm<D: Dtype, IT, OT, const RANK: usize> {
pub normalized_shape: Vec<usize>,
pub eps: f64,
pub affine: bool,
/* private fields */
}Expand description
Root Mean Square normalisation.
Normalises over the last normalized_shape.len() dimensions by dividing by
the RMS (no mean subtraction):
y = x / rms(x) * γ
Output shape equals input shape.
Parameters:
normalized_shape— axes to normalise overeps— numerical stability constant (default 1e-8)affine— if true, learns per-element γ (default true)
Fields§
§normalized_shape: Vec<usize>The shape of the trailing axes to normalize over.
eps: f64Numerical stability constant.
affine: boolWhether to learn a per-element scale (gamma) parameter.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<D, IT, OT, const RANK: usize> Freeze for RmsNorm<D, IT, OT, RANK>
impl<D, IT, OT, const RANK: usize> RefUnwindSafe for RmsNorm<D, IT, OT, RANK>
impl<D, IT, OT, const RANK: usize> Send for RmsNorm<D, IT, OT, RANK>
impl<D, IT, OT, const RANK: usize> Sync for RmsNorm<D, IT, OT, RANK>
impl<D, IT, OT, const RANK: usize> Unpin for RmsNorm<D, IT, OT, RANK>
impl<D, IT, OT, const RANK: usize> UnsafeUnpin for RmsNorm<D, IT, OT, RANK>
impl<D, IT, OT, const RANK: usize> UnwindSafe for RmsNorm<D, IT, OT, RANK>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more