tt_matrix_to_tensor#

ivy.tt_matrix_to_tensor(tt_matrix, /, *, out=None)[source]#

Return the full tensor whose TT-Matrix decomposition is given by ‘factors’ Re- assembles ‘factors’, which represent a tensor in TT-Matrix format into the corresponding full tensor.

Parameters:
  • tt_matrix (Union[Array, NativeArray]) – array of 4D-arrays TT-Matrix factors (known as core) of shape (rank_k, left_dim_k, right_dim_k, rank_{k+1})

  • out (Optional[Array], default: None) – Optional output array. If provided, the output array to store the result.

Return type:

Array

Returns:

output_tensor (array) – tensor whose TT-Matrix decomposition was given by ‘factors’

Examples

>>> x = ivy.array([[[[[0.49671414],
...                      [-0.1382643]],
...
...                     [[0.64768857],
...                      [1.5230298]]]],
...                   [[[[-0.23415337],
...                      [-0.23413695]],
...
...                     [[1.57921278],
...                      [0.76743472]]]]])
>>> y = ivy.tt_matrix_to_tensor(x)
>>> print(y)
ivy.array([[[[-0.1163073 , -0.11629914],
[ 0.03237505,  0.03237278]],

[[ 0.78441733, 0.38119566], [-0.21834874, -0.10610882]]],

[[[-0.15165846, -0.15164782], [-0.35662258, -0.35659757]],

[[ 1.02283812, 0.49705869], [ 2.40518808, 1.16882598]]]])

Array.tt_matrix_to_tensor(self, /, *, out=None)[source]#

Ivy.Array instance method variant of ivy.tt_matrix_to_tensor. This method simply wraps the function, and so the docstring for ivy.tt_matrix_to_tensor also applies to this method with minimal changes.

Parameters:
  • self (Union[Array, NativeArray]) – array of 4D-arrays TT-Matrix factors (known as core) of shape (rank_k, left_dim_k, right_dim_k, rank_{k+1})

  • out (Optional[Array], default: None) – Optional output array. If provided, the output array to store the result.

Return type:

Array

Returns:

>>> a = ivy.array([[[[[0.49671414],
...                      [-0.1382643]],
...
...                     [[0.64768857],
...                      [1.5230298]]]],
...                   [[[[-0.23415337],
...                      [-0.23413695]],
...
...                     [[1.57921278],
...                      [0.76743472]]]]])
>>> a.tt_matrix_to_tensor()
ivy.array([[[[-0.1163073 , -0.11629914],
 [ 0.03237505,  0.03237278]],
[[ 0.78441733, 0.38119566],

[-0.21834874, -0.10610882]]],

[[[-0.15165846, -0.15164782],

[-0.35662258, -0.35659757]],

[[ 1.02283812, 0.49705869],

[ 2.40518808, 1.16882598]]]])

Container.tt_matrix_to_tensor(self, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#

ivy.Container instance method variant of ivy.tt_matrix_to_tensor. This method simply wraps the function, and so the docstring for ivy.tt_matrix_to_tensor also applies to this method with minimal changes.

Parameters:
  • tt_matrix – array of 4D-arrays TT-Matrix factors (known as core) of shape (rank_k, left_dim_k, right_dim_k, rank_{k+1})

  • out (Optional[Container], default: None) – optional output container, for writing the result to.

Return type:

Container

Returns:

output_tensor – tensor whose TT-Matrix decomposition was given by ‘factors’

Examples

>>> x = ivy.Container(a=ivy.array([[[[[0.49671414],
...                      [-0.1382643]],
...
...                     [[0.64768857],
...                      [1.5230298]]]],
...                   [[[[-0.23415337],
...                      [-0.23413695]],
...
...                     [[1.57921278],
...                      [0.76743472]]]]])))
>>> y = ivy.Container.tt_matrix_to_tensor(x)
>>> print(y["a"])
ivy.array([[[[-0.1163073 , -0.11629914],
[ 0.03237505,  0.03237278]],

[[ 0.78441733, 0.38119566], [-0.21834874, -0.10610882]]],

[[[-0.15165846, -0.15164782], [-0.35662258, -0.35659757]],

[[ 1.02283812, 0.49705869], [ 2.40518808, 1.16882598]]]])