code: def unfold(tensor, mode):
      
      return np.moveaxis(tensor, mode, 0).reshape((tensor.shape[mode], -1))
docs: Returns the mode-`mode` unfolding of `tensor`.
  
      Parameters
      ----------
      tensor : ndarray
      mode : int
  
      Returns
      -------
      ndarray
          unfolded_tensor of shape ``(tensor.shape[mode], -1)``
  
      Author
      ------
      Jean Kossaifi <https://github.com/tensorly>