pub struct RmsNorm {
pub weight: Array,
pub eps: f32,
}Expand description
Root-mean-square normalisation over the last axis with a learned scale (MLX’s
nn.RMSNorm, the fused fast::rms_norm).
Fields§
§weight: ArrayThe scale, [dims], initially ones.
eps: f32Added to the mean square.
Implementations§
Trait Implementations§
Source§impl Module for RmsNorm
impl Module for RmsNorm
Source§fn visit(&mut self, p: &mut Parameters<'_>)
fn visit(&mut self, p: &mut Parameters<'_>)
Reports every parameter and submodule to
p, frozen ones included.Source§fn parameters(&self) -> Vec<(String, Array)>
fn parameters(&self) -> Vec<(String, Array)>
Every parameter with its path (
layers.0.weight), in visiting order.Source§fn trainable_parameters(&self) -> Vec<(String, Array)>
fn trainable_parameters(&self) -> Vec<(String, Array)>
The parameters that are trained (not frozen), with their paths.
Source§fn update_trainable(&mut self, values: &[Array]) -> Result<()>
fn update_trainable(&mut self, values: &[Array]) -> Result<()>
Replaces the trainable parameters, given in the order of
Module::trainable_parameters (as optimizers return them).Source§fn load_weights(
&mut self,
weights: impl IntoIterator<Item = (String, Array)>,
strict: bool,
) -> Result<()>
fn load_weights( &mut self, weights: impl IntoIterator<Item = (String, Array)>, strict: bool, ) -> Result<()>
Replaces parameters by path, as MLX’s
load_weights: each weight must have its
parameter’s shape (the dtype is kept as loaded). With strict, every parameter
must be given and no unknown names are allowed.Auto Trait Implementations§
impl Freeze for RmsNorm
impl RefUnwindSafe for RmsNorm
impl Send for RmsNorm
impl Sync for RmsNorm
impl Unpin for RmsNorm
impl UnsafeUnpin for RmsNorm
impl UnwindSafe for RmsNorm
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more