fv_empty_frame#

t3toolbox.backend.padded_frames.fv_empty_frame(shape, stack_shape=(), use_jax=False)#
def fv_empty_frame(
        shape:        typ.Sequence[int],        # len=d, the mode sizes (N0, ..., N(d-1))
        stack_shape:  typ.Sequence[int] = (),   # C
        use_jax:      bool = False,             # array-free constructor: the flag chooses the output type
) -> typ.Tuple[                                 # the frame of the zero tensor (default float), b = (1, 0, ..., 0, 1):
    typ.Tuple[NDArray, ...],    # down.  len=d, elm_shape=C+(0, Ni)
    typ.Tuple[NDArray, ...],    # up.    len=d, elm_shape=C+(bi, 0, b(i+1))
    typ.Tuple[NDArray, ...],    # left.  len=d, elm_shape=C+(bi, 0, b(i+1))
    typ.Tuple[NDArray, ...],    # right. len=d, elm_shape=C+(bi, 0, b(i+1))
]:

The frame of the zero tensor: the orthogonal representation’s layout at Tucker ranks 0 and TT ranks b.

Examples

Every rank axis has width 0 except the boundary bonds:

>>> import t3toolbox.backend.padded_frames as padded_frames
>>> down, up, left, right = padded_frames.fv_empty_frame((5, 6, 7))
>>> print([D.shape for D in down], [G.shape for G in left])
[(0, 5), (0, 6), (0, 7)] [(1, 0, 0), (0, 0, 0), (0, 0, 1)]

It is the orthogonal representation of the rank-0 Tucker tensor train, here with a stack C = (2,):

>>> import t3toolbox.tucker_tensor_train as t3
>>> import t3toolbox.backend.fv_conversions as fvc
>>> x = t3.TuckerTensorTrain.zeros((5, 6, 7), (0, 0, 0), (1, 0, 0, 1), stack_shape=(2,))
>>> frame = fvc.t3_orthogonal_representations(x.data)[0]
>>> empty = padded_frames.fv_empty_frame((5, 6, 7), stack_shape=(2,))
>>> print(all(a.shape == b.shape for f, g in zip(frame, empty) for a, b in zip(f, g)))
True
Parameters:
  • shape (t3toolbox.backend.common.typ.Sequence[int])

  • stack_shape (t3toolbox.backend.common.typ.Sequence[int])

  • use_jax (bool)

Return type:

t3toolbox.backend.common.typ.Tuple[t3toolbox.backend.common.typ.Tuple[NDArray, …], t3toolbox.backend.common.typ.Tuple[NDArray, …], t3toolbox.backend.common.typ.Tuple[NDArray, …], t3toolbox.backend.common.typ.Tuple[NDArray, …]]