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

Method take_many

tensorflow/python/ops/data_flow_ops.py:1034–1101  ·  view source on GitHub ↗

Takes the given number of completed elements from this barrier. This operation concatenates completed-element component tensors along the 0th dimension to make a single component tensor. If barrier has no completed elements, this operation will block until there are 'num_elements'

(self,
                num_elements,
                allow_small_batch=False,
                timeout=None,
                name=None)

Source from the content-addressed store, hash-verified

1032 self._barrier_ref, keys, values, component_index, name=name)
1033
1034 def take_many(self,
1035 num_elements,
1036 allow_small_batch=False,
1037 timeout=None,
1038 name=None):
1039 """Takes the given number of completed elements from this barrier.
1040
1041 This operation concatenates completed-element component tensors along
1042 the 0th dimension to make a single component tensor.
1043
1044 If barrier has no completed elements, this operation will block
1045 until there are 'num_elements' elements to take.
1046
1047 TODO(b/25743580): the semantics of `allow_small_batch` are experimental
1048 and may be extended to other cases in the future.
1049
1050 TODO(ebrevdo): If a take_many(allow_small_batch=True) is blocking
1051 already when the barrier is closed, it will block for ever. Fix this
1052 by using asynchronous operations.
1053
1054 Args:
1055 num_elements: The number of elements to take.
1056 allow_small_batch: If the barrier is closed, don't block if there are less
1057 completed elements than requested, but instead return all available
1058 completed elements.
1059 timeout: This specifies the number of milliseconds to block
1060 before returning with DEADLINE_EXCEEDED. (This option is not
1061 supported yet.)
1062 name: A name for the operation (optional).
1063
1064 Returns:
1065 A tuple of (index, key, value_list).
1066 "index" is a int64 tensor of length num_elements containing the
1067 index of the insert_many call for which the very first component of
1068 the given element was inserted into the Barrier, starting with
1069 the value -2**63. Note, this value is different from the
1070 index of the insert_many call for which the element was completed.
1071 "key" is a string tensor of length num_elements containing the keys.
1072 "value_list" is a tuple of tensors, each one with size num_elements
1073 in the 0th dimension for each component in the barrier's values.
1074
1075 """
1076 if name is None:
1077 name = "%s_BarrierTakeMany" % self._name
1078 ret = gen_data_flow_ops.barrier_take_many(
1079 self._barrier_ref,
1080 num_elements,
1081 self._types,
1082 allow_small_batch,
1083 timeout,
1084 name=name)
1085
1086 # NOTE(mrry): Not using a shape function because we need access to
1087 # the Barrier object.
1088 if not context.executing_eagerly():
1089 op = ret[0].op
1090 if allow_small_batch:
1091 batch_dim = None

Calls 4

executing_eagerlyMethod · 0.80
DimensionMethod · 0.45
set_shapeMethod · 0.45
concatenateMethod · 0.45