Spec-Zone.ru › TensorFlow 2.4

tf.keras.utils.GeneratorEnqueuer

View source on GitHub

Builds a queue out of a data generator.

Inherits From: SequenceEnqueuer

View aliases

Compat aliases for migration

See Migration guide for more details.

tf.compat.v1.keras.utils.GeneratorEnqueuer

tf.keras.utils.GeneratorEnqueuer(
    sequence, use_multiprocessing=False, random_seed=None
)

The provided generator can be finite in which case the class will throw a StopIteration exception.

Used in fit_generator, evaluate_generator, predict_generator.

Arguments
generator a generator function which yields data
use_multiprocessing use multiprocessing if True, otherwise threading
wait_time time to sleep in-between calls to put()
random_seed Initial seed for workers, will be incremented by one for each worker.

Methods

get

View source

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).

is_running

View source

is_running()

start

View source

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())

stop

View source

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()

© 2020 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r2.4/api_docs/python/tf/keras/utils/GeneratorEnqueuer

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API