Skip to main content

layer_norm

Function layer_norm 

Source
pub fn layer_norm(
    x: &Tensor,
    weight: &Tensor,
    bias: &Tensor,
    eps: f32,
) -> Tensor
Expand description

Layer normalization over the last dimension of an ND tensor.

ONE PATH: This is the canonical functional layer norm. All standalone layer_norm implementations MUST delegate here (UCBD §4).

Equation: y_i = (x_i - mean) / sqrt(var + eps) * weight_i + bias_i

Contract: layernorm-kernel-v1, equation “layernorm”