T3Weights#
- class t3toolbox.tucker_tensor_train.T3Weights#
Diagonal weights on the internal edges of a
TuckerTensorTrain– one vector per edge.A weight is a diagonal matrix inserted on a network edge (stored as its diagonal vector). Two edge families: Tucker-rank edges
nᵢ(between each Tucker factor and its TT core,len=d) and TT-bond edgesrᵢ(between neighbouring TT cores,len=d+1, endsr₀=r_d=1). The represented tensor isabsorb_weights(x, W).to_dense(); the plain (unweighted) network norm squares the inserted diagonal, sodiag(1/σ)penalises by1/σ². Batching mirrorsTuckerTensorTrain: every vector isstack_shape + (rank,)(the frame/core stackC); one object holds a stack of weights.Examples
>>> import numpy as np >>> import t3toolbox.tucker_tensor_train as t3 >>> np.random.seed(0) >>> x = t3.TuckerTensorTrain.randn((6, 7, 8), (2, 2, 2), (1, 2, 2, 1)) # minimal ranks >>> W = t3.T3Weights.from_t3svd(x) # the singular values are the canonical weight object >>> print(W.tucker_ranks, W.tt_ranks) (2, 2, 2) (1, 2, 2, 1) >>> print(W.is_consistent_with(x)) True >>> xw = t3.t3_absorb_weights(x, W) # shape-preserving; ranks unchanged >>> print(xw.ranks == x.ranks) True
- property d: int#
- Return type:
int
- property tucker_ranks: Tuple[int, Ellipsis]#
- Return type:
Tuple[int, Ellipsis]
- property tt_ranks: Tuple[int, Ellipsis]#
- Return type:
Tuple[int, Ellipsis]
- property stack_shape: Tuple[int, Ellipsis]#
- Return type:
Tuple[int, Ellipsis]
Methods#
|
Structural consistency: lengths (d / d+1) and a uniform stack_shape on every vector. |
True iff these weights' ranks + stack_shape match the |
|
Elementwise |
|
|
Elementwise |
|
Reverse the mode order (reverses both edge-vector tuples), matching |
|
Per-edge concatenation with |
|
Per-edge Kronecker product with |
|
Unstack a stack of weights into an array-like tree (mirrors |
|
Stack an array-like tree of T3Weights into one (mirrors |
|
The singular values of |