Type SequenceEnqueuer
Namespace tensorflow.keras.utils
Parent PythonObjectContainer
Interfaces ISequenceEnqueuer
Base class to enqueue inputs. The task of an Enqueuer is to use parallelism to speed up preprocessing.
This is done with processes or threads. Example:
The `enqueuer.get()` should be an infinite stream of datas.
Show Example
enqueuer = SequenceEnqueuer(...) enqueuer.start() datas = enqueuer.get() for data in datas: # Use the inputs; training, evaluating, predicting. #... stop sometime. enqueuer.close()
Methods
Properties
Public instance methods
bool is_running()
object is_running_dyn()
void start(int workers, int max_queue_size)
Starts the handler's workers.
Parameters
-
int
workers - Number of workers.
-
int
max_queue_size - queue size (when full, workers could block on `put()`)
object start_dyn(ImplicitContainer<T> workers, ImplicitContainer<T> max_queue_size)
Starts the handler's workers.
Parameters
-
ImplicitContainer<T>
workers - Number of workers.
-
ImplicitContainer<T>
max_queue_size - queue size (when full, workers could block on `put()`)
void stop(object timeout)
Stops running threads and wait for them to exit, if necessary. Should be called by the same thread which called `start()`.
Parameters
-
object
timeout - maximum time to wait on `thread.join()`
object stop_dyn(object timeout)
Stops running threads and wait for them to exit, if necessary. Should be called by the same thread which called `start()`.
Parameters
-
object
timeout - maximum time to wait on `thread.join()`