Dequeues and concatenates `n` elements from this queue. **Note** This operation is not supported by all queues. If a queue does not support DequeueUpTo, then a `tf.errors.UnimplementedError` is raised. This operation concatenates queue-element component tensors along the 0th dimen
(self, n, name=None)
| 501 | return self._dequeue_return_value(ret) |
| 502 | |
| 503 | def dequeue_up_to(self, n, name=None): |
| 504 | """Dequeues and concatenates `n` elements from this queue. |
| 505 | |
| 506 | **Note** This operation is not supported by all queues. If a queue does not |
| 507 | support DequeueUpTo, then a `tf.errors.UnimplementedError` is raised. |
| 508 | |
| 509 | This operation concatenates queue-element component tensors along |
| 510 | the 0th dimension to make a single component tensor. If the queue |
| 511 | has not been closed, all of the components in the dequeued tuple |
| 512 | will have size `n` in the 0th dimension. |
| 513 | |
| 514 | If the queue is closed and there are more than `0` but fewer than |
| 515 | `n` elements remaining, then instead of raising a |
| 516 | `tf.errors.OutOfRangeError` like `tf.QueueBase.dequeue_many`, |
| 517 | less than `n` elements are returned immediately. If the queue is |
| 518 | closed and there are `0` elements left in the queue, then a |
| 519 | `tf.errors.OutOfRangeError` is raised just like in `dequeue_many`. |
| 520 | Otherwise the behavior is identical to `dequeue_many`. |
| 521 | |
| 522 | Args: |
| 523 | n: A scalar `Tensor` containing the number of elements to dequeue. |
| 524 | name: A name for the operation (optional). |
| 525 | |
| 526 | Returns: |
| 527 | The tuple of concatenated tensors that was dequeued. |
| 528 | """ |
| 529 | if name is None: |
| 530 | name = "%s_DequeueUpTo" % self._name |
| 531 | |
| 532 | ret = gen_data_flow_ops.queue_dequeue_up_to_v2( |
| 533 | self._queue_ref, n=n, component_types=self._dtypes, name=name) |
| 534 | |
| 535 | # NOTE(mrry): Not using a shape function because we need access to |
| 536 | # the Queue object. |
| 537 | if not context.executing_eagerly(): |
| 538 | op = ret[0].op |
| 539 | for output, shape in zip(op.values(), self._shapes): |
| 540 | output.set_shape(tensor_shape.TensorShape([None]).concatenate(shape)) |
| 541 | |
| 542 | return self._dequeue_return_value(ret) |
| 543 | |
| 544 | def close(self, cancel_pending_enqueues=False, name=None): |
| 545 | """Closes this queue. |