For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /max/get-started.md).
Python class
LayerNorm
LayerNormβ
class max.experimental.nn.norm.LayerNorm(dim, eps=1e-05, *, keep_dtype=True, elementwise_affine=True, use_bias=True)
Bases: Module
Layer normalization over the last dimension.
Initialize LayerNorm.
-
Parameters:
-
- dim (int) β Size of the last dimension to normalize.
- eps (float) β Numerical stability constant.
- keep_dtype (bool) β Whether to preserve input dtype in computation.
- elementwise_affine (bool) β Whether to apply learned scale.
- use_bias (bool) β Whether to apply a bias. Itβs only effective if elementwise_affine is True.
biasβ
forward()β
forward(x)
Applies layer normalization to the input.
weightβ
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!