class_docstr: Sampler that restricts data loading to a subset of the dataset.
  It is especially useful in conjunction with
  :class:`torch.nn.parallel.DistributedDataParallel`. In such case, each
  process can pass a DistributedSampler instance as a DataLoader sampler,
  and load a subset of the original dataset that is exclusive to it.
  .. note::
      Dataset is assumed to be of constant size.
  Arguments:
      dataset: Dataset used for sampling.
      num_replicas (optional): Number of processes participating in
          distributed training.
      rank (optional): Rank of the current process within num_replicas.
code: def __iter__(self):
      indices = list(range(len(self.dataset)))
  
      # add extra samples to make it evenly divisible
      indices += indices[: (self.total_size - len(indices))]
      assert len(indices) == self.total_size
  
      # subsample
      indices = indices[self.rank : self.total_size : self.num_replicas]
      assert len(indices) == self.num_samples
  
      return iter(indices)
  
file_path: pytorch-image-models/timm/data/distributed_sampler.py
imports: import math
  import torch
  from torch.utils.data import Sampler
  import torch.distributed
label_desc: Use image node_id 2 for calling the OrderedDistributedSampler obj's underlying member method code with example usage: obj.__iter__() and returns: iter