code: def shuffle_dataset(loader, cur_epoch):
      """ "
      Shuffles the data.
      Args:
          loader (loader): data loader to perform shuffle.
          cur_epoch (int): number of the current epoch.
      """
      if (
          loader._dataset_kind
          == torch.utils.data.dataloader._DatasetKind.Iterable
      ):
          if hasattr(loader.dataset, "sampler"):
              sampler = loader.dataset.sampler
          else:
              raise RuntimeError(
                  "Unknown sampler for IterableDataset when shuffling dataset"
              )
      else:
          sampler = (
              loader.batch_sampler.sampler
              if isinstance(
                  loader.batch_sampler, ShortCycleBatchSampler
              )
              else loader.sampler
          )
      assert isinstance(
          sampler, (RandomSampler, DistributedSampler)
      ), "Sampler type '{}' not supported".format(type(sampler))
      # RandomSampler handles shuffling automatically
      if isinstance(sampler, DistributedSampler):
          # DistributedSampler shuffles data based on epoch
          sampler.set_epoch(cur_epoch)
  
      if hasattr(loader.dataset, "prefetcher"):
          sampler = loader.dataset.prefetcher.sampler
          if isinstance(sampler, DistributedSampler):
              # DistributedSampler shuffles data based on epoch
              print("prefetcher sampler")
              sampler.set_epoch(cur_epoch)
  
file_path: SlowFast/slowfast/datasets/loader.py
imports: import itertools
  import numpy
  from functools import partial
  from typing import List
  import torch
  from torch.utils.data._utils.collate import default_collate
  from torch.utils.data.distributed import DistributedSampler
  from torch.utils.data.sampler import RandomSampler, Sampler
  from slowfast.datasets.multigrid_helper import ShortCycleBatchSampler
  from .None import utils
  from .build import build_dataset
label_desc: Use image node_id 4 for calling a global function with example usage: shuffle_dataset(loader, cur_epoch) without return types