class_docstr: Sampler that restricts data loading to the label of the dataset.
  
  A class-aware sampling strategy to effectively tackle the
  non-uniform class distribution. The length of the training data is
  consistent with source data. Simple improvements based on `Relay
  Backpropagation for Effective Learning of Deep Convolutional
  Neural Networks <https://arxiv.org/abs/1512.05830>`_
  
  The implementation logic is referred to
  https://github.com/Sense-X/TSD/blob/master/mmdet/datasets/samplers/distributed_classaware_sampler.py
  
  Args:
      dataset: Dataset used for sampling.
      seed (int, optional): random seed used to shuffle the sampler.
          This number should be identical across all
          processes in the distributed group. Defaults to None.
      num_sample_class (int): The number of samples taken from each
          per-label list. Defaults to 1.
class_docstr_tok: ["Sampler","that","restricts","data","loading","to","the","label","of","the","dataset",".","A","class-aware","sampling","strategy","to","effectively","tackle","the","non-uniform","class","distribution",".","The","length","of","the","training","data","is","consistent","with","source","data",".","Simple","improvements","based","on","`","Relay","Backpropagation","for","Effective","Learning","of","Deep","Convolutional","Neural","Networks","<","https",":","\/\/arxiv.org\/abs\/1512.05830",">","`","_","The","implementation","logic","is","referred","to","https",":","\/\/github.com\/Sense-X\/TSD\/blob\/master\/mmdet\/datasets\/samplers\/distributed_classaware_sampler.py","Args",":","dataset",":","Dataset","used","for","sampling",".","seed","(","int",",","optional",")",":","random","seed","used","to","shuffle","the","sampler",".","This","number","should","be","identical","across","all","processes","in","the","distributed","group",".","Defaults","to","None",".","num_sample_class","(","int",")",":","The","number","of","samples","taken","from","each","per-label","list",".","Defaults","to","1","."]
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/class_aware_sampler.py
imports: import math
  from typing import Dict, Iterator, Optional, Union
  import numpy
  import torch
  from mmengine.dataset import BaseDataset
  from mmengine.dist import get_dist_info, sync_random_seed
  from torch.utils.data import Sampler
  from mmdet.registry import DATA_SAMPLERS
label_desc: Use image node_id 5 for calling the ClassAwareSampler obj's underlying member method code with example usage: obj.set_epoch(epoch) without return types