megengine.functional.nn.layer_norm¶
- layer_norm(inp, normalized_shape, affine, weight=None, bias=None, eps=1e-05)[source]¶
Applies layer normalization to the input.
Refer to
LayerNormfor more information.- Parameters
inp (
Tensor) – input tensor.normalized_shape (
tuple) – the shape that you want to be normalizated Seenormalized_shapeinLayerNorm.affine (
bool) – whether to use learnable affine parameters (weight, bias)weight (
Optional[Tensor]) – scaling tensor in the learnable affine parameters. See \(\gamma\) inLayerNorm.bias (
Optional[Tensor]) – bias tensor in the learnable affine parameters. See \(\beta\) inLayerNorm.eps (
float) – a value added to the denominator for numerical stability. Default: 1e-5