megengine.functional.nn.layer_norm¶
- layer_norm(inp, normalized_shape, affine, weight=None, bias=None, eps=1e-05)[源代码]¶
对输入应用 layer normalization。
Refer to
LayerNormfor more information.- 参数
inp (
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) – 添加到分母的单个值,增加数值稳定性。默认:1e-5