class_docstr: Sampler that repeats the same data elements for num_repeats times. The
  batch size should be divisible by num_repeats.
  
  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 modified from
  https://github.com/facebookresearch/deit/blob/0c4b8f60/samplers.py
  Used in
  Copyright (c) 2015-present, Facebook, Inc.
  
  Args:
      dataset (Sized): The dataset.
      shuffle (bool): Whether shuffle the dataset or not. Defaults to True.
      num_repeats (int): The repeat times of every sample. Defaults to 3.
      seed (int, optional): Random seed used to shuffle the sampler if
          :attr:`shuffle=True`. This number should be identical across all
          processes in the distributed group. Defaults to None.
class_docstr_tok: ["Sampler","that","repeats","the","same","data","elements","for","num_repeats","times",".","The","batch","size","should","be","divisible","by","num_repeats",".","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","modified","from","https",":","\/\/github.com\/facebookresearch\/deit\/blob\/0c4b8f60\/samplers.py","Used","in","Copyright","(","c",")","2015-present",",","Facebook",",","Inc.","Args",":","dataset","(","Sized",")",":","The","dataset",".","shuffle","(","bool",")",":","Whether","shuffle","the","dataset","or","not",".","Defaults","to","True",".","num_repeats","(","int",")",":","The","repeat","times","of","every","sample",".","Defaults","to","3.","seed","(","int",",","optional",")",":","Random","seed","used","to","shuffle","the","sampler","if",":","attr",":","`","shuffle=True","`",".","This","number","should","be","identical","across","all","processes","in","the","distributed","group",".","Defaults","to","None","."]
code: def __init__(
      self,
      dataset: Sized,
      shuffle: bool = True,
      num_repeats: int = 3,
      seed: Optional[int] = None,
  ):
      rank, world_size = get_dist_info()
      self.rank = rank
      self.world_size = world_size
  
      self.dataset = dataset
      self.shuffle = shuffle
  
      if seed is None:
          seed = sync_random_seed()
      self.seed = seed
      self.epoch = 0
      self.num_repeats = num_repeats
  
      # The number of repeated samples in the rank
      self.num_samples = math.ceil(
          len(self.dataset) * num_repeats / world_size
      )
      # The total number of repeated samples in all ranks.
      self.total_size = self.num_samples * world_size
      # The number of selected samples in the rank
      self.num_selected_samples = math.ceil(
          len(self.dataset) / world_size
      )
  
file_path: mmocr/mmocr/datasets/samplers/batch_aug.py
imports: import math
  from typing import Iterator, Optional, Sized
  import torch
  from mmengine.dist import get_dist_info, sync_random_seed
  from torch.utils.data import Sampler
  from mmocr.registry import DATA_SAMPLERS
label_desc: Use image node_id 1 to create a new BatchAugSampler object from inherited base classes: Sampler with example: obj = BatchAugSampler(dataset, shuffle, num_repeats, seed)