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

Method __init__

tensorflow/python/ops/data_flow_ops.py:855–911  ·  view source on GitHub ↗

Creates a queue that dequeues elements in a first-in first-out order. A `PriorityQueue` has bounded capacity; supports multiple concurrent producers and consumers; and provides exactly-once delivery. A `PriorityQueue` holds a list of up to `capacity` elements. Each element is a fix

(self,
               capacity,
               types,
               shapes=None,
               names=None,
               shared_name=None,
               name="priority_queue")

Source from the content-addressed store, hash-verified

853 """
854
855 def __init__(self,
856 capacity,
857 types,
858 shapes=None,
859 names=None,
860 shared_name=None,
861 name="priority_queue"):
862 """Creates a queue that dequeues elements in a first-in first-out order.
863
864 A `PriorityQueue` has bounded capacity; supports multiple concurrent
865 producers and consumers; and provides exactly-once delivery.
866
867 A `PriorityQueue` holds a list of up to `capacity` elements. Each
868 element is a fixed-length tuple of tensors whose dtypes are
869 described by `types`, and whose shapes are optionally described
870 by the `shapes` argument.
871
872 If the `shapes` argument is specified, each component of a queue
873 element must have the respective fixed shape. If it is
874 unspecified, different queue elements may have different shapes,
875 but the use of `dequeue_many` is disallowed.
876
877 Enqueues and Dequeues to the `PriorityQueue` must include an additional
878 tuple entry at the beginning: the `priority`. The priority must be
879 an int64 scalar (for `enqueue`) or an int64 vector (for `enqueue_many`).
880
881 Args:
882 capacity: An integer. The upper bound on the number of elements
883 that may be stored in this queue.
884 types: A list of `DType` objects. The length of `types` must equal
885 the number of tensors in each queue element, except the first priority
886 element. The first tensor in each element is the priority,
887 which must be type int64.
888 shapes: (Optional.) A list of fully-defined `TensorShape` objects,
889 with the same length as `types`, or `None`.
890 names: (Optional.) A list of strings naming the components in the queue
891 with the same length as `dtypes`, or `None`. If specified, the dequeue
892 methods return a dictionary with the names as keys.
893 shared_name: (Optional.) If non-empty, this queue will be shared under
894 the given name across multiple sessions.
895 name: Optional name for the queue operation.
896 """
897 types = _as_type_list(types)
898 shapes = _as_shape_list(shapes, types)
899
900 queue_ref = gen_data_flow_ops.priority_queue_v2(
901 component_types=types,
902 shapes=shapes,
903 capacity=capacity,
904 shared_name=_shared_name(shared_name),
905 name=name)
906
907 priority_dtypes = [_dtypes.int64] + types
908 priority_shapes = [()] + shapes if shapes else shapes
909
910 super(PriorityQueue, self).__init__(priority_dtypes, priority_shapes, names,
911 queue_ref)
912

Callers

nothing calls this directly

Calls 4

_as_type_listFunction · 0.85
_as_shape_listFunction · 0.85
_shared_nameFunction · 0.85
__init__Method · 0.45

Tested by

no test coverage detected