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
weightshould be one-dimensional with the same size as the last axis ofx. If set toNonethen no scaling happens.bias (array, optional) – An additive offset to be added to the result. The
biasshould be one-dimensional with the same size as the last axis ofx. If set toNonethen no translation happens.eps (float) – A small additive constant for numerical stability.
- Returns:
The output array.
- Return type: