canonical_groups#
- t3toolbox.backend.sharing.canonical_groups(sharing, shape)#
def canonical_groups( sharing: typ.Optional[typ.Sequence], # len=d group labels, or None shape: typ.Tuple[int, ...], # the mode sizes (group members must agree) ) -> typ.Tuple[typ.Tuple[int, ...], ...]: # canonical partition, () when there is nothing to tie
Normalize a
sharingspec to a canonical partition, collapsing “nothing is tied” to().Noneand an all-singleton partition both give(), so a consumer that stores the partition has exactly ONE representation of the unshared case – which matters when the partition is part of an object’s value identity (a jitaux_datakey).validate_sharing()+nontrivial_groups()do the work; this just names the pairing, which callers otherwise open-code.- Parameters:
sharing (t3toolbox.backend.common.typ.Optional[t3toolbox.backend.common.typ.Sequence])
shape (t3toolbox.backend.common.typ.Tuple[int, ...])
- Return type:
t3toolbox.backend.common.typ.Tuple[t3toolbox.backend.common.typ.Tuple[int, …], …]