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

Method enqueue

tensorflow/python/ops/data_flow_ops.py:312–349  ·  view source on GitHub ↗

Enqueues one element to this queue. If the queue is full when this operation executes, it will block until the element has been enqueued. At runtime, this operation may raise an error if the queue is `tf.QueueBase.close` before or during its execution. If the queue is closed be

(self, vals, name=None)

Source from the content-addressed store, hash-verified

310 return [vals]
311
312 def enqueue(self, vals, name=None):
313 """Enqueues one element to this queue.
314
315 If the queue is full when this operation executes, it will block
316 until the element has been enqueued.
317
318 At runtime, this operation may raise an error if the queue is
319 `tf.QueueBase.close` before or during its execution. If the
320 queue is closed before this operation runs,
321 `tf.errors.CancelledError` will be raised. If this operation is
322 blocked, and either (i) the queue is closed by a close operation
323 with `cancel_pending_enqueues=True`, or (ii) the session is
324 `tf.Session.close`,
325 `tf.errors.CancelledError` will be raised.
326
327 Args:
328 vals: A tensor, a list or tuple of tensors, or a dictionary containing
329 the values to enqueue.
330 name: A name for the operation (optional).
331
332 Returns:
333 The operation that enqueues a new tuple of tensors to the queue.
334 """
335 with ops.name_scope(name, "%s_enqueue" % self._name,
336 self._scope_vals(vals)) as scope:
337 vals = self._check_enqueue_dtypes(vals)
338
339 # NOTE(mrry): Not using a shape function because we need access to
340 # the `QueueBase` object.
341 for val, shape in zip(vals, self._shapes):
342 val.get_shape().assert_is_compatible_with(shape)
343
344 if self._queue_ref.dtype == _dtypes.resource:
345 return gen_data_flow_ops.queue_enqueue_v2(
346 self._queue_ref, vals, name=scope)
347 else:
348 return gen_data_flow_ops.queue_enqueue(
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.

Callers 15

AddTaskMethod · 0.45
AddUpdateTaskMethod · 0.45
input_producerMethod · 0.45
_enqueue_vectorMethod · 0.45
fnMethod · 0.45
testFunctionErrorMethod · 0.45
finalize_fnMethod · 0.45
fnMethod · 0.45

Calls 5

_scope_valsMethod · 0.95
_check_enqueue_dtypesMethod · 0.95
name_scopeMethod · 0.45
get_shapeMethod · 0.45

Tested by 13

_enqueue_vectorMethod · 0.36
fnMethod · 0.36
testFunctionErrorMethod · 0.36
finalize_fnMethod · 0.36
fnMethod · 0.36
finalize_fnMethod · 0.36
testGracePeriodMethod · 0.36