mlx_rs::fast

Function layer_norm_device

Source
pub fn layer_norm_device<'a>(
    x: impl AsRef<Array>,
    weight: impl Into<Option<&'a Array>>,
    bias: impl Into<Option<&'a Array>>,
    eps: f32,
    stream: impl AsRef<Stream>,
) -> Result<Array>
Expand description

Layer normalization.

The normalization is with respect to the last axis of the input x.

ยงParams

  • x: input array
  • weight: A multiplicative weight to scale the result by. The weight should be one-dimensional with the same size as the last axis of x. If not given no scaling will occur.
  • bias: An additive offset to be added to the result. The bias should be one-dimensional with the same size as the last axis of x. It not given no offset will occur.
  • eps: A small additive constant for numerical stability
  • stream: stream or device to evaluate on