mlx.core.fast.layer_norm#
- layer_norm(x: array, weight: array | None, bias: array | None, eps: float, *, stream: None | Stream | Device = None) array #
Layer normalization.
The normalization is with respect to the last axis of the input
x
.- Parameters:
x (array) – Input array.
weight (array, optional) – A multiplicative weight to scale the result by. The
weight
should be one-dimensional with the same size as the last axis ofx
. If set toNone
then no scaling happens.bias (array, optional) – An additive offset to be added to the result. The
bias
should be one-dimensional with the same size as the last axis ofx
. If set toNone
then no translation happens.eps (float) – A small additive constant for numerical stability.
- Returns:
The output array.
- Return type: