class_docstr: DataLoader that support random transform function applied to dataset.
  
  Parameters
  ----------
  transform_fns : iterable of callables
      Transform functions that takes a sample as input and returns the transformed sample.
      They will be randomly selected during the dataloader iteration.
  dataset : mxnet.gluon.data.Dataset or numpy.ndarray or mxnet.ndarray.NDArray
      The source dataset. Original dataset is recommended here since we will apply transform
      function from candidates again during the iteration.
  interval : int, default is 1
      For every `interval` batches, transform function is randomly selected from candidates.
  batch_size : int
      The size of mini-batch.
  shuffle : bool, default False
      If or not randomly shuffle the samples. Often use True for training
      dataset and False for validation/test datasets
  sampler : mxnet.gluon.data.Sampler, default None
      The sampler to use. We should either specify a sampler or enable
      shuffle, not both, because random shuffling is a sampling method.
  last_batch : {'keep', 'discard', 'rollover'}, default is keep
      How to handle the last batch if the batch size does not evenly divide by
      the number of examples in the dataset. There are three options to deal
      with the last batch if its size is smaller than the specified batch
      size.
  
      - keep: keep it
      - discard: throw it away
      - rollover: insert the examples to the beginning of the next batch
  batch_sampler : mxnet.gluon.data.BatchSampler
      A sampler that returns mini-batches. Do not specify batch_size,
      shuffle, sampler, and last_batch if batch_sampler is specified.
  batchify_fn : callable
      Callback function to allow users to specify how to merge samples
      into a batch.
      Defaults to :py:meth:`gluoncv.data.dataloader.default_pad_batchify_fn`::
          def default_pad_batchify_fn(data):
              if isinstance(data[0], nd.NDArray):
                  return nd.stack(*data)
              elif isinstance(data[0], tuple):
                  data = zip(*data)
                  return [pad_batchify(i) for i in data]
              else:
                  data = np.asarray(data)
                  pad = max([l.shape[0] for l in data])
                  buf = np.full((len(data), pad, data[0].shape[-1]),
                                -1, dtype=data[0].dtype)
                  for i, l in enumerate(data):
                      buf[i][:l.shape[0], :] = l
                  return nd.array(buf, dtype=data[0].dtype)
  num_workers : int, default 0
      The number of multiprocessing workers to use for data preprocessing.
      If ``num_workers`` = 0, multiprocessing is disabled.
      Otherwise ``num_workers`` multiprocessing worker is used to process data.
  pin_memory : boolean, default False
      If ``True``, the dataloader will copy NDArrays into pinned memory
      before returning them. Copying from CPU pinned memory to GPU is faster
      than from normal CPU memory.
  pin_device_id : int, default 0
      The device id to use for allocating pinned memory if pin_memory is ``True``
  prefetch : int, default is `num_workers * 2`
      The number of prefetching batches only works if `num_workers` > 0.
      If `prefetch` > 0, it allow worker process to prefetch certain batches before
      acquiring data from iterators.
      Note that using large prefetching batch will provide smoother bootstrapping performance,
      but will consume more shared_memory. Using smaller number may forfeit the purpose of using
      multiple worker processes, try reduce `num_workers` in this case.
      By default it defaults to `num_workers * 2`.
