pub struct LayerNormalizationLayerParams {
pub normalized_shape: Vec<i64>,
pub eps: f32,
pub gamma: Option<WeightParams>,
pub beta: Option<WeightParams>,
}Expand description
A layer that applies layer normalization over the input tensor.
Requires 1 input and produces 1 output.
output = gamma * (input - computed_mean) / (sqrt(computed_variance + eps)) + beta
Parameters normalizedShape: subset of the input shape, along with layer norm is performed, rest of the input shape is treated as the batch dimension. The mean and variance are computed for the input, over the last few dimensions as specified by the normalizedShape parameter. gamma: must have shape = “normalizedShape” beta: must have shape = “normalizedShape” eps: small constant to avoid division by 0
Output shape is same as the input.
e.g.: input shape = (10,5) normalized shape = (5,) or (10,5)
input shape = (10,5,6,7) normalized shape = (7,) or (6,7) or (5,6,7) or (10,5,6,7)
Fields§
§normalized_shape: Vec<i64>§eps: f32§gamma: Option<WeightParams>§beta: Option<WeightParams>Trait Implementations§
Source§impl Clone for LayerNormalizationLayerParams
impl Clone for LayerNormalizationLayerParams
Source§fn clone(&self) -> LayerNormalizationLayerParams
fn clone(&self) -> LayerNormalizationLayerParams
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Message for LayerNormalizationLayerParams
impl Message for LayerNormalizationLayerParams
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Source§fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
Source§fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
Source§fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Source§fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Source§fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self. Read moreSource§fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self.Source§impl PartialEq for LayerNormalizationLayerParams
impl PartialEq for LayerNormalizationLayerParams
Source§fn eq(&self, other: &LayerNormalizationLayerParams) -> bool
fn eq(&self, other: &LayerNormalizationLayerParams) -> bool
self and other values to be equal, and is used by ==.