T3Variations.unstack ==================== .. py:method:: t3toolbox.frame_variations_format.T3Variations.unstack() .. code-block:: python def unstack(self): Unstack into an array-like tree. .. rubric:: Examples >>> import numpy as np >>> import t3toolbox.frame_variations_format as bvf >>> import t3toolbox.corewise as cw >>> np.random.seed(0) >>> rnd = lambda x: np.random.randn(*x) >>> ss = (2, 3) # stack: unstack splits these leading axes >>> NN, nnU, nnD, rrL, rrR = (10, 11, 12), (8, 7, 8), (6, 7, 8), (2, 3, 4, 3), (5, 4, 6, 1) >>> tucker_variations = tuple(rnd(ss+(n, N)) for n, N in zip(nnD, NN)) >>> tt_variations = tuple(rnd(ss+(rL, n, rR)) for rL, n, rR in zip(rrL[:-1], nnU, rrR[1:])) >>> V = bvf.T3Variations(tucker_variations, tt_variations) >>> VV = V.unstack() >>> print(len(VV), len(VV[0])) # nested tree shaped like the stack (2, 3) 2 3 >>> ii, jj = 1, 2 # the [ii][jj] leaf is the cores sliced at [ii, jj] >>> sliced = bvf.T3Variations( ... tuple(c[ii, jj] for c in tucker_variations), tuple(c[ii, jj] for c in tt_variations)) >>> print(np.allclose(cw.corewise_norm(cw.corewise_sub(VV[ii][jj].data, sliced.data)), 0.0)) True