code: def partial_fold(unfolded, mode, shape, skip_begin=1, skip_end=0):
      """Re-folds a partially unfolded tensor
  
      Parameters
      ----------
      unfolded : ndarray
          a partially unfolded tensor
      mode : int
          indexing starts at 0, therefore mode is in range(0, tensor.ndim)
      shape : tuple
          the shape of the original full tensor (including skipped dimensions)
      skip_begin : int, optional, default is 1
          number of dimensions to leave untouched at the beginning
      skip_end : int, optional
          number of dimensions to leave untouched at the end
  
      Returns
      -------
      ndarray
          partially re-folded tensor
      """
      transposed_shape = list(shape)
      mode_dim = transposed_shape.pop(skip_begin + mode)
      transposed_shape.insert(skip_begin, mode_dim)
      return tl.moveaxis(
          tl.reshape(unfolded, transposed_shape),
          skip_begin,
          skip_begin + mode,
      )
  
file_path: tensorly/tensorly/base.py
imports: from math import prod
  from .None import backend
label_desc: Use image node_id 6 for calling a global function with example usage: partial_fold(unfolded, mode, shape, skip_begin, skip_end) and returns: tl