class_docstr: A reproducible modification of WeightedRandomSampler.
  
  Also look at `torch.utils.data.WeightedRandomSampler`. This has the
  the same behaviour and arguments, except for adding 'seed' and 'epoch' and
  not supporting 'generator'.
  
  Note
  ----
  Call `set_epoch` before every epoch. Otherwise, the sampler will produce the
  same sequence of indices every epoch.
  
  Arguments
  ---------
  weights : sequence of float
      Weights for each index. Doesn't need to sum to one.
  num_samples : int
      Number of samples to draw
  replacement : bool
      To draw with replacement or not (within an epoch of num_samples).
  seed : int
      The base seed to use for the random number generator. It is recommended
      to use a value which has a good mix of 0 and 1 bits.
  epoch : int
      The epoch to start at.
  
  Example
  -------
  >>> a = ReproducibleWeightedRandomSampler([0.1, 0.9, 0.4, 0.7, 3.0, 0.6], 5, replacement=True)
  >>> b = ReproducibleWeightedRandomSampler([0.1, 0.9, 0.4, 0.7, 3.0, 0.6], 5, replacement=True)
  >>> list(a)
  [3, 1, 4, 4, 4]
  >>> list(b)
  [3, 1, 4, 4, 4]
  >>> a.set_epoch(1)
  >>> list(a)
  [4, 5, 4, 4, 3]
  >>> b.set_epoch(1)
  >>> list(b)
  [4, 5, 4, 4, 3]
class_docstr_tok: ["A","reproducible","modification","of","WeightedRandomSampler",".","Also","look","at","`","torch.utils.data.WeightedRandomSampler","`",".","This","has","the","the","same","behaviour","and","arguments",",","except","for","adding","'seed","'","and","'epoch","'","and","not","supporting","'generator","'",".","Note","--","--","Call","`","set_epoch","`","before","every","epoch",".","Otherwise",",","the","sampler","will","produce","the","same","sequence","of","indices","every","epoch",".","Arguments","--","--","--","--","-","weights",":","sequence","of","float","Weights","for","each","index",".","Does","n't","need","to","sum","to","one",".","num_samples",":","int","Number","of","samples","to","draw","replacement",":","bool","To","draw","with","replacement","or","not","(","within","an","epoch","of","num_samples",")",".","seed",":","int","The","base","seed","to","use","for","the","random","number","generator",".","It","is","recommended","to","use","a","value","which","has","a","good","mix","of","0","and","1","bits",".","epoch",":","int","The","epoch","to","start","at",".","Example","--","--","--","-",">",">",">","a","=","ReproducibleWeightedRandomSampler","(","[","0.1",",","0.9",",","0.4",",","0.7",",","3.0",",","0.6","]",",","5",",","replacement=True",")",">",">",">","b","=","ReproducibleWeightedRandomSampler","(","[","0.1",",","0.9",",","0.4",",","0.7",",","3.0",",","0.6","]",",","5",",","replacement=True",")",">",">",">","list","(","a",")","[","3",",","1",",","4",",","4",",","4","]",">",">",">","list","(","b",")","[","3",",","1",",","4",",","4",",","4","]",">",">",">","a.set_epoch","(","1",")",">",">",">","list","(","a",")","[","4",",","5",",","4",",","4",",","3","]",">",">",">","b.set_epoch","(","1",")",">",">",">","list","(","b",")","[","4",",","5",",","4",",","4",",","3","]"]
docstr: You can also just access self.epoch, but we maintain this interface
  to mirror torch.utils.data.distributed.DistributedSampler
docstr_tok: ["You","can","also","just","access","self.epoch",",","but","we","maintain","this","interface","to","mirror","torch.utils.data.distributed.DistributedSampler"]
code: def set_epoch(self, epoch):
      """
      You can also just access self.epoch, but we maintain this interface
      to mirror torch.utils.data.distributed.DistributedSampler
      """
      self.epoch = epoch
  
imports: import torch
  import logging
  from operator import itemgetter
  from torch.utils.data import RandomSampler, WeightedRandomSampler, DistributedSampler, Sampler
  import numpy
  from typing import List
  from speechbrain.dataio.dataset import DynamicItemDataset
  from collections import Counter
  from scipy.stats import lognorm
label_desc: Use image node_id 2 for calling the ReproducibleWeightedRandomSampler obj's underlying member method code with example usage: obj.set_epoch(epoch) without return types