MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / enqueue_many

Method enqueue_many

tensorflow/python/ops/data_flow_ops.py:351–397  ·  view source on GitHub ↗

Enqueues zero or more elements to this queue. This operation slices each component tensor along the 0th dimension to make multiple queue elements. All of the tensors in `vals` must have the same size in the 0th dimension. If the queue is full when this operation executes, it will b

(self, vals, name=None)

Source from the content-addressed store, hash-verified

349 self._queue_ref, vals, name=scope)
350
351 def enqueue_many(self, vals, name=None):
352 """Enqueues zero or more elements to this queue.
353
354 This operation slices each component tensor along the 0th dimension to
355 make multiple queue elements. All of the tensors in `vals` must have the
356 same size in the 0th dimension.
357
358 If the queue is full when this operation executes, it will block
359 until all of the elements have been enqueued.
360
361 At runtime, this operation may raise an error if the queue is
362 `tf.QueueBase.close` before or during its execution. If the
363 queue is closed before this operation runs,
364 `tf.errors.CancelledError` will be raised. If this operation is
365 blocked, and either (i) the queue is closed by a close operation
366 with `cancel_pending_enqueues=True`, or (ii) the session is
367 `tf.Session.close`,
368 `tf.errors.CancelledError` will be raised.
369
370 Args:
371 vals: A tensor, a list or tuple of tensors, or a dictionary
372 from which the queue elements are taken.
373 name: A name for the operation (optional).
374
375 Returns:
376 The operation that enqueues a batch of tuples of tensors to the queue.
377 """
378 with ops.name_scope(name, "%s_EnqueueMany" % self._name,
379 self._scope_vals(vals)) as scope:
380 vals = self._check_enqueue_dtypes(vals)
381
382 # NOTE(mrry): Not using a shape function because we need access to
383 # the `QueueBase` object.
384 # NOTE(fchollet): the code that follow is verbose because it needs to be
385 # compatible with both TF v1 TensorShape behavior and TF v2 behavior.
386 batch_dim = tensor_shape.dimension_value(
387 vals[0].get_shape().with_rank_at_least(1)[0])
388 batch_dim = tensor_shape.Dimension(batch_dim)
389 for val, shape in zip(vals, self._shapes):
390 val_batch_dim = tensor_shape.dimension_value(
391 val.get_shape().with_rank_at_least(1)[0])
392 val_batch_dim = tensor_shape.Dimension(val_batch_dim)
393 batch_dim = batch_dim.merge_with(val_batch_dim)
394 val.get_shape()[1:].assert_is_compatible_with(shape)
395
396 return gen_data_flow_ops.queue_enqueue_many_v2(
397 self._queue_ref, vals, name=scope)
398
399 def _dequeue_return_value(self, tensors):
400 """Return the value to return from a dequeue op.

Callers 15

_SetUpQueueFunction · 0.80
_init_qMethod · 0.80
_fnMethod · 0.80
_init_qMethod · 0.80
_fnMethod · 0.80
testMultipleDequeuesMethod · 0.80
testEnqueueManyMethod · 0.80
testEmptyEnqueueManyMethod · 0.80

Calls 8

_scope_valsMethod · 0.95
_check_enqueue_dtypesMethod · 0.95
merge_withMethod · 0.95
with_rank_at_leastMethod · 0.80
name_scopeMethod · 0.45
get_shapeMethod · 0.45
DimensionMethod · 0.45

Tested by 15

_SetUpQueueFunction · 0.64
_init_qMethod · 0.64
_fnMethod · 0.64
_init_qMethod · 0.64
_fnMethod · 0.64
testMultipleDequeuesMethod · 0.64
testEnqueueManyMethod · 0.64
testEmptyEnqueueManyMethod · 0.64
testMultiEnqueueManyMethod · 0.64