class_docstr: A modification of RandomSampler which always returns the same values.
  
  Also look at `torch.utils.data.RandomSampler`. This has mostly
  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
  ---------
  data_source : Dataset
      The data source to sample indices for.
  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
  -------
  >>> import torch
  >>> from speechbrain.utils.checkpoints import Checkpointer
  >>> from speechbrain.dataio.dataloader import SaveableDataLoader
  >>> # An example "dataset"
  >>> dataset = torch.arange(10).unsqueeze(1)
  >>> # Create the random sampler:
  >>> sampler = ReproducibleRandomSampler(dataset)
  >>> dataloader = SaveableDataLoader(dataset, sampler = sampler,
  ...     num_workers = 3)
  >>> # Setup the checkpointer.
  >>> # Note that the sampler doesn't need to be saved itself.
  >>> tmpdir = getfixture('tmpdir')
  >>> checkpointer = Checkpointer(tmpdir, {"dataloader": dataloader})
  >>> # Iterate:
  >>> subset = []
  >>> for i, data_point in enumerate(dataloader):
  ...     # Say you save a checkpoint on the fourth batch:
  ...     if i == 3:
  ...         _ = checkpointer.save_checkpoint(end_of_epoch = False)
  ...     # So let's save the numbers you would get if you continue
  ...     if i >= 4:
  ...         subset.append(data_point.item())
  >>> # What if instead you had to restart the experiment?
  >>> new_sampler = ReproducibleRandomSampler(dataset)
  >>> new_dataloader = SaveableDataLoader(dataset, sampler = new_sampler,
  ...        num_workers = 3)
  >>> new_checkpointer = Checkpointer(tmpdir, {"dataloader": new_dataloader})
  >>> _ = new_checkpointer.recover_if_possible()
  >>> # You'll get the same random order again:
  >>> new_subset = [data_point.item() for data_point in new_dataloader]
  >>> assert subset == new_subset
class_docstr_tok: ["A","modification","of","RandomSampler","which","always","returns","the","same","values",".","Also","look","at","`","torch.utils.data.RandomSampler","`",".","This","has","mostly","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","--","--","--","--","-","data_source",":","Dataset","The","data","source","to","sample","indices","for",".","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","--","--","--","-",">",">",">","import","torch",">",">",">","from","speechbrain.utils.checkpoints","import","Checkpointer",">",">",">","from","speechbrain.dataio.dataloader","import","SaveableDataLoader",">",">",">","#","An","example","``","dataset","''",">",">",">","dataset","=","torch.arange","(","10",")",".unsqueeze","(","1",")",">",">",">","#","Create","the","random","sampler",":",">",">",">","sampler","=","ReproducibleRandomSampler","(","dataset",")",">",">",">","dataloader","=","SaveableDataLoader","(","dataset",",","sampler","=","sampler",",","...","num_workers","=","3",")",">",">",">","#","Setup","the","checkpointer",".",">",">",">","#","Note","that","the","sampler","does","n't","need","to","be","saved","itself",".",">",">",">","tmpdir","=","getfixture","(","'tmpdir","'",")",">",">",">","checkpointer","=","Checkpointer","(","tmpdir",",","{","``","dataloader","''",":","dataloader","}",")",">",">",">","#","Iterate",":",">",">",">","subset","=","[","]",">",">",">","for","i",",","data_point","in","enumerate","(","dataloader",")",":","...","#","Say","you","save","a","checkpoint","on","the","fourth","batch",":","...","if","i","==","3",":","...","_","=","checkpointer.save_checkpoint","(","end_of_epoch","=","False",")","...","#","So","let","'s","save","the","numbers","you","would","get","if","you","continue","...","if","i",">","=","4",":","...","subset.append","(","data_point.item","(",")",")",">",">",">","#","What","if","instead","you","had","to","restart","the","experiment","?",">",">",">","new_sampler","=","ReproducibleRandomSampler","(","dataset",")",">",">",">","new_dataloader","=","SaveableDataLoader","(","dataset",",","sampler","=","new_sampler",",","...","num_workers","=","3",")",">",">",">","new_checkpointer","=","Checkpointer","(","tmpdir",",","{","``","dataloader","''",":","new_dataloader","}",")",">",">",">","_","=","new_checkpointer.recover_if_possible","(",")",">",">",">","#","You","'ll","get","the","same","random","order","again",":",">",">",">","new_subset","=","[","data_point.item","(",")","for","data_point","in","new_dataloader","]",">",">",">","assert","subset","==","new_subset"]
code: def __iter__(self):
      self.generator.manual_seed(self.seed + self.epoch)
      return super().__iter__()
  
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 3 for calling the ReproducibleRandomSampler obj's underlying member method code with example usage: obj.__iter__() and returns: super