本文整理汇总了Python中tensorflow.python.training.queue_runner.add_queue_runner方法的典型用法代码示例。如果您正苦于以下问题:Python queue_runner.add_queue_runner方法的具体用法?Python queue_runner.add_queue_runner怎么用?Python queue_runner.add_queue_runner使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tensorflow.python.training.queue_runner
的用法示例。
在下文中一共展示了queue_runner.add_queue_runner方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _add_remote_queue_runner
# 需要导入模块: from tensorflow.python.training import queue_runner [as 别名]
# 或者: from tensorflow.python.training.queue_runner import add_queue_runner [as 别名]
def _add_remote_queue_runner(self, queue, enq_ops):
"""Adds a remote queue runner to the graph.
These queue runners differ from the standard in two ways: First,
they never close their queue. Second, they are added to the
`Feeder.REMOTE_QUEUE_RUNNERS` collection, rather than
`ops.GraphKeys.QUEUE_RUNNERS`, so they can be started/stopped
separately.
Args:
queue: The queue.
enq_ops: A list of ops which perform enqueues (each on its own thread).
"""
runner = queue_runner.QueueRunner(
queue,
enq_ops,
cancel_op=self._fake_op,
close_op=self._fake_op)
queue_runner.add_queue_runner(
runner, collection=Feeder.REMOTE_QUEUE_RUNNERS)
示例2: _add_remote_queue_runner
# 需要导入模块: from tensorflow.python.training import queue_runner [as 别名]
# 或者: from tensorflow.python.training.queue_runner import add_queue_runner [as 别名]
def _add_remote_queue_runner(self, queue, enq_ops):
"""Adds a remote queue runner to the graph.
These queue runners differ from the standard in two ways: First,
they never close their queue. Second, they are added to the
`Feeder.REMOTE_QUEUE_RUNNERS` collection, rather than
`ops.GraphKeys.QUEUE_RUNNERS`, so they can be started/stopped
seperately.
Args:
queue: The queue.
enq_ops: A list of ops which perform enqueues (each on its own thread).
"""
runner = queue_runner.QueueRunner(
queue,
enq_ops,
cancel_op=self._fake_op,
close_op=self._fake_op)
queue_runner.add_queue_runner(
runner, collection=Feeder.REMOTE_QUEUE_RUNNERS)
示例3: _enqueue_join
# 需要导入模块: from tensorflow.python.training import queue_runner [as 别名]
# 或者: from tensorflow.python.training.queue_runner import add_queue_runner [as 别名]
def _enqueue_join(queue, tensor_list_list):
enqueue_ops = [queue.enqueue(tl) for tl in tensor_list_list]
queue_runner.add_queue_runner(queue_runner.QueueRunner(queue, enqueue_ops))
示例4: _enqueue_join
# 需要导入模块: from tensorflow.python.training import queue_runner [as 别名]
# 或者: from tensorflow.python.training.queue_runner import add_queue_runner [as 别名]
def _enqueue_join(queue, tensor_list_list, enqueue_many, keep_input):
"""Enqueue `tensor_list_list` in `queue`."""
if enqueue_many:
enqueue_fn = queue.enqueue_many
else:
enqueue_fn = queue.enqueue
if keep_input.get_shape().ndims == 1:
enqueue_ops = [enqueue_fn(_select_which_to_enqueue(x, keep_input))
for x in tensor_list_list]
else:
enqueue_ops = [_smart_cond(
keep_input,
lambda: enqueue_fn(tl), # pylint:disable=cell-var-from-loop
control_flow_ops.no_op) for tl in tensor_list_list]
queue_runner.add_queue_runner(queue_runner.QueueRunner(queue, enqueue_ops))
示例5: _enqueue
# 需要导入模块: from tensorflow.python.training import queue_runner [as 别名]
# 或者: from tensorflow.python.training.queue_runner import add_queue_runner [as 别名]
def _enqueue(queue, tensor_list, threads, enqueue_many, keep_input):
"""Enqueue `tensor_list` in `queue`."""
if enqueue_many:
enqueue_fn = queue.enqueue_many
else:
enqueue_fn = queue.enqueue
if keep_input.get_shape().ndims == 1:
enqueue_ops = [
enqueue_fn(_select_which_to_enqueue(tensor_list, keep_input))] * threads
else:
enqueue_ops = [_smart_cond(
keep_input,
lambda: enqueue_fn(tensor_list),
control_flow_ops.no_op)] * threads
queue_runner.add_queue_runner(queue_runner.QueueRunner(queue, enqueue_ops))
示例6: read
# 需要导入模块: from tensorflow.python.training import queue_runner [as 别名]
# 或者: from tensorflow.python.training.queue_runner import add_queue_runner [as 别名]
def read(self, queue, name=None):
"""Returns the next record (key, value pair) produced by the reader.
The multiple reader instances are all configured to `read()` from the
filenames listed in `queue` and enqueue their output into the `common_queue`
passed to the constructor, and this method returns the next record dequeued
from that `common_queue`.
Readers dequeue a work unit from `queue` if necessary (e.g. when a
reader needs to start reading from a new file since it has finished with
the previous file).
A queue runner for enqueing in the `common_queue` is automatically added to
the TF QueueRunners collection.
Args:
queue: A Queue or a mutable string Tensor representing a handle
to a Queue, with string work items.
name: A name for the operation (optional).
Returns:
The next record (i.e. (key, value pair)) from the common_queue.
"""
enqueue_ops = []
for reader in self._readers:
enqueue_ops.append(self._common_queue.enqueue(reader.read(queue)))
queue_runner.add_queue_runner(
queue_runner.QueueRunner(self._common_queue, enqueue_ops))
return self._common_queue.dequeue(name=name)
示例7: set_fed_tensors
# 需要导入模块: from tensorflow.python.training import queue_runner [as 别名]
# 或者: from tensorflow.python.training.queue_runner import add_queue_runner [as 别名]
def set_fed_tensors(self, tensors):
"""Sets fed tensors."""
enq_op = self._local_q.enqueue(tensors)
queue_runner.add_queue_runner(queue_runner.QueueRunner(
self._local_q, [enq_op]))
示例8: _enqueue_join
# 需要导入模块: from tensorflow.python.training import queue_runner [as 别名]
# 或者: from tensorflow.python.training.queue_runner import add_queue_runner [as 别名]
def _enqueue_join(queue, tensor_list_list, enqueue_many, keep_input):
"""Enqueue `tensor_list_list` in `queue`."""
if enqueue_many:
enqueue_fn = queue.enqueue_many
else:
enqueue_fn = queue.enqueue
if keep_input is None:
enqueue_ops = [enqueue_fn(tl) for tl in tensor_list_list]
else:
enqueue_ops = [control_flow_ops.cond(
keep_input,
lambda: enqueue_fn(tl),
control_flow_ops.no_op) for tl in tensor_list_list]
queue_runner.add_queue_runner(queue_runner.QueueRunner(queue, enqueue_ops))
示例9: _enqueue
# 需要导入模块: from tensorflow.python.training import queue_runner [as 别名]
# 或者: from tensorflow.python.training.queue_runner import add_queue_runner [as 别名]
def _enqueue(queue, tensor_list, threads, enqueue_many, keep_input):
"""Enqueue `tensor_list` in `queue`."""
if enqueue_many:
enqueue_fn = queue.enqueue_many
else:
enqueue_fn = queue.enqueue
if keep_input is None:
enqueue_ops = [enqueue_fn(tensor_list)] * threads
else:
enqueue_ops = [control_flow_ops.cond(
keep_input,
lambda: enqueue_fn(tensor_list),
control_flow_ops.no_op)] * threads
queue_runner.add_queue_runner(queue_runner.QueueRunner(queue, enqueue_ops))
示例10: _configure_readers_by
# 需要导入模块: from tensorflow.python.training import queue_runner [as 别名]
# 或者: from tensorflow.python.training.queue_runner import add_queue_runner [as 别名]
def _configure_readers_by(self, queue):
enqueue_ops = []
for reader in self._readers:
enqueue_ops.append(self._common_queue.enqueue(reader.read(queue)))
queue_runner.add_queue_runner(
queue_runner.QueueRunner(self._common_queue, enqueue_ops))
示例11: _enqueue_join
# 需要导入模块: from tensorflow.python.training import queue_runner [as 别名]
# 或者: from tensorflow.python.training.queue_runner import add_queue_runner [as 别名]
def _enqueue_join(queue, tensor_list_list, enqueue_many):
if enqueue_many:
enqueue_ops = [queue.enqueue_many(tl) for tl in tensor_list_list]
else:
enqueue_ops = [queue.enqueue(tl) for tl in tensor_list_list]
queue_runner.add_queue_runner(queue_runner.QueueRunner(queue, enqueue_ops))
示例12: _enqueue
# 需要导入模块: from tensorflow.python.training import queue_runner [as 别名]
# 或者: from tensorflow.python.training.queue_runner import add_queue_runner [as 别名]
def _enqueue(queue, tensor_list, threads, enqueue_many):
if enqueue_many:
enqueue_ops = [queue.enqueue_many(tensor_list)] * threads
else:
enqueue_ops = [queue.enqueue(tensor_list)] * threads
queue_runner.add_queue_runner(queue_runner.QueueRunner(queue, enqueue_ops))
示例13: read
# 需要导入模块: from tensorflow.python.training import queue_runner [as 别名]
# 或者: from tensorflow.python.training.queue_runner import add_queue_runner [as 别名]
def read(self, queue, name=None):
"""Returns the next record (key, value pair) produced by the reader.
The multiple reader instances are all configured to `read()` from the
filenames listed in `queue` and enqueue their output into the `common_queue`
passed to the constructor, and this method returns the next record dequeued
from that `common_queue`.
Readers dequeue a work unit from `queue` if necessary (e.g. when a
reader needs to start reading from a new file since it has finished with
the previous file).
A queue runner for enqueing in the `common_queue` is automatically added to
the TF QueueRunners collection.
Args:
queue: A Queue or a mutable string Tensor representing a handle
to a Queue, with string work items.
name: A name for the operation (optional).
Returns:
The next record (i.e. (key, value pair)) from the common_queue.
"""
enqueue_ops = []
for reader in self._readers:
enqueue_ops.append(self._common_queue.enqueue(reader.read(queue)))
queue_runner.add_queue_runner(queue_runner.QueueRunner(
self._common_queue, enqueue_ops))
return self._common_queue.dequeue(name=name)
示例14: _make_batch_queue
# 需要导入模块: from tensorflow.python.training import queue_runner [as 别名]
# 或者: from tensorflow.python.training.queue_runner import add_queue_runner [as 别名]
def _make_batch_queue(input, capacity, num_threads=1):
queue = tf.PaddingFIFOQueue(capacity=capacity, dtypes=[s.dtype for s in input], shapes=[s.get_shape() for s in input])
tf.summary.scalar("fraction_of_%d_full" % capacity,
tf.cast(queue.size(), tf.float32) *
(1. / capacity))
enqueue_ops = [queue.enqueue(input)]*num_threads
queue_runner.add_queue_runner(queue_runner.QueueRunner(queue, enqueue_ops))
return queue
# This class is responsible for setting up and running experiments
# Also provides helper functions related to experiments (e.g. get accuracy)
示例15: _enqueue_join
# 需要导入模块: from tensorflow.python.training import queue_runner [as 别名]
# 或者: from tensorflow.python.training.queue_runner import add_queue_runner [as 别名]
def _enqueue_join(queue, tensor_list_list, enqueue_many, keep_input):
"""Enqueue `tensor_list_list` in `queue`."""
if enqueue_many:
enqueue_fn = queue.enqueue_many
else:
enqueue_fn = queue.enqueue
if keep_input.shape.ndims == 1:
enqueue_ops = [enqueue_fn(_select_which_to_enqueue(x, keep_input))
for x in tensor_list_list]
else:
enqueue_ops = [_smart_cond(
keep_input,
lambda: enqueue_fn(tl), # pylint:disable=cell-var-from-loop
control_flow_ops.no_op) for tl in tensor_list_list]
queue_runner.add_queue_runner(queue_runner.QueueRunner(queue, enqueue_ops))
开发者ID:PacktPublishing,项目名称:Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda,代码行数:17,代码来源:input.py