tf.keras.utils.OrderedEnqueuer

Class OrderedEnqueuer

Inherits From: SequenceEnqueuer

Defined in tensorflow/python/keras/utils/data_utils.py.

Builds a Enqueuer from a Sequence.

Used in fit_generator, evaluate_generator, predict_generator.

Arguments:

  • sequence: A tf.keras.utils.data_utils.Sequence object.
  • use_multiprocessing: use multiprocessing if True, otherwise threading
  • shuffle: whether to shuffle the data at the beginning of each epoch

__init__

__init__(
    sequence,
    use_multiprocessing=False,
    shuffle=False
)

Initialize self. See help(type(self)) for accurate signature.

Methods

tf.keras.utils.OrderedEnqueuer.get

get()

Creates a generator to extract data from the queue.

Skip the data if it is None.

Yields:

The next element in the queue, i.e. a tuple (inputs, targets) or (inputs, targets, sample_weights).

tf.keras.utils.OrderedEnqueuer.is_running

is_running()

tf.keras.utils.OrderedEnqueuer.start

start(
    workers=1,
    max_queue_size=10
)

Starts the handler's workers.

Arguments:

  • workers: Number of workers.
  • max_queue_size: queue size (when full, workers could block on put())

tf.keras.utils.OrderedEnqueuer.stop

stop(timeout=None)

Stops running threads and wait for them to exit, if necessary.

Should be called by the same thread which called start().

Arguments:

  • timeout: maximum time to wait on thread.join()