aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <nobody@tensorflow.org>2015-12-14 16:44:54 -0800
committerGravatar Vijay Vasudevan <vrv@google.com>2015-12-14 16:44:54 -0800
commitcd55d4606186357affea2f892f740de93c1bd0f7 (patch)
tree7da9a9a196f8b5df71714ad3a5a5427ffeba3939
parentffa43f95f461b47a15775f815558f2364d9544b1 (diff)
Added 'name' property to QueueRunner.
This allows one to retrieve QueueRunners corresponding to queues in a specific scope using tf.get_collection(tf.GraphKeys.QUEUE_RUNNERS, scope). Change: 110169009
-rw-r--r--tensorflow/python/training/queue_runner.py5
-rw-r--r--tensorflow/python/training/queue_runner_test.py8
2 files changed, 13 insertions, 0 deletions
diff --git a/tensorflow/python/training/queue_runner.py b/tensorflow/python/training/queue_runner.py
index 848b85e151..c7ffb01be3 100644
--- a/tensorflow/python/training/queue_runner.py
+++ b/tensorflow/python/training/queue_runner.py
@@ -93,6 +93,11 @@ class QueueRunner(object):
"""
return self._exceptions_raised
+ @property
+ def name(self):
+ """The string name of the underlying Queue."""
+ return self._queue.name
+
# pylint: disable=broad-except
def _run(self, sess, enqueue_op, coord=None):
"""Execute the enqueue op in a loop, close the queue in case of error.
diff --git a/tensorflow/python/training/queue_runner_test.py b/tensorflow/python/training/queue_runner_test.py
index 99d37ad218..f207e7e431 100644
--- a/tensorflow/python/training/queue_runner_test.py
+++ b/tensorflow/python/training/queue_runner_test.py
@@ -200,6 +200,14 @@ class QueueRunnerTest(tf.test.TestCase):
self.assertEqual(1, len(exceptions))
self.assertTrue("Operation not in the graph" in str(exceptions[0]))
+ def testName(self):
+ with tf.name_scope("scope"):
+ queue = tf.FIFOQueue(10, tf.float32, name="queue")
+ qr = tf.train.QueueRunner(queue, [tf.no_op()])
+ self.assertEqual("scope/queue", qr.name)
+ tf.train.add_queue_runner(qr)
+ self.assertEqual(1, len(tf.get_collection(tf.GraphKeys.QUEUE_RUNNERS,
+ "scope")))
if __name__ == "__main__":
tf.test.main()