t3toolbox.tucker_tensor_train.t3_probe ====================================== .. py:function:: t3toolbox.tucker_tensor_train.t3_probe(ww: t3toolbox.backend.common.typ.Sequence[t3toolbox.backend.common.NDArray], x: TuckerTensorTrain, use_jax: bool = False) -> t3toolbox.backend.common.typ.Sequence[t3toolbox.backend.common.NDArray] Probe a TuckerTensorTrain. .. rubric:: Examples >>> import numpy as np >>> import t3toolbox.tucker_tensor_train as t3 >>> import t3toolbox.backend.probing as probing >>> x = t3.t3_corewise_randn((10,11,12),(5,6,4),(2,3,4,2)) >>> ww = (np.random.randn(10), np.random.randn(11), np.random.randn(12)) >>> zz = t3.t3_probe(ww, x) >>> x_dense = x.to_dense() >>> zz2 = probing.probe_dense(ww, x_dense) >>> print([np.linalg.norm(z - z2) for z, z2 in zip(zz, zz2)]) [1.0259410400851746e-12, 1.0909087370186656e-12, 3.620283224238675e-13] Vectorize over probes: >>> import numpy as np >>> import t3toolbox.tucker_tensor_train as t3 >>> import t3toolbox.backend.probing as probing >>> x = t3.t3_corewise_randn((10,11,12),(5,6,4),(2,3,4,2)) >>> ww = (np.random.randn(2,3, 10), np.random.randn(2,3, 11), np.random.randn(2,3, 12)) >>> zz = t3.t3_probe(ww, x) >>> x_dense = x.to_dense() >>> zz2 = probing.probe_dense(ww, x_dense) >>> print([np.linalg.norm(z - z2) for z, z2 in zip(zz, zz2)]) [2.9290244450205316e-12, 2.0347746956505754e-12, 1.7784156096697445e-12] Vectorize over probes and T3s: >>> import numpy as np >>> import t3toolbox.tucker_tensor_train as t3 >>> import t3toolbox.backend.probing as probing >>> x = t3.t3_corewise_randn((10,11,12),(5,6,4),(2,3,4,2), stack_shape=(4,5)) >>> ww = (np.random.randn(2,3, 10), np.random.randn(2,3, 11), np.random.randn(2,3, 12)) >>> zz = t3.t3_probe(ww, x) >>> x_dense = x.to_dense() >>> zz2 = probing.probe_dense(ww, x_dense) >>> print([np.linalg.norm(z - z2) for z, z2 in zip(zz, zz2)]) [1.4471391818397927e-11, 1.0485601346346092e-11, 1.437623640611662e-11]