|View source on GitHub|
A queue runner that allows the feeding of values such as numpy arrays.
__init__( queue=None, enqueue_ops=None, close_op=None, cancel_op=None, feed_fns=None, queue_closed_exception_types=None )
Initialize the queue runner.
For further documentation, see
queue_runner.py. Note that
FeedingQueueRunner does not support construction from protobuffer nor
serialization to protobuffer.
enqueue_ops: List of enqueue ops to run in threads later.
close_op: Op to close the queue. Pending enqueue ops are preserved.
cancel_op: Op to close the queue and cancel pending enqueue ops.
feed_fns: a list of functions that return a dictionary mapping fed
Tensors to values. Must be the same length as
queue_closed_exception_types: Optional tuple of Exception types that indicate that the queue has been closed when raised during an enqueue operation. Defaults to
Noneand has different length than
Exceptions raised but not handled by the
Exceptions raised in queue runner threads are handled in one of two ways
depending on whether or not a
Coordinator was passed to
- With a
Coordinator, exceptions are reported to the coordinator and forgotten by the
- Without a
Coordinator, exceptions are captured by the
QueueRunnerand made available in this
A list of Python
Exception objects. The list is empty if no exception
was captured. (No exceptions are captured when using a Coordinator.)
The string name of the underlying Queue.
create_threads( sess, coord=None, daemon=False, start=False )
Create threads to run the enqueue ops for the given session.
This method requires a session in which the graph was launched. It creates
a list of threads, optionally starting them. There is one thread for each
op passed in
coord argument is an optional coordinator, that the threads will use
to terminate together and report exceptions. If a coordinator is given,
this method starts an additional thread to close the queue when the
coordinator requests a stop.
If previously created threads for the given session are still running, no new threads will be created.
Coordinatorobject for reporting errors and checking stop conditions.
daemon: Boolean. If
Truemake the threads daemon threads.
start: Boolean. If
Truestarts the threads. If
Falsethe caller must call the
start()method of the returned threads.
A list of threads.
from_proto( queue_runner_def, import_scope=None )
QueueRunner object created from