code: def with_sampler(self, loader, shuffle=True):
      self.logger.debug("Wrapping DistributedSampler on DataLoader")
      data_loader_args = {
          "dataset": loader.dataset,
          "batch_size": loader.batch_size,
          "shuffle": False,
          "num_workers": loader.num_workers,
          "collate_fn": loader.collate_fn,
          "pin_memory": loader.pin_memory,
          "drop_last": loader.drop_last,
          "timeout": loader.timeout,
          "worker_init_fn": loader.worker_init_fn,
          "sampler": DistributedSampler(
              loader.dataset,
              num_replicas=self.size,
              rank=self.rank,
              shuffle=shuffle,
          ),
      }
      return DataLoader(**data_loader_args)
  
file_path: BigDL/python/orca/src/bigdl/orca/learn/pytorch/core/lifecycle.py
imports: from abc import abstractmethod, ABCMeta
  from torch.utils.data import DataLoader
  from torch.utils.data.distributed import DistributedSampler
label_desc: Use image node_id 8 for calling the LifeCycle obj's underlying member method code with example usage: obj.with_sampler(loader, shuffle) and returns: DataLoader