xnn.gnn.models.blocks.tp_out_irreps_with_instructions#
- xnn.gnn.models.blocks.tp_out_irreps_with_instructions(irreps1, irreps2, target_irreps, sort_instructions=True)[source]#
(uvu) tensor-product output irreps + instructions, keeping only target paths.
Enumerates the
uvutensor-product paths betweenirreps1andirreps2, keeping only those whose output irrep lies intarget_irreps, then sorts the output irreps and remaps the instruction indices accordingly. Used to build the convolutione3nn.o3.TensorProductin the MACE and NequIP interaction blocks.- Parameters:
irreps1 (e3nn.o3.Irreps) – First operand irreps (node features).
irreps2 (e3nn.o3.Irreps) – Second operand irreps (edge spherical-harmonic attributes).
target_irreps (e3nn.o3.Irreps) – Only output irreps present in this set are retained.
sort_instructions (bool, optional) – Also sort the instructions by output index (the
mace-torchconvention; the originalnequipkeeps enumeration order). The choice fixes the tensor-product weight layout, so it must match the upstream code weights are transplanted from. Default isTrue.
- Returns:
The sorted output irreps and the corresponding list of tensor-product instructions
(i, j, k, "uvu", True)referencing the sorted indices.- Return type: