class_docstr: The default data sampler for both distributed and non-distributed
  environment.
  
  It has several differences from the PyTorch ``DistributedSampler`` as
  below:
  
  1. This sampler supports non-distributed environment.
  
  2. The round up behaviors are a little different.
  
     - If ``round_up=True``, this sampler will add extra samples to make the
       number of samples is evenly divisible by the world size. And
       this behavior is the same as the ``DistributedSampler`` with
       ``drop_last=False``.
     - If ``round_up=False``, this sampler won't remove or add any samples
       while the ``DistributedSampler`` with ``drop_last=True`` will remove
       tail samples.
  
  Args:
      dataset (Sized): The dataset.
      dataset_ratio (Sequence(int)) The ratios of different datasets.
      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.
      round_up (bool): Whether to add extra samples to make the number of
          samples evenly divisible by the world size. Defaults to True.
class_docstr_tok: ["The","default","data","sampler","for","both","distributed","and","non-distributed","environment",".","It","has","several","differences","from","the","PyTorch","``","DistributedSampler","``","as","below",":","1",".","This","sampler","supports","non-distributed","environment",".","2",".","The","round","up","behaviors","are","a","little","different",".","-","If","``","round_up=True","``",",","this","sampler","will","add","extra","samples","to","make","the","number","of","samples","is","evenly","divisible","by","the","world","size",".","And","this","behavior","is","the","same","as","the","``","DistributedSampler","``","with","``","drop_last=False","``",".","-","If","``","round_up=False","``",",","this","sampler","wo","n't","remove","or","add","any","samples","while","the","``","DistributedSampler","``","with","``","drop_last=True","``","will","remove","tail","samples",".","Args",":","dataset","(","Sized",")",":","The","dataset",".","dataset_ratio","(","Sequence","(","int",")",")","The","ratios","of","different","datasets",".","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",".","round_up","(","bool",")",":","Whether","to","add","extra","samples","to","make","the","number","of","samples","evenly","divisible","by","the","world","size",".","Defaults","to","True","."]
docstr: Sets the epoch for this sampler.
  
  When :attr:`shuffle=True`, this ensures all replicas use a different
  random ordering for each epoch. Otherwise, the next iteration of this
  sampler will yield the same ordering.
  
  Args:
      epoch (int): Epoch number.
docstr_tok: ["Sets","the","epoch","for","this","sampler",".","When",":","attr",":","`","shuffle=True","`",",","this","ensures","all","replicas","use","a","different","random","ordering","for","each","epoch",".","Otherwise",",","the","next","iteration","of","this","sampler","will","yield","the","same","ordering",".","Args",":","epoch","(","int",")",":","Epoch","number","."]
code: def set_epoch(self, epoch: int) -> None:
      """Sets the epoch for this sampler.
  
      When :attr:`shuffle=True`, this ensures all replicas use a different
      random ordering for each epoch. Otherwise, the next iteration of this
      sampler will yield the same ordering.
  
      Args:
          epoch (int): Epoch number.
      """
      self.epoch = epoch
  
file_path: mmdetection/mmdet/datasets/samplers/multi_data_sampler.py
imports: import math
  from typing import Iterator, Optional, Sequence, Sized
  import torch
  from mmengine.dist import get_dist_info, sync_random_seed
  from mmengine.registry import DATA_SAMPLERS
  from torch.utils.data import Sampler
label_desc: Use image node_id 4 for calling the MultiDataSampler obj's underlying member method code with example usage: obj.set_epoch(epoch) without return types