pub struct LayerNorm<D: Dtype, IT, OT, const RANK: usize> {
pub normalized_shape: Vec<usize>,
pub eps: f64,
pub affine: bool,
/* private fields */
}Expand description
Layer normalisation over the last normalized_shape.len() dimensions.
Input shape: [*, normalized_shape[0], ..., normalized_shape[n-1]]
Output shape: same as input.
Parameters:
normalized_shape— the shape of the axes to normalise over (e.g.[C]for 2-D input[N, C], or[H, W]for spatial normalisation)eps— numerical stability constant (default 1e-5)affine— if true, learns per-element γ and β (default true)
Fields§
§normalized_shape: Vec<usize>The shape of the trailing axes to normalize over.
eps: f64Numerical stability constant added to the variance.
affine: boolWhether to learn per-element scale (gamma) and shift (beta) parameters.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<D, IT, OT, const RANK: usize> Freeze for LayerNorm<D, IT, OT, RANK>
impl<D, IT, OT, const RANK: usize> RefUnwindSafe for LayerNorm<D, IT, OT, RANK>
impl<D, IT, OT, const RANK: usize> Send for LayerNorm<D, IT, OT, RANK>
impl<D, IT, OT, const RANK: usize> Sync for LayerNorm<D, IT, OT, RANK>
impl<D, IT, OT, const RANK: usize> Unpin for LayerNorm<D, IT, OT, RANK>
impl<D, IT, OT, const RANK: usize> UnsafeUnpin for LayerNorm<D, IT, OT, RANK>
impl<D, IT, OT, const RANK: usize> UnwindSafe for LayerNorm<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