Normalization
Equivariant normalization rescales spherical features without changing their rotation rules. EquivariantRMSNorm combines a shared RMS scale for each sample with optional centering and learnable affine parameters that preserve equivariance.
EquivariantRMSNorm
EquivariantRMSNorm(
l_max: int,
channels: int,
*,
eps: float = 1e-05,
learnable: bool = True,
center: bool = True,
weighting: Literal["l_balanced", "component"] = "l_balanced",
device: device | str | None = None,
dtype: dtype | None = None,
)
Bases: Module
Normalize complete SO(3) tensors with one RMS per sample.
Inputs contain one complete real SO(3) irrep for every l = 0, ..., l_max
and use the l-major shape (..., (l_max + 1) ** 2, channels). When
center is true, the scalar channels are first centered as
The default l_balanced weighting gives every l block equal weight:
component weighting instead averages all (l, m, c) entries uniformly.
The normalized tensor shares the sample-dependent scale
\((q+\varepsilon)^{-1/2}\). When learnable is true, the result is multiplied
by a learned weight[l, c] shared across m; centered scalar channels also
receive a learned bias[c]:
Sharing parameters across m and restricting the bias to l = 0 makes
the operation commute with rotations. Contiguous CUDA float16, bfloat16,
and float32 inputs use fused Triton forward and first-order backward
kernels; higher-order gradients and other inputs use differentiable
PyTorch expressions.
Parameters:
-
l_max(int) –Highest included non-negative
l. -
channels(int) –Number of channels shared by every spherical component.
-
eps(float, default:1e-05) –Positive value added before the reciprocal square root.
-
learnable(bool, default:True) –Learn the equivariant scale and, when centering, scalar bias.
-
center(bool, default:True) –Subtract the mean of the
l = 0channels for every sample. -
weighting(Literal['l_balanced', 'component'], default:'l_balanced') –Give each
lblock or each spherical component equal weight. -
device(device | str | None, default:None) –Initial device of parameters and buffers.
-
dtype(dtype | None, default:None) –Initial floating dtype of parameters and weights.
Attributes:
-
weight(Tensor | None) –Learned scale with shape
(l_max + 1, channels), orNone. -
bias(Tensor | None) –Learned scalar bias with shape
(channels,), orNone.
forward
forward(so3_tensor: Tensor) -> Tensor
Parameters:
-
so3_tensor(Tensor) –[..., (l_max+1)**2, C].
Returns:
-
normalized_so3_tensor(Tensor) –[..., (l_max+1)**2, C].