pub fn layer_norm<const D: usize>(
input: Tensor<D>,
gamma: Tensor<1>,
beta: Option<Tensor<1>>,
epsilon: f64,
) -> Tensor<D>Expand description
Applies Layer Normalization over the last dimension of the input tensor.
Computes (x - mean) / sqrt(var + epsilon) * gamma + beta, where mean and
(biased) var are reduced over the last axis.
§Shapes
- input:
[..., any, d_model] - output:
[..., any, d_model]