Create a queue that dequeues elements in a random order. A `RandomShuffleQueue` has bounded capacity; supports multiple concurrent producers and consumers; and provides exactly-once delivery. A `RandomShuffleQueue` holds a list of up to `capacity` elements. Each element is a fi
(self,
capacity,
min_after_dequeue,
dtypes,
shapes=None,
names=None,
seed=None,
shared_name=None,
name="random_shuffle_queue")
| 631 | """ |
| 632 | |
| 633 | def __init__(self, |
| 634 | capacity, |
| 635 | min_after_dequeue, |
| 636 | dtypes, |
| 637 | shapes=None, |
| 638 | names=None, |
| 639 | seed=None, |
| 640 | shared_name=None, |
| 641 | name="random_shuffle_queue"): |
| 642 | """Create a queue that dequeues elements in a random order. |
| 643 | |
| 644 | A `RandomShuffleQueue` has bounded capacity; supports multiple |
| 645 | concurrent producers and consumers; and provides exactly-once |
| 646 | delivery. |
| 647 | |
| 648 | A `RandomShuffleQueue` holds a list of up to `capacity` |
| 649 | elements. Each element is a fixed-length tuple of tensors whose |
| 650 | dtypes are described by `dtypes`, and whose shapes are optionally |
| 651 | described by the `shapes` argument. |
| 652 | |
| 653 | If the `shapes` argument is specified, each component of a queue |
| 654 | element must have the respective fixed shape. If it is |
| 655 | unspecified, different queue elements may have different shapes, |
| 656 | but the use of `dequeue_many` is disallowed. |
| 657 | |
| 658 | The `min_after_dequeue` argument allows the caller to specify a |
| 659 | minimum number of elements that will remain in the queue after a |
| 660 | `dequeue` or `dequeue_many` operation completes, to ensure a |
| 661 | minimum level of mixing of elements. This invariant is maintained |
| 662 | by blocking those operations until sufficient elements have been |
| 663 | enqueued. The `min_after_dequeue` argument is ignored after the |
| 664 | queue has been closed. |
| 665 | |
| 666 | Args: |
| 667 | capacity: An integer. The upper bound on the number of elements |
| 668 | that may be stored in this queue. |
| 669 | min_after_dequeue: An integer (described above). |
| 670 | dtypes: A list of `DType` objects. The length of `dtypes` must equal |
| 671 | the number of tensors in each queue element. |
| 672 | shapes: (Optional.) A list of fully-defined `TensorShape` objects |
| 673 | with the same length as `dtypes`, or `None`. |
| 674 | names: (Optional.) A list of string naming the components in the queue |
| 675 | with the same length as `dtypes`, or `None`. If specified the dequeue |
| 676 | methods return a dictionary with the names as keys. |
| 677 | seed: A Python integer. Used to create a random seed. See |
| 678 | `tf.compat.v1.set_random_seed` |
| 679 | for behavior. |
| 680 | shared_name: (Optional.) If non-empty, this queue will be shared under |
| 681 | the given name across multiple sessions. |
| 682 | name: Optional name for the queue operation. |
| 683 | """ |
| 684 | dtypes = _as_type_list(dtypes) |
| 685 | shapes = _as_shape_list(shapes, dtypes) |
| 686 | names = _as_name_list(names, dtypes) |
| 687 | seed1, seed2 = random_seed.get_seed(seed) |
| 688 | if seed1 is None and seed2 is None: |
| 689 | seed1, seed2 = 0, 0 |
| 690 | elif seed is None and shared_name is not None: |
nothing calls this directly
no test coverage detected