Dequeues and concatenates `n` elements from this queue. This operation concatenates queue-element component tensors along the 0th dimension to make a single component tensor. All of the components in the dequeued tuple will have size `n` in the 0th dimension. If the queue is close
(self, n, name=None)
| 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. |
| 462 | |
| 463 | This operation concatenates queue-element component tensors along |
| 464 | the 0th dimension to make a single component tensor. All of the |
| 465 | components in the dequeued tuple will have size `n` in the 0th dimension. |
| 466 | |
| 467 | If the queue is closed and there are less than `n` elements left, then an |
| 468 | `OutOfRange` exception is raised. |
| 469 | |
| 470 | At runtime, this operation may raise an error if the queue is |
| 471 | `tf.QueueBase.close` before or during its execution. If the |
| 472 | queue is closed, the queue contains fewer than `n` elements, and |
| 473 | there are no pending enqueue operations that can fulfill this |
| 474 | request, `tf.errors.OutOfRangeError` will be raised. If the |
| 475 | session is `tf.Session.close`, |
| 476 | `tf.errors.CancelledError` will be raised. |
| 477 | |
| 478 | Args: |
| 479 | n: A scalar `Tensor` containing the number of elements to dequeue. |
| 480 | name: A name for the operation (optional). |
| 481 | |
| 482 | Returns: |
| 483 | The list of concatenated tensors that was dequeued. |
| 484 | """ |
| 485 | if name is None: |
| 486 | name = "%s_DequeueMany" % self._name |
| 487 | |
| 488 | ret = gen_data_flow_ops.queue_dequeue_many_v2( |
| 489 | self._queue_ref, n=n, component_types=self._dtypes, name=name) |
| 490 | |
| 491 | # NOTE(mrry): Not using a shape function because we need access to |
| 492 | # the Queue object. |
| 493 | if not context.executing_eagerly(): |
| 494 | op = ret[0].op |
| 495 | batch_dim = tensor_shape.Dimension( |
| 496 | tensor_util.constant_value(op.inputs[1])) |
| 497 | for output, shape in zip(op.values(), self._shapes): |
| 498 | output.set_shape( |
| 499 | tensor_shape.TensorShape([batch_dim]).concatenate(shape)) |
| 500 | |
| 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. |