code: def random_tucker(
      shape,
      rank,
      full=False,
      orthogonal=False,
      random_state=None,
      non_negative=False,
      **context,
  ):
      """Generates a random Tucker tensor
  
      Parameters
      ----------
      shape : tuple
          shape of the tensor to generate
      rank : int or int list
          rank of the Tucker decomposition
          if int, the same rank is used for each mode
          otherwise, dimension of each mode
      full : bool, optional, default is False
          if True, a full tensor is returned
          otherwise, the decomposed tensor is returned
      orthogonal : bool, optional, default is False
          if True, creates a tensor with orthogonal components
      random_state : `np.random.RandomState`
  
      Returns
      -------
      tucker_tensor : ND-array or (ND-array, 2D-array list)
          ND-array : full tensor if `full` is True
          (ND-array, 2D-array list) : core tensor and list of factors otherwise
      """
      rns = T.check_random_state(random_state)
  
      rank = validate_tucker_rank(shape, rank)
  
      if orthogonal:
          for i, (s, r) in enumerate(zip(shape, rank)):
              if r > s:
                  warnings.warn(
                      "Selected orthogonal=True, but selected a rank larger than the tensor size for mode {0}: "
                      f"rank[{i}]={r} > shape[{i}]={s}."
                  )
  
      factors = []
      for s, r in zip(shape, rank):
          if orthogonal:
              factor = T.tensor(rns.random_sample((s, s)), **context)
              Q, _ = T.qr(factor)
              factors.append(T.tensor(Q[:, :r]))
          else:
              factors.append(
                  T.tensor(rns.random_sample((s, r)), **context)
              )
  
      core = T.tensor(rns.random_sample(rank), **context)
  
      if non_negative:
          factors = [T.abs(f) for f in factors]
          core = T.abs(core)
  
      if full:
          return tucker_to_tensor((core, factors))
      else:
          return TuckerTensor((core, factors))
  
file_path: tensorly/tensorly/random/base.py
imports: import numpy
  from ..cp_tensor import cp_to_tensor, CPTensor, cp_normalize, validate_cp_rank
  from ..tucker_tensor import tucker_to_tensor, TuckerTensor, validate_tucker_rank
  from ..tt_tensor import tt_to_tensor, TTTensor, validate_tt_rank
  from ..tt_matrix import tt_matrix_to_tensor, TTMatrix, validate_tt_matrix_rank
  from ..tr_tensor import TRTensor, tr_to_tensor, validate_tr_rank
  from ..parafac2_tensor import parafac2_to_tensor, Parafac2Tensor, parafac2_normalise
  from ..None import backend
  import warnings
label_desc: Use image node_id 4 for calling a global function with example usage: random_tucker(shape, rank, full, orthogonal, random_state, non_negative) and returns: tucker_to_tensor, TuckerTensor