/// Construct a layer normalization layer.
///
/// The mean and standard deviation are computed over the last
/// number of dimensions with the shape defined by
/// `normalized_shape`. If `elementwise_affine` is `True`, a
/// learnable affine transformation of the shape
/// `normalized_shape` is added after normalization.
Construct a layer normalization layer.
The mean and standard deviation are computed over the last
number of dimensions with the shape defined by
`normalized_shape`.
Construct a layer normalization layer . The mean and standard deviation are computed over the last number of dimensions with the shape defined by ` normalized_shape ` .
pub fn new<'a>(
        vs: impl Borrow<Path<'a>>,
        normalized_shape: impl Into<Vec<i64>>,
        eps: f64,
        elementwise_affine: bool,
    ) -> Self {
        let vs = vs.borrow();
        let normalized_shape = normalized_shape.into();
        let (weight, bias) = if elementwise_affine {
            (
                Some(vs.ones("weight", &normalized_shape)),
                Some(vs.zeros("bias", &normalized_shape)),
            )
        } else {
            (None, None)
        };
        LayerNorm {
            eps,
            elementwise_affine,
            normalized_shape,
            weight,
            bias,
        }
    }
pub fn new < ' a > ( vs : impl Borrow < Path < ' a > > , normalized_shape : impl Into < Vec < i64 > > , eps : f64 , elementwise_affine : bool , ) -> Self { let vs = vs . borrow ( ) ; let normalized_shape = normalized_shape . into ( ) ; let ( weight , bias ) = if elementwise_affine { ( Some ( vs . ones ( " " , & normalized_shape ) ) , Some ( vs . zeros ( " " , & normalized_shape ) ) , ) } else { ( None , None ) } ; LayerNorm { eps , elementwise_affine , normalized_shape , weight , bias , } }
Construct a layer normalization layer.
Construct a layer normalization layer .
vs
impl Borrow<Path<'a>>
normalized_shape
impl Into<Vec<i64>>
eps
f64
elementwise_affine
bool