class_docstr: This wrapper allows using any sampler (for example batch) with Distributed Data Parallel (DDP)
  correctly.
  
  Passing blindly the sampler to each DDP process will cause to have access
  within each process to all the data in the dataset instead of only a subset
  of it which is unique to each process.  This wrapper prevents this and
  allows to use only a subset of the original data for each process.
  
  NOTE
  ----
  This is is automatically applied to any sampler in the Brain class when DDP
  training is used.
class_docstr_tok: ["This","wrapper","allows","using","any","sampler","(","for","example","batch",")","with","Distributed","Data","Parallel","(","DDP",")","correctly",".","Passing","blindly","the","sampler","to","each","DDP","process","will","cause","to","have","access","within","each","process","to","all","the","data","in","the","dataset","instead","of","only","a","subset","of","it","which","is","unique","to","each","process",".","This","wrapper","prevents","this","and","allows","to","use","only","a","subset","of","the","original","data","for","each","process",".","NOTE","--","--","This","is","is","automatically","applied","to","any","sampler","in","the","Brain","class","when","DDP","training","is","used","."]
code: def __iter__(self):
      # It is easiest to use a random access interface to the wrapped
      # sampler's indices, so we just fetch all indices from the wrapped
      # sampler
      sampler_indices = list(self.sampler.__iter__())
      indices_of_indices = super().__iter__()
      # Itemgetter fetches the wrapped sampler indices from the positions
      # pointed to by DistributedSampler
      return iter(itemgetter(*indices_of_indices)(sampler_indices))
  
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 DistributedSamplerWrapper obj's underlying member method code with example usage: obj.__iter__() and returns: iter