T3Variations#
- class t3toolbox.frame_variations_format.T3Variations#
Tuple containing variation cores for frame-variation representations of TuckerTensorTrains.
- Components
tucker_variations = (V0, …, V(d-1)), elm_shape=stack_shape+(nDi, Ni)
tt_variations = (H0, …, H(d-1)), elm_shape=stack_shape+(rLi, nUi, rRi)
The variations should fit in the “holes” of a T3Frame.
See also
T3FrameExamples
Build variations that fill the holes of a base point (so
check_fv_pairaccepts them):>>> import numpy as np >>> import t3toolbox.frame_variations_format as bvf >>> ss = (2, 3) # stack shape, shared by frame and variations >>> up_tucker_cores = (np.ones(ss+(10, 14)), np.ones(ss+(11, 15)), np.ones(ss+(12, 16))) >>> left_tt_cores = (np.ones(ss+(1, 10, 2)), np.ones(ss+(2, 11, 3)), np.ones(ss+(3, 12, 5))) >>> right_tt_cores = (np.ones(ss+(2, 10, 4)), np.ones(ss+(4, 11, 5)), np.ones(ss+(5, 12, 1))) >>> down_tt_cores = (np.ones(ss+(1, 9, 4)), np.ones(ss+(2, 8, 5)), np.ones(ss+(3, 7, 1))) >>> frame = bvf.T3Frame(up_tucker_cores, down_tt_cores, left_tt_cores, right_tt_cores) >>> tucker_shapes, tt_shapes = frame.variation_shapes # the holes to fill >>> tucker_variations = tuple(np.ones(ss + s) for s in tucker_shapes) >>> tt_variations = tuple(np.ones(ss + s) for s in tt_shapes) >>> variations = bvf.T3Variations(tucker_variations, tt_variations) >>> print(variations.variation_shapes == frame.variation_shapes) # fits the frame's holes exactly True
- __rmul__#
Methods#
|
|
|
|
The full leading stack |
|
T3Variations shapes that fit with this T3Frame. |
|
|
|
|
Copy with all variation cores converted to jax arrays. |
|
Copy with all variation cores converted to numpy arrays. |
|
Deep copy (copies every variation core). |
True if any variation core is a jax array. |
|
|
Number of elements of the represented dense tensor ( |
Number of stored core entries (size on disk). |
|
|
|
|
Check rank and shape consistency of Tucker tensor train variations (T3Variations). |
|
Unstack into an array-like tree. |
|
Stack array-like tree of T3Variations into a single T3Variation. |
|
Zero variations of the given structure (additive identity). |
|
Variations with i.i.d. N(0,1) core entries (corewise, ungauged). See |
|
Canonical unit variation: zero except a single core entry set to 1. |
|
Zero variations matching the structure (shapes + stack) of |
|
Random variations matching the structure (shapes + stack) of |
Flatten the variation cores to a 1D vector (the tangent's degrees of freedom). |
|
|
Inverse of |
|
Save the variation cores to a |
|
Load variations saved by |
|
Reverse the mode order (corewise): reverse the tucker-variation order and reverse+transpose |
|
Corewise sum over stack axes (a batch of variations -> their sum). |
|
Corewise sum (variations form a vector space). |
|
Corewise difference. |
|
Corewise scalar multiplication. |
|
Corewise negation. |
|
|