tf.contrib.training.FeedingQueueRunner
Stay organized with collections
Save and categorize content based on your preferences.
A queue runner that allows the feeding of values such as numpy arrays.
Inherits From: QueueRunner
tf.contrib.training.FeedingQueueRunner(
queue=None, enqueue_ops=None, close_op=None, cancel_op=None, feed_fns=None,
queue_closed_exception_types=None
)
Args |
queue
|
A Queue .
|
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
Tensor s to values. Must be the same length as enqueue_ops .
|
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
(tf.errors.OutOfRangeError, tf.errors.CancelledError) .
|
Raises |
ValueError
|
feed_fns is not None and has different length than
enqueue_ops .
|
Attributes |
cancel_op
|
|
close_op
|
|
enqueue_ops
|
|
exceptions_raised
|
Exceptions raised but not handled by the QueueRunner threads.
Exceptions raised in queue runner threads are handled in one of two ways
depending on whether or not a Coordinator was passed to
create_threads() :
- With a
Coordinator , exceptions are reported to the coordinator and
forgotten by the QueueRunner .
- Without a
Coordinator , exceptions are captured by the QueueRunner and
made available in this exceptions_raised property.
|
name
|
The string name of the underlying Queue.
|
queue
|
|
queue_closed_exception_types
|
|
Methods
create_threads
View source
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 enqueue_ops
.
The 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.
Args |
sess
|
A Session .
|
coord
|
Optional Coordinator object for reporting errors and checking
stop conditions.
|
daemon
|
Boolean. If True make the threads daemon threads.
|
start
|
Boolean. If True starts the threads. If False the
caller must call the start() method of the returned threads.
|
Returns |
A list of threads.
|
from_proto
View source
@staticmethod
from_proto(
queue_runner_def, import_scope=None
)
Returns a QueueRunner
object created from queue_runner_def
.
to_proto
View source
to_proto()
Converts this QueueRunner
to a QueueRunnerDef
protocol buffer.
Args |
export_scope
|
Optional string . Name scope to remove.
|
Returns |
A QueueRunnerDef protocol buffer, or None if the Variable is not in
the specified name scope.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2020-10-01 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2020-10-01 UTC."],[],[],null,["# tf.contrib.training.FeedingQueueRunner\n\n\u003cbr /\u003e\n\n|----------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/estimator/tree/master/tensorflow_estimator/python/estimator/inputs/queues/feeding_queue_runner.py) |\n\nA queue runner that allows the feeding of values such as numpy arrays.\n\nInherits From: [`QueueRunner`](../../../tf/train/queue_runner/QueueRunner) \n\n tf.contrib.training.FeedingQueueRunner(\n queue=None, enqueue_ops=None, close_op=None, cancel_op=None, feed_fns=None,\n queue_closed_exception_types=None\n )\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|--------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `queue` | A `Queue`. |\n| `enqueue_ops` | List of enqueue ops to run in threads later. |\n| `close_op` | Op to close the queue. Pending enqueue ops are preserved. |\n| `cancel_op` | Op to close the queue and cancel pending enqueue ops. |\n| `feed_fns` | a list of functions that return a dictionary mapping fed `Tensor`s to values. Must be the same length as `enqueue_ops`. |\n| `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 `(tf.errors.OutOfRangeError, tf.errors.CancelledError)`. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Raises ------ ||\n|--------------|-----------------------------------------------------------------------|\n| `ValueError` | `feed_fns` is not `None` and has different length than `enqueue_ops`. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Attributes ---------- ||\n|--------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `cancel_op` | \u003cbr /\u003e \u003cbr /\u003e |\n| `close_op` | \u003cbr /\u003e \u003cbr /\u003e |\n| `enqueue_ops` | \u003cbr /\u003e \u003cbr /\u003e |\n| `exceptions_raised` | Exceptions raised but not handled by the `QueueRunner` threads. \u003cbr /\u003e Exceptions raised in queue runner threads are handled in one of two ways depending on whether or not a `Coordinator` was passed to `create_threads()`: - With a `Coordinator`, exceptions are reported to the coordinator and forgotten by the `QueueRunner`. - Without a `Coordinator`, exceptions are captured by the `QueueRunner` and made available in this `exceptions_raised` property. |\n| `name` | The string name of the underlying Queue. |\n| `queue` | \u003cbr /\u003e |\n| `queue_closed_exception_types` | \u003cbr /\u003e \u003cbr /\u003e |\n\n\u003cbr /\u003e\n\nMethods\n-------\n\n### `create_threads`\n\n[View source](https://github.com/tensorflow/estimator/tree/master/tensorflow_estimator/python/estimator/inputs/queues/feeding_queue_runner.py) \n\n create_threads(\n sess, coord=None, daemon=False, start=False\n )\n\nCreate threads to run the enqueue ops for the given session.\n\nThis method requires a session in which the graph was launched. It creates\na list of threads, optionally starting them. There is one thread for each\nop passed in `enqueue_ops`.\n\nThe `coord` argument is an optional coordinator, that the threads will use\nto terminate together and report exceptions. If a coordinator is given,\nthis method starts an additional thread to close the queue when the\ncoordinator requests a stop.\n\nIf previously created threads for the given session are still running, no\nnew threads will be created.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ||\n|----------|----------------------------------------------------------------------------------------------------------------------|\n| `sess` | A `Session`. |\n| `coord` | Optional `Coordinator` object for reporting errors and checking stop conditions. |\n| `daemon` | Boolean. If `True` make the threads daemon threads. |\n| `start` | Boolean. If `True` starts the threads. If `False` the caller must call the `start()` method of the returned threads. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|---|---|\n| A list of threads. ||\n\n\u003cbr /\u003e\n\n### `from_proto`\n\n[View source](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/training/queue_runner_impl.py#L387-L391) \n\n @staticmethod\n from_proto(\n queue_runner_def, import_scope=None\n )\n\nReturns a `QueueRunner` object created from `queue_runner_def`.\n\n### `to_proto`\n\n[View source](https://github.com/tensorflow/estimator/tree/master/tensorflow_estimator/python/estimator/inputs/queues/feeding_queue_runner.py) \n\n to_proto()\n\nConverts this `QueueRunner` to a `QueueRunnerDef` protocol buffer.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ||\n|----------------|------------------------------------------|\n| `export_scope` | Optional `string`. Name scope to remove. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|---|---|\n| A `QueueRunnerDef` protocol buffer, or `None` if the `Variable` is not in the specified name scope. ||\n\n\u003cbr /\u003e"]]