class_docstr: Distributed batch sampler.
  
  Each batch is sampled as follows:
      1. Shuffle the dataset (enabled by default)
      2. Split the dataset among the replicas into chunks of equal size
         (plus or minus one sample)
      3. Each replica selects each sample of its chunk independently
         with probability `sample_rate`
      4. Each replica outputs the selected samples, which form a local batch
  
  The sum of the lengths of the local batches follows a Poisson distribution.
  In particular, the expected length of each local batch is:
  `sample_rate * total_size / num_replicas`
class_docstr_tok: ["Distributed","batch","sampler",".","Each","batch","is","sampled","as","follows",":","1",".","Shuffle","the","dataset","(","enabled","by","default",")","2",".","Split","the","dataset","among","the","replicas","into","chunks","of","equal","size","(","plus","or","minus","one","sample",")","3",".","Each","replica","selects","each","sample","of","its","chunk","independently","with","probability","`","sample_rate","`","4",".","Each","replica","outputs","the","selected","samples",",","which","form","a","local","batch","The","sum","of","the","lengths","of","the","local","batches","follows","a","Poisson","distribution",".","In","particular",",","the","expected","length","of","each","local","batch","is",":","`","sample_rate","*","total_size","\/","num_replicas","`"]
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:
      r"""
      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: opacus/opacus/utils/uniform_sampler.py
imports: from typing import List
  import torch
  from torch.utils.data import Sampler
label_desc: Use image node_id 4 for calling the DistributedUniformWithReplacementSampler obj's underlying member method code with example usage: obj.set_epoch(epoch) without return types