megengine.functional.nn.layer_norm#
- layer_norm(inp, normalized_shape, affine, weight=None, bias=None, eps=1e-5)[源代码]#
Applies layer normalization to the input. Support tensor of any shape as input. Reference: https://arxiv.org/pdf/1803.08494.pdf.
- 参数:
inp (
Tensor
) – 输入张量。normalized_shape (
tuple
) – the shape that you want to be normalizatedaffine (
bool
) – whether to use weight and biasweight (
Optional
[Tensor
]) – must not be None when the affine is truebias (
Optional
[Tensor
]) – must not be None when the affine is trueeps (
float
) – 添加到分母的单个值,增加数值稳定性。默认:1e-5