ut3_kronecker_weights#
- t3toolbox.backend.ut3_operations.ut3_kronecker_weights(weights_A, weights_B)#
def ut3_kronecker_weights( weights_A: UT3WeightsData, # (tucker_weight_supercore, tt_weight_supercore, masks) weights_B: UT3WeightsData, # (tucker_weight_supercore, tt_weight_supercore, masks) ) -> UT3WeightsData: # per-edge Kronecker: padded widths MULTIPLY, masks Kronecker
Per-edge Kronecker product of two uniform weights – the Hadamard (
⊙) combine, where ranks multiply. Uniform twin oft3_kronecker_weights.Kronecker the weights, Kronecker the masks – that is the whole operation. Treat the mask as just another weight that happens to hold 0s and 1s: what we need is
weight_AB * mask_AB == kron(weight_A * mask_A, weight_B * mask_B), and it is satisfied byweight_AB = kron(weight_A, weight_B)andmask_AB = kron(mask_A, mask_B), because elementwise multiply commutes with the Kronecker product:kron(a∘p, b∘q) = kron(a,b) ∘ kron(p,q)(the mixed-product property, for any vectors – nothing here is special to booleans). So there is no mask cleverness: the samekron_lastruns on both operands.Each edge is a last-axis outer product, then reshape:
(wA ⊗ wB)[..., a*nB + b] = wA[..., a] · wB[..., b]– A-major, over the PADDED widths, with the shared(d,)+stackprefix broadcast. This is the one real trap: notnp.kron, which would Kronecker the mode/stack axes too (the ragged build hit exactly that). A-major must also agree with whatever core-combine pairs with it.The resulting mask is not an interval – the real set is
{a*nB + b : mask_A[a] and mask_B[b]}, strided over the padded widthnB, so even two prefix inputs give holes ({0,1}of 3 times{0}of 2 gives{0, 2};docs/uniform_masks_vs_ranks.md). That is a description of the output, not a difficulty: it costs nothing here, and only obliges consumers to read the mask rather than slice a prefix. It cannot be flattened to a prefix of rankrA*rB: slota*nB + bwithb >= rank_BholdswA[a] * <padding>, so a prefix mask would claim padding as real data (phantom rank).Note there is currently no uniform Hadamard (
ut3_addexists;ut3_multdoes not), so this op ships verified against the ragged oracle but without a uniform core-combine partner – seedocs/contributor/weighted_internals.md§3.- Parameters:
weights_A (UT3WeightsData)
weights_B (UT3WeightsData)
- Return type:
UT3WeightsData