code: def tr_to_tensor(factors):
      """Returns the full tensor whose TR decomposition is given by 'factors'
  
          Re-assembles 'factors', which represent a tensor in TR format
          into the corresponding full tensor
  
      Parameters
      ----------
      factors : list of 3D-arrays
                TR factors (TR-cores)
  
      Returns
      -------
      output_tensor : ndarray
                     tensor whose TR decomposition was given by 'factors'
      """
      full_shape = [f.shape[1] for f in factors]
      full_tensor = tl.reshape(factors[0], (-1, factors[0].shape[2]))
  
      for factor in factors[1:-1]:
          rank_prev, _, rank_next = factor.shape
          factor = tl.reshape(factor, (rank_prev, -1))
          full_tensor = tl.dot(full_tensor, factor)
          full_tensor = tl.reshape(full_tensor, (-1, rank_next))
  
      full_tensor = tl.reshape(
          full_tensor, (factors[-1].shape[2], -1, factors[-1].shape[0])
      )
      full_tensor = tl.moveaxis(full_tensor, 0, -1)
      full_tensor = tl.reshape(
          full_tensor, (-1, factors[-1].shape[0] * factors[-1].shape[2])
      )
      factor = tl.moveaxis(factors[-1], -1, 1)
      factor = tl.reshape(factor, (-1, full_shape[-1]))
      full_tensor = tl.dot(full_tensor, factor)
      return tl.reshape(full_tensor, full_shape)
  
imports: import warnings
  import numpy
  import tensorly
  from ._factorized_tensor import FactorizedTensor
label_desc: Use image node_id 1 for calling a global function with example usage: tr_to_tensor(factors) and returns: tl