groups_to_labels#

t3toolbox.backend.sharing.groups_to_labels(groups)#
def groups_to_labels(
        groups: typ.Tuple[typ.Tuple[int, ...], ...],  # static; canonical form (validate_sharing)
) -> typ.Tuple[int, ...]:                             # len=d, static; the per-mode label spec

The inverse of validate_sharing(): per-mode integer labels for a canonical partition (validate_sharing(groups_to_labels(g), shape) == g).

Examples

>>> import t3toolbox.backend.sharing as sharing
>>> sharing.groups_to_labels(((0, 2), (1,)))
(0, 1, 0)
Parameters:

groups (t3toolbox.backend.common.typ.Tuple[t3toolbox.backend.common.typ.Tuple[int, ...], ...])

Return type:

t3toolbox.backend.common.typ.Tuple[int, …]