class_docstr_tok: ["DataLoader","that","support","random","transform","function","applied","to","dataset",".","Parameters","--","--","--","--","--","transform_fns",":","iterable","of","callables","Transform","functions","that","takes","a","sample","as","input","and","returns","the","transformed","sample",".","They","will","be","randomly","selected","during","the","dataloader","iteration",".","dataset",":","mxnet.gluon.data.Dataset","or","numpy.ndarray","or","mxnet.ndarray.NDArray","The","source","dataset",".","Original","dataset","is","recommended","here","since","we","will","apply","transform","function","from","candidates","again","during","the","iteration",".","interval",":","int",",","default","is","1","For","every","`","interval","`","batches",",","transform","function","is","randomly","selected","from","candidates",".","batch_size",":","int","The","size","of","mini-batch",".","shuffle",":","bool",",","default","False","If","or","not","randomly","shuffle","the","samples",".","Often","use","True","for","training","dataset","and","False","for","validation\/test","datasets","sampler",":","mxnet.gluon.data.Sampler",",","default","None","The","sampler","to","use",".","We","should","either","specify","a","sampler","or","enable","shuffle",",","not","both",",","because","random","shuffling","is","a","sampling","method",".","last_batch",":","{","'keep","'",",","'discard","'",",","'rollover","'","}",",","default","is","keep","How","to","handle","the","last","batch","if","the","batch","size","does","not","evenly","divide","by","the","number","of","examples","in","the","dataset",".","There","are","three","options","to","deal","with","the","last","batch","if","its","size","is","smaller","than","the","specified","batch","size",".","-","keep",":","keep","it","-","discard",":","throw","it","away","-","rollover",":","insert","the","examples","to","the","beginning","of","the","next","batch","batch_sampler",":","mxnet.gluon.data.BatchSampler","A","sampler","that","returns","mini-batches",".","Do","not","specify","batch_size",",","shuffle",",","sampler",",","and","last_batch","if","batch_sampler","is","specified",".","batchify_fn",":","callable","Callback","function","to","allow","users","to","specify","how","to","merge","samples","into","a","batch",".","Defaults","to",":","py",":","meth",":","`","gluoncv.data.dataloader.default_pad_batchify_fn","`",":",":","def","default_pad_batchify_fn","(","data",")",":","if","isinstance","(","data","[","0","]",",","nd.NDArray",")",":","return","nd.stack","(","*","data",")","elif","isinstance","(","data","[","0","]",",","tuple",")",":","data","=","zip","(","*","data",")","return","[","pad_batchify","(","i",")","for","i","in","data","]","else",":","data","=","np.asarray","(","data",")","pad","=","max","(","[","l.shape","[","0","]","for","l","in","data","]",")","buf","=","np.full","(","(","len","(","data",")",",","pad",",","data","[","0","]",".shape","[","-1","]",")",",","-1",",","dtype=data","[","0","]",".dtype",")","for","i",",","l","in","enumerate","(","data",")",":","buf","[","i","]","[",":","l.shape","[","0","]",",",":","]","=","l","return","nd.array","(","buf",",","dtype=data","[","0","]",".dtype",")","num_workers",":","int",",","default","0","The","number","of","multiprocessing","workers","to","use","for","data","preprocessing",".","If","``","num_workers","``","=","0",",","multiprocessing","is","disabled",".","Otherwise","``","num_workers","``","multiprocessing","worker","is","used","to","process","data",".","pin_memory",":","boolean",",","default","False","If","``","True","``",",","the","dataloader","will","copy","NDArrays","into","pinned","memory","before","returning","them",".","Copying","from","CPU","pinned","memory","to","GPU","is","faster","than","from","normal","CPU","memory",".","pin_device_id",":","int",",","default","0","The","device","id","to","use","for","allocating","pinned","memory","if","pin_memory","is","``","True","``","prefetch",":","int",",","default","is","`","num_workers","*","2","`","The","number","of","prefetching","batches","only","works","if","`","num_workers","`",">","0",".","If","`","prefetch","`",">","0",",","it","allow","worker","process","to","prefetch","certain","batches","before","acquiring","data","from","iterators",".","Note","that","using","large","prefetching","batch","will","provide","smoother","bootstrapping","performance",",","but","will","consume","more","shared_memory",".","Using","smaller","number","may","forfeit","the","purpose","of","using","multiple","worker","processes",",","try","reduce","`","num_workers","`","in","this","case",".","By","default","it","defaults","to","`","num_workers","*","2","`","."]
code: def __del__(self):
      if self._worker_pool:
          # manually terminate due to a bug that pool is not automatically terminated
          assert isinstance(
              self._worker_pool, multiprocessing.pool.Pool
          )
          self._worker_pool.terminate()
  
imports: import io
  import pickle
  import multiprocessing
  from multiprocessing.reduction import ForkingPickler
  import numpy
  from mxnet import nd
  from mxnet import context
  from mxnet.gluon.data.dataloader import DataLoader, _MultiWorkerIter
  from mxnet.gluon.data.dataloader import default_mp_batchify_fn, default_batchify_fn
label_desc: Use image node_id 3 for calling the RandomTransformDataLoader obj's underlying member method code with example usage: obj.__del__() without return types