'Args:
ds (DataFlow): input DataFlow.
nr_prefetch (int): size of the queue to hold prefetched datapoints.
nr_proc (int): number of processes to use.'

def __init__(self, ds, nr_prefetch, nr_proc):

    super(PrefetchData, self).__init__(ds)
    try:
        self._size = ds.size()
    except NotImplementedError:
        self._size = (-1)
    self.nr_proc = nr_proc
    self.nr_prefetch = nr_prefetch
    self._guard = DataFlowReentrantGuard()
    self.queue = mp.Queue(self.nr_prefetch)
    self.procs = [PrefetchProcess(self.ds, self.queue) for _ in range(self.nr_proc)]
    ensure_proc_terminate(self.procs)
    start_proc_mask_signal(self.procs)
