pub struct LayerNorm<A = f64, K = Biased, D = Ix2>where
D: Dimension,{ /* private fields */ }Expand description
Layer Normalization directly estimates the normalization statistics from the summed inputs to the neurons within a hidden layer, eliminating the need to introduce any additional dependencies.
LayerNorm follows the Layer Normalization paper.
§Resources
Implementations§
Source§impl<A, K, D> LayerNorm<A, K, D>where
D: RemoveAxis,
K: ParamMode,
impl<A, K, D> LayerNorm<A, K, D>where
D: RemoveAxis,
K: ParamMode,
pub fn from_config(config: Config<D>) -> Selfwhere
A: Default,
pub fn from_elem<Sh>(shape: Sh, elem: A) -> Selfwhere
A: Clone,
Sh: ShapeBuilder<Dim = D>,
pub fn from_params(params: LinearParams<A, K, D>) -> Self
pub fn new<Sh>(shape: Sh) -> Selfwhere
Sh: ShapeBuilder<Dim = D>,
A: Default,
pub fn ones<Sh>(shape: Sh) -> Self
pub fn zeros<Sh>(shape: Sh) -> Self
pub const fn config(&self) -> &Config<D>
pub fn is_biased(&self) -> bool
Sourcepub const fn params(&self) -> &LinearParams<A, K, D>
pub const fn params(&self) -> &LinearParams<A, K, D>
Returns an immutable reference to the layer’s parameters.
Sourcepub fn params_mut(&mut self) -> &mut LinearParams<A, K, D>
pub fn params_mut(&mut self) -> &mut LinearParams<A, K, D>
Returns a mutable reference to the layer’s parameters.
pub fn dim(&self) -> D::Pattern
pub fn eps(&self) -> f64
pub fn ndim(&self) -> usize
pub fn raw_dim(&self) -> D
pub fn shape(&self) -> &[usize]
Trait Implementations§
Auto Trait Implementations§
impl<A, K, D> Freeze for LayerNorm<A, K, D>
impl<A, K, D> RefUnwindSafe for LayerNorm<A, K, D>where
D: RefUnwindSafe,
K: RefUnwindSafe,
<D as Dimension>::Smaller: RefUnwindSafe,
A: RefUnwindSafe,
impl<A, K, D> Send for LayerNorm<A, K, D>
impl<A, K, D> Sync for LayerNorm<A, K, D>
impl<A, K, D> Unpin for LayerNorm<A, K, D>
impl<A, K, D> UnwindSafe for LayerNorm<A, K, D>
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