MolecularDiffusion.modules.layers.e3x.features¶
Shape/parity bookkeeping for e3x rank-4 feature tensors.
Every equivariant tensor is (..., P, (L+1)**2, F):
axis
-3– parity, size 1 or 2. Index0is even (p = +1), index1is odd (p = -1).axis
-2– degree/order, size(L+1)**2, degreeloccupying the contiguous slice[l**2, (l+1)**2), degrees ascending.P = 1is the “proper tensors only” form: parity is implicit,p = (-1)**l.axis
-1– features.
Port of e3x/nn/features.py.
Functions¶
|
Union-broadcast addition of equivariant features. |
|
Per- |
|
Pad with zeros / slice away degree and parity channels. |
|
|
|
|
|
Apply a parity inversion to equivariant features. |
Module Contents¶
- MolecularDiffusion.modules.layers.e3x.features.add(*inputs: torch.Tensor) torch.Tensor¶
Union-broadcast addition of equivariant features.
L = max(L_i),P = 2if any operand hasP = 2; smaller operands are zero-padded up, never truncated. Raises on batch/feature/dtype mismatch rather than silently broadcasting a size-1 axis, which is the whole point of the function existing.
- MolecularDiffusion.modules.layers.e3x.features.broadcast_equivariant_multiplication(factor: torch.Tensor, tensor: torch.Tensor) torch.Tensor¶
Per-
(parity, degree)scaling of an equivariant tensor.factoris(n, P, L+1, F)(one value per degree),tensoris(n, P, (L+1)**2, F). Port ofbackbones/utils.broadcast_equivariant_multiplication.
- MolecularDiffusion.modules.layers.e3x.features.change_max_degree_or_type(x: torch.Tensor, max_degree: int | None = None, include_pseudotensors: bool | None = None) torch.Tensor¶
Pad with zeros / slice away degree and parity channels.
Growing
max_degreezero-pads axis -2; shrinking it slices.P=1 -> 2routes even degrees into the even block and odd degrees into the odd block, zeros elsewhere;P=2 -> 1keeps the proper-tensor slotl % 2of each degree.
- MolecularDiffusion.modules.layers.e3x.features.extract_max_degree(shape) int¶
max_degreefrom a feature shape, with e3x’s validity checks.
- MolecularDiffusion.modules.layers.e3x.features.promote_to_e3x(x: torch.Tensor) torch.Tensor¶
(n, F) -> (n, 1, 1, F). Port ofbackbones/utils.promote_to_e3x.
- MolecularDiffusion.modules.layers.e3x.features.reflect(x: torch.Tensor) torch.Tensor¶
Apply a parity inversion to equivariant features.
P=2: negate the odd-parity block.P=1: negate the odd-lblocks. Used only by the fidelity suite.