Builds a queue out of a data generator.
The provided generator can be finite in which case the class will throw
generator: a generator function which yields data
use_multiprocessing: use multiprocessing if True, otherwise threading
wait_time: time to sleep in-between calls to
random_seed: Initial seed for workers, will be incremented by one for each worker.
__init__( generator, use_multiprocessing=False, wait_time=0.05, seed=None )
Initialize self. See help(type(self)) for accurate signature.
Creates a generator to extract data from the queue.
Skip the data if it is
The next element in the queue, i.e. a tuple
(inputs, targets) or
(inputs, targets, sample_weights).
start( workers=1, max_queue_size=10 )
Kicks off threads which add data from the generator into the queue.
workers: number of worker threads
max_queue_size: queue size (when full, threads could block on
Stops running threads and wait for them to exit, if necessary.
Should be called by the same thread which called
timeout: maximum time to wait on