UniformTuckerTensorTrain.probe#
- t3toolbox.uniform_tucker_tensor_train.UniformTuckerTensorTrain.probe(ww)#
def probe( self, ww: Sequence[NDArray], # len=d, ith elm_shape=W+(Ni,) ) -> Sequence[NDArray]: # len=d, ith elm_shape=W+stack_shape+(Ni,)
Probe: contract all-but-one mode, for each mode (leaving mode
ifree), without forming the dense tensor (sharesut3_probe()).The probe stack
W(onww) is base-inner with the T3 stack: each probe isW + stack_shape + (Ni,). Precondition-free. Uniform mirror ofprobe().See also
Examples
>>> import numpy as np >>> import t3toolbox.tucker_tensor_train as t3 >>> import t3toolbox.uniform_tucker_tensor_train as ut3 >>> np.random.seed(0) >>> x = ut3.UniformTuckerTensorTrain.from_t3(t3.TuckerTensorTrain.randn((10, 11, 12), (5, 6, 4), (1, 2, 3, 1))) >>> ww = (np.random.randn(10), np.random.randn(11), np.random.randn(12)) >>> zz = x.probe(ww) >>> print([z.shape for z in zz]) # one free mode each: (Ni,) [(10,), (11,), (12,)] >>> print(bool(np.allclose(zz[0], np.einsum('ijk,j,k->i', x.to_dense(), ww[1], ww[2])))) True