ufv_weights_consistent#

t3toolbox.backend.ufv_operations.ufv_weights_consistent(variations, weights)#
def ufv_weights_consistent(
        variations: typ.Tuple,            # UT3Variations .data: (tkv, ttv, shape, masks), stack = K + C
        weights:    UT3FrameWeightsData,  # (up, down, left, right, masks), stack = C
) -> bool:                                # True iff `weights` can be absorbed into `variations`

True iff the four weight families fit variations (non-raising): padded widths match, the weight stack is the trailing part of the variation stack, and the weight’s masks – broadcast constant over the excess K – equal the variations’ masks.

Two checks ragged does not need, both because uniform pads:

  • The trailing-stack rule is ragged’s too (a weight is frame-like: it carries C, the variations carry K + C; fv_weights_consistent), but here it must be spelled out against padded shapes.

  • Mask equality is uniform-only. Ragged catches a rank mismatch as an einsum shape error; uniform pads both to the common (nU, nD, rL, rR), so a mismatch is invisible to the shapes and would silently corrupt – a weight whose mask calls slot i padding carries a canonical zero there, so absorbing it zeroes a real variation slot. The mask comparison mirrors check_ufv_pair’s (the variation masks are constant along K).

Parameters:
  • variations (t3toolbox.backend.common.typ.Tuple)

  • weights (UT3FrameWeightsData)

Return type:

bool