class_docstr: This sampler samples elements according to the Sampled Gaussian Mechanism.
  Each sample is selected with a probability equal to ``sample_rate``.
  The sampler generates ``steps`` number of batches, that defaults to 1/``sample_rate``.
class_docstr_tok: ["This","sampler","samples","elements","according","to","the","Sampled","Gaussian","Mechanism",".","Each","sample","is","selected","with","a","probability","equal","to","``","sample_rate","``",".","The","sampler","generates","``","steps","``","number","of","batches",",","that","defaults","to","1\/","``","sample_rate","``","."]
docstr: Args:
      num_samples: number of samples to draw.
      sample_rate: probability used in sampling.
      generator: Generator used in sampling.
      steps: Number of steps (iterations of the Sampler)
docstr_tok: ["Args",":","num_samples",":","number","of","samples","to","draw",".","sample_rate",":","probability","used","in","sampling",".","generator",":","Generator","used","in","sampling",".","steps",":","Number","of","steps","(","iterations","of","the","Sampler",")"]
code: def __init__(
      self,
      *,
      num_samples: int,
      sample_rate: float,
      generator=None,
      steps=None,
  ):
      r"""
      Args:
          num_samples: number of samples to draw.
          sample_rate: probability used in sampling.
          generator: Generator used in sampling.
          steps: Number of steps (iterations of the Sampler)
      """
      self.num_samples = num_samples
      self.sample_rate = sample_rate
      self.generator = generator
  
      if self.num_samples <= 0:
          raise ValueError(
              "num_samples should be a positive integer "
              "value, but got num_samples={}".format(self.num_samples)
          )
  
      if steps is not None:
          self.steps = steps
      else:
          self.steps = int(1 / self.sample_rate)
  
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 1 to create a new UniformWithReplacementSampler object from inherited base classes: Sampler with example: obj = UniformWithReplacementSampler()