random_tr#

ivy.random_tr(shape, rank, /, *, dtype=None, full=False, seed=None)[source]#

Generate a random TR tensor.

Parameters:
  • shape (tuple) – shape of the tensor to generate

  • rank (Sequence[int]) – rank of the TR decomposition must verify rank[0] == rank[-1] (boundary conditions) and len(rank) == len(shape)+1

  • full (bool, optional, default is False) – if True, a full tensor is returned otherwise, the decomposed tensor is returned

  • seed (Optional[int], default: None) – seed for generating random numbers

  • context (dict) – context in which to create the tensor

Return type:

Union[TRTensor, Array]

Returns:

ivy.TRTensor or ivy.Array if full is True