code: def random_tr(
      shape: Sequence[int],
      rank: Sequence[int],
      /,
      *,
      dtype: Optional[Union[ivy.Dtype, ivy.NativeDtype]] = None,
      full: Optional[bool] = False,
      seed: Optional[int] = None,
  ) -> Union[ivy.TRTensor, ivy.Array]:
      """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 :
          seed for generating random numbers
      context : dict
          context in which to create the tensor
  
      Returns
      -------
      ivy.TRTensor or ivy.Array if full is True
      """
      rank = ivy.TRTensor.validate_tr_rank(shape, rank)
      # Make sure it's not a tuple but a list
      rank = list(rank)
      _check_first_and_last_rank_elements_are_equal(rank)
      factors = [
          ivy.random_uniform(
              shape=(rank[i], s, rank[i + 1]), dtype=dtype, seed=seed
          )
          for i, s in enumerate(shape)
      ]
      if full:
          return ivy.TRTensor.tr_to_tensor(factors)
      else:
          return ivy.TRTensor(factors)
  
imports: from typing import Union, Tuple, Optional, Sequence, Iterable, Generator
  import warnings
  import ivy
  from ivy.utils.backend import current_backend
  from ivy.utils.exceptions import handle_exceptions
  from ivy.func_wrapper import outputs_to_ivy_arrays, handle_nestable, to_native_arrays_and_back, handle_out_argument, infer_dtype, handle_array_like_without_promotion, inputs_to_ivy_arrays, handle_device, handle_backend_invalid, handle_array_function
label_desc: Use image node_id 17 for calling a global function with example usage: random_tr() and returns: ivy, ivy