Dequeues one element from this queue. If the queue is empty when this operation executes, it will block until there is an element to dequeue. At runtime, this operation may raise an error if the queue is `tf.QueueBase.close` before or during its execution. If the queue is close
(self, name=None)
| 420 | return tensors |
| 421 | |
| 422 | def dequeue(self, name=None): |
| 423 | """Dequeues one element from this queue. |
| 424 | |
| 425 | If the queue is empty when this operation executes, it will block |
| 426 | until there is an element to dequeue. |
| 427 | |
| 428 | At runtime, this operation may raise an error if the queue is |
| 429 | `tf.QueueBase.close` before or during its execution. If the |
| 430 | queue is closed, the queue is empty, and there are no pending |
| 431 | enqueue operations that can fulfill this request, |
| 432 | `tf.errors.OutOfRangeError` will be raised. If the session is |
| 433 | `tf.Session.close`, |
| 434 | `tf.errors.CancelledError` will be raised. |
| 435 | |
| 436 | Args: |
| 437 | name: A name for the operation (optional). |
| 438 | |
| 439 | Returns: |
| 440 | The tuple of tensors that was dequeued. |
| 441 | """ |
| 442 | if name is None: |
| 443 | name = "%s_Dequeue" % self._name |
| 444 | if self._queue_ref.dtype == _dtypes.resource: |
| 445 | ret = gen_data_flow_ops.queue_dequeue_v2( |
| 446 | self._queue_ref, self._dtypes, name=name) |
| 447 | else: |
| 448 | ret = gen_data_flow_ops.queue_dequeue( |
| 449 | self._queue_ref, self._dtypes, name=name) |
| 450 | |
| 451 | # NOTE(mrry): Not using a shape function because we need access to |
| 452 | # the `QueueBase` object. |
| 453 | if not context.executing_eagerly(): |
| 454 | op = ret[0].op |
| 455 | for output, shape in zip(op.values(), self._shapes): |
| 456 | output.set_shape(shape) |
| 457 | |
| 458 | return self._dequeue_return_value(ret) |
| 459 | |
| 460 | def dequeue_many(self, n, name=None): |
| 461 | """Dequeues and concatenates `n` elements from this queue. |