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

Method from_list

tensorflow/python/ops/data_flow_ops.py:186–224  ·  view source on GitHub ↗

Create a queue using the queue reference from `queues[index]`. Args: index: An integer scalar tensor that determines the input that gets selected. queues: A list of `QueueBase` objects. Returns: A `QueueBase` object. Raises: TypeError: When `queues` is

(index, queues)

Source from the content-addressed store, hash-verified

184
185 @staticmethod
186 def from_list(index, queues):
187 """Create a queue using the queue reference from `queues[index]`.
188
189 Args:
190 index: An integer scalar tensor that determines the input that gets
191 selected.
192 queues: A list of `QueueBase` objects.
193
194 Returns:
195 A `QueueBase` object.
196
197 Raises:
198 TypeError: When `queues` is not a list of `QueueBase` objects,
199 or when the data types of `queues` are not all the same.
200 """
201 if ((not queues) or (not isinstance(queues, list)) or
202 (not all(isinstance(x, QueueBase) for x in queues))):
203 raise TypeError("A list of queues expected")
204
205 dtypes = queues[0].dtypes
206 if not all(dtypes == q.dtypes for q in queues[1:]):
207 raise TypeError("Queues do not have matching component dtypes.")
208
209 names = queues[0].names
210 if not all(names == q.names for q in queues[1:]):
211 raise TypeError("Queues do not have matching component names.")
212
213 queue_shapes = [q.shapes for q in queues]
214 reduced_shapes = [
215 six.moves.reduce(_shape_common, s) for s in zip(*queue_shapes)
216 ]
217
218 queue_refs = array_ops.stack([x.queue_ref for x in queues])
219 selected_queue = array_ops.gather(queue_refs, index)
220 return QueueBase(
221 dtypes=dtypes,
222 shapes=reduced_shapes,
223 names=names,
224 queue_ref=selected_queue)
225
226 @property
227 def queue_ref(self):

Callers 8

testSelectQueueMethod · 0.80
testSelectQueueMethod · 0.80
_cmpMethod · 0.80
testSelectQueueMethod · 0.80

Calls 5

allFunction · 0.85
QueueBaseClass · 0.85
reduceMethod · 0.45
stackMethod · 0.45
gatherMethod · 0.45

Tested by 8

testSelectQueueMethod · 0.64
testSelectQueueMethod · 0.64
_cmpMethod · 0.64
testSelectQueueMethod · 0.64