class_docstr: Samples elements more than once in a single pass through the data.
  
  This allows the number of samples per epoch to be larger than the number
  of samples itself, which can be useful when training on 2D slices taken
  from 3D images, for instance.
class_docstr_tok: ["Samples","elements","more","than","once","in","a","single","pass","through","the","data",".","This","allows","the","number","of","samples","per","epoch","to","be","larger","than","the","number","of","samples","itself",",","which","can","be","useful","when","training","on","2D","slices","taken","from","3D","images",",","for","instance","."]
docstr: Initialize MultiSampler
  
  :param data_source: (dataset):
      the dataset to sample from
  :param desired_samples: (int):
      number of samples per batch you want.
      Whatever the difference is between an even division will
      be randomly selected from the samples.
      e.g. if len(data_source) = 3 and desired_samples = 4, then
      all 3 samples will be included and the last sample will be
      randomly chosen from the 3 original samples.
  :param shuffle: (bool):
      whether to shuffle the indices or not
  
  Example:
      >>> m = MultiSampler(2, 6)
      >>> x = m.gen_sample_array()
      >>> print(x) # [0,1,0,1,0,1]
docstr_tok: ["Initialize","MultiSampler",":","param","data_source",":","(","dataset",")",":","the","dataset","to","sample","from",":","param","desired_samples",":","(","int",")",":","number","of","samples","per","batch","you","want",".","Whatever","the","difference","is","between","an","even","division","will","be","randomly","selected","from","the","samples",".","e.g",".","if","len","(","data_source",")","=","3","and","desired_samples","=","4",",","then","all","3","samples","will","be","included","and","the","last","sample","will","be","randomly","chosen","from","the","3","original","samples",".",":","param","shuffle",":","(","bool",")",":","whether","to","shuffle","the","indices","or","not","Example",":",">",">",">","m","=","MultiSampler","(","2",",","6",")",">",">",">","x","=","m.gen_sample_array","(",")",">",">",">","print","(","x",")","#","[","0,1,0,1,0,1","]"]
code: def __init__(self, nb_samples, desired_samples, shuffle=False):
      """Initialize MultiSampler
  
      :param data_source: (dataset):
          the dataset to sample from
      :param desired_samples: (int):
          number of samples per batch you want.
          Whatever the difference is between an even division will
          be randomly selected from the samples.
          e.g. if len(data_source) = 3 and desired_samples = 4, then
          all 3 samples will be included and the last sample will be
          randomly chosen from the 3 original samples.
      :param shuffle: (bool):
          whether to shuffle the indices or not
  
      Example:
          >>> m = MultiSampler(2, 6)
          >>> x = m.gen_sample_array()
          >>> print(x) # [0,1,0,1,0,1]
      """
      self.data_samples = nb_samples
      self.desired_samples = desired_samples
      self.shuffle = shuffle
  
imports: import math
  from .utils import th_random_choice
  import torch.utils.data
  import torchvision
  from .datasets import FolderDataset, MultiFolderDataset, PredictFolderDataset, ClonedFolderDataset
  from torch.utils.data.sampler import Sampler
label_desc: Use image node_id 1 to create a new MultiSampler object from inherited base classes: Sampler with example: obj = MultiSampler(nb_samples, desired_samples, shuffle)