UT3Weights.has_shared_tucker_weights#

t3toolbox.uniform_tucker_tensor_train.UT3Weights.has_shared_tucker_weights(sharing, rtol=1e-09)#
def has_shared_tucker_weights(
        self,
        sharing:    typ.Sequence,   # len=d; one hashable group label per mode
        rtol:       float = 1e-9,   # relative tolerance on the Tucker-weight deviation
) -> NDArray:  # bool array, shape = stack_shape (scalar/0-d when unstacked)

True (per stack element) if the MASKED Tucker weights are equal within every sharing group – the uniform twin of has_shared_tucker_weights() (padding is don’t-care; unequal group rank masks raise). Non-enforcing.

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 = t3.TuckerTensorTrain.randn((6, 6, 5), (3, 3, 2), (1, 3, 2, 1))
>>> tk, tt = x.data
>>> uxs = ut3.UniformTuckerTensorTrain.from_t3(t3.TuckerTensorTrain((tk[0], tk[0], tk[2]), tt))
>>> W = ut3.UT3Weights.from_ut3svd(uxs, sharing=(0, 0, 1))
>>> print(bool(W.has_shared_tucker_weights((0, 0, 1))))
True
>>> print(bool(ut3.UT3Weights.from_ut3svd(uxs).has_shared_tucker_weights((0, 0, 1))))
False
Parameters:
  • sharing (Sequence)

  • rtol (float)

Return type:

NDArray