pub struct LayerNorm<B: Backend> { /* private fields */ }
Expand description
Applies Layer Normalization over an input tensor as described in the paper Layer Normalization.
Y = norm(X) * γ + β
Implementations
Trait Implementations
sourceimpl<B: Backend> ADModule for LayerNorm<B>where
B: ADBackend,
impl<B: Backend> ADModule for LayerNorm<B>where
B: ADBackend,
type ADBackend = B
type InnerModule = LayerNorm<<B as ADBackend>::InnerBackend>
sourcefn inner(&self) -> Self::InnerModule
fn inner(&self) -> Self::InnerModule
Get the same module, but on the inner backend without auto-differentiation.
sourceimpl<B: Backend> Module for LayerNorm<B>
impl<B: Backend> Module for LayerNorm<B>
type Backend = B
sourcefn devices(&self) -> Vec<B::Device>
fn devices(&self) -> Vec<B::Device>
Get the device list of the module and all of its sub-modules.
sourcefn to_device(&mut self, device: B::Device)
fn to_device(&mut self, device: B::Device)
Move the module and all of its sub-modules to the given device.
sourcefn load(
&mut self,
state: &State<<Self::Backend as Backend>::Elem>
) -> Result<(), LoadingError>
fn load(
&mut self,
state: &State<<Self::Backend as Backend>::Elem>
) -> Result<(), LoadingError>
Load the module state.
sourcefn num_params(&self) -> usize
fn num_params(&self) -> usize
Get the number of parameters the module has, including all of its sub-modules.
sourcefn update_params<O: Optimizer<Backend = B>>(
&mut self,
grads: &Gradients,
optim: &mut O
)where
B: ADBackend,
fn update_params<O: Optimizer<Backend = B>>(
&mut self,
grads: &Gradients,
optim: &mut O
)where
B: ADBackend,
sourcefn load_optim_state<O: Optimizer<Backend = B>>(
&self,
optim: &mut O,
state_optim: &StateNamed<B::Elem>
)where
B: ADBackend,
fn load_optim_state<O: Optimizer<Backend = B>>(
&self,
optim: &mut O,
state_optim: &StateNamed<B::Elem>
)where
B: ADBackend,
sourcefn register_optim_state<O: Optimizer<Backend = B>>(
&self,
optim: &O,
state_optim: &mut StateNamed<B::Elem>
)where
B: ADBackend,
fn register_optim_state<O: Optimizer<Backend = B>>(
&self,
optim: &O,
state_optim: &mut StateNamed<B::Elem>
)where
B: ADBackend,
Auto Trait Implementations
impl<B> RefUnwindSafe for LayerNorm<B>where
<B as Backend>::TensorPrimitive<1>: RefUnwindSafe,
impl<B> Send for LayerNorm<B>
impl<B> Sync for LayerNorm<B>
impl<B> Unpin for LayerNorm<B>where
<B as Backend>::TensorPrimitive<1>: Unpin,
impl<B> UnwindSafe for LayerNorm<B>where
<B as Backend>::TensorPrimitive<1>: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more