code: def fold(unfolded_tensor, mode, shape):
      """Refolds the mode-`mode` unfolding into a tensor of shape `shape`
  
          In other words, refolds the n-mode unfolded tensor
          into the original tensor of the specified shape.
  
      Parameters
      ----------
      unfolded_tensor : ndarray
          unfolded tensor of shape ``(shape[mode], -1)``
      mode : int
          the mode of the unfolding
      shape : tuple
          shape of the original tensor before unfolding
  
      Returns
      -------
      ndarray
          folded_tensor of shape `shape`
      """
      full_shape = list(shape)
      mode_dim = full_shape.pop(mode)
      full_shape.insert(0, mode_dim)
      return tl.moveaxis(
          tl.reshape(unfolded_tensor, full_shape), 0, mode
      )
  
file_path: tensorly/tensorly/base.py
imports: from math import prod
  from .None import backend
label_desc: Use image node_id 4 for calling a global function with example usage: fold(unfolded_tensor, mode, shape) and returns: tl