class_docstr: Sampler that restricts data loading to a subset of the dataset for distributed,
  with repeated augmentation.
  It ensures that different each augmented version of a sample will be visible to a
  different process (GPU). Heavily based on torch.utils.data.DistributedSampler
  
  This sampler was taken from https://github.com/facebookresearch/deit/blob/0c4b8f60/samplers.py
  Used in
  Copyright (c) 2015-present, Facebook, Inc.
code: def __init__(
      self,
      dataset,
      num_replicas=None,
      rank=None,
      shuffle=True,
      num_repeats=3,
      selected_round=256,
      selected_ratio=0,
  ):
      if num_replicas is None:
          if not dist.is_available():
              raise RuntimeError(
                  "Requires distributed package to be available"
              )
          num_replicas = dist.get_world_size()
      if rank is None:
          if not dist.is_available():
              raise RuntimeError(
                  "Requires distributed package to be available"
              )
          rank = dist.get_rank()
      self.dataset = dataset
      self.num_replicas = num_replicas
      self.rank = rank
      self.shuffle = shuffle
      self.num_repeats = num_repeats
      self.epoch = 0
      self.num_samples = int(
          math.ceil(len(self.dataset) * num_repeats / self.num_replicas)
      )
      self.total_size = self.num_samples * self.num_replicas
      # Determine the number of samples to select per epoch for each rank.
      # num_selected logic defaults to be the same as original RASampler impl, but this one can be tweaked
      # via selected_ratio and selected_round args.
      selected_ratio = (
          selected_ratio or num_replicas
      )  # ratio to reduce selected samples by, num_replicas if 0
      if selected_round:
          self.num_selected_samples = int(
              math.floor(
                  len(self.dataset)
                  // selected_round
                  * selected_round
                  / selected_ratio
              )
          )
      else:
          self.num_selected_samples = int(
              math.ceil(len(self.dataset) / selected_ratio)
          )
  
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 1 to create a new RepeatAugSampler object from inherited base classes: Sampler with example: obj = RepeatAugSampler(dataset, num_replicas, rank, shuffle, num_repeats, selected_round, selected_ratio)