code: def get_dataloader(
      dataset,
      sampler=None,
      shuffle=False,
      limit_num_samples=None,
      **kwargs,
  ):
      if limit_num_samples is not None:
          g = torch.Generator().manual_seed(limit_num_samples)
          indices = torch.randperm(len(dataset), generator=g)[
              :limit_num_samples
          ]
          dataset = Subset(dataset, indices)
  
      return idist.auto_dataloader(
          dataset,
          sampler=sampler,
          shuffle=(sampler is None) and shuffle,
          **kwargs,
      )
  
file_path: ignite/examples/references/classification/imagenet/dataflow.py
imports: from pathlib import Path
  from typing import Callable, Optional, Tuple
  import cv2
  import torch
  from torch.utils.data import DataLoader
  from torch.utils.data.dataset import Subset
  from torchvision.datasets import ImageFolder
  import ignite.distributed
  from ignite.utils import convert_tensor
label_desc: Use image node_id 2 for calling a global function with example usage: get_dataloader(dataset, sampler, shuffle, limit_num_samples) and returns: idist