t3toolbox.tucker_tensor_train.t3_corewise_randn#
- t3toolbox.tucker_tensor_train.t3_corewise_randn(shape: t3toolbox.backend.common.typ.Tuple[int, Ellipsis], tucker_ranks: t3toolbox.backend.common.typ.Tuple[int, Ellipsis], tt_ranks: t3toolbox.backend.common.typ.Tuple[int, Ellipsis], stack_shape: t3toolbox.backend.common.typ.Tuple[int, Ellipsis] = (), use_jax: bool = False) TuckerTensorTrain#
Construct a Tucker tensor train with random cores.
- Parameters:
structure (T3Structure) – Tucker tensor train structure (shape, tucker_ranks, tt_ranks)=((N0,…,N(d-1)), (n0,…,n(d-1)), (1,r1,…,r(d-1),1))).
randn (typ.Callable[[..., NDArray]) – Function for creating random arrays. Arguments are a sequence of ints defining the shape of the array. Default: np.random.randn (numpy)
- Returns:
Dense tensor represented by x, which has shape (N0, …, N(d-1))
- Return type:
See also
TuckerTensorTrain,T3StructureExamples
>>> from t3toolbox import * >>> import t3toolbox.tucker_tensor_train as t3 >>> shape = (14, 15, 16) >>> tucker_ranks = (4, 5, 6) >>> tt_ranks = (1, 3, 2, 1) >>> stack_shape = (2,3) >>> x = t3.t3_corewise_randn(shape, tucker_ranks, tt_ranks, stack_shape=stack_shape) # TuckerTensorTrain with random cores >>> x.uniform_structure == (shape, tucker_ranks, tt_ranks, stack_shape) True >>> print(x.tucker_cores[0][0,0,0,0]) # should be random N(0,1) 0.0331003310807162 >>> print(x.tt_cores[0][0,0,0,0,0]) # should be random N(0,1) -0.10778923886039414