RMSNorm#
- class sdm.nn.RMSNorm(normalized_shape: int | list[int] | Size, eps: float | None = None, elementwise_affine: bool = True, device=None, dtype=None)#
Bases:
RMSNormA
torch.nn.RMSNormthat dispatches to an efficient kernel.- forward(x: Tensor, rope: RotaryEmbedding | None = None) Tensor#
Apply optional rotary embeddings before normalization.
- Parameters:
x (Tensor) – Input with shape
[..., C], or[..., S, H, C]with rotary embeddings, whereSis the sequence length,His the number of heads, andCis channels per head.rope (RotaryEmbedding | None) – Optional rotary embedding applied to the input.
- Return type: