ut3_weights_consistent#

t3toolbox.backend.ut3_operations.ut3_weights_consistent(x, weights)#
def ut3_weights_consistent(
        x:       UT3Data,         # (tucker_supercore, tt_supercore, shape, masks)
        weights: UT3WeightsData,  # (tucker_weight_supercore, tt_weight_supercore, masks)
) -> bool:                        # True iff `weights` can be absorbed into `x`

True iff weights fits x: the padded weight shapes match, and the edge masks are equal.

Mask equality is the substance, and it is what the ragged twin (t3_weights_consistent, which compares lengths/ranks/stack) gets for free from shapes. A weight’s edges are the tensor’s edges, so it declares the same ranks; ragged enforces that structurally (a length-n weight vector against a rank-n core – a mismatch is an einsum shape error). Uniform pads both to the common (n, r), so a mismatched mask 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 slot of x. Hence an explicit structural predicate – the same precondition uniform adds to variation add/sub (docs/uniform_masks_vs_ranks.md). Non-raising (the frontend raises).

Parameters:
  • x (UT3Data)

  • weights (UT3WeightsData)

Return type:

bool