InvariantConstraint#
- class InvariantConstraint(rep)[source]#
Bases:
ModuleOrthogonally project vectors onto \(\mathrm{Fix}(\rho)\).
For representation \(\rho_{\mathcal{X}}\), this parametrization enforces
\[\mathbf{b} \in \mathrm{Fix}(\rho_{\mathcal{X}}) = \{\mathbf{v}\in\mathcal{X}: \rho_{\mathcal{X}}(g)\mathbf{v}=\mathbf{v},\ \forall g\in\mathbb{G}\},\]by applying \(\mathbf{P}_{\mathrm{inv}}\) from
invariant_orthogonal_projector().Note
Runtime behavior depends on mode. In training mode (
model.train()), the projection is recomputed each forward pass. In inference mode (model.eval()), the projected output is cached for the same unchanged input tensor (same object identity and version counter), which is faster. With the cache active, the operation is equivalent to a symmetry-agnostic fixed linear map \(\mathbf{b}\mapsto\mathbf{P}_{\mathrm{inv}}\mathbf{b}\).- Parameters:
rep (Representation)
- rep#
Representation \(\rho\) whose action defines invariance, dimension
rep.size.- Type:
- inv_projector#
Orthogonal projector of shape
(rep.size, rep.size)onto the fixed subspace \(\mathrm{Fix}(\rho)\).- Type:
Precompute the invariant projector for the supplied representation.