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

Method testMap

tensorflow/python/grappler/datasets_test.py:367–394  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

365 op_properties['IteratorGetNext'][0].shape)
366
367 def testMap(self):
368 test_cases = [{
369 'tensor': 0,
370 'shape': tensor_shape.TensorShape([])
371 }, {
372 'tensor': np.array([1, 2, 3]),
373 'shape': tensor_shape.TensorShape([3])
374 }, {
375 'tensor': np.array([[1, 2, 3]]),
376 'shape': tensor_shape.TensorShape([3, 1])
377 }, {
378 'tensor': np.array([[[1, 2, 3], [4, 5, 6]]]),
379 'shape': tensor_shape.TensorShape([3, 2, 1])
380 }]
381
382 for test_case in test_cases:
383 with ops.Graph().as_default() as g:
384 dataset = dataset_ops.Dataset.from_tensors(test_case['tensor'])
385 dataset = dataset.map(array_ops.transpose)
386 iterator = dataset_ops.make_one_shot_iterator(dataset)
387 get_next = iterator.get_next()
388 train_op = ops.get_collection_ref(ops.GraphKeys.TRAIN_OP)
389 train_op.append(get_next)
390 mg = meta_graph.create_meta_graph_def(graph=g)
391 grappler_item = item.Item(mg)
392 op_properties = grappler_item.GetOpProperties()
393 self.assertEqual(test_case['shape'],
394 op_properties['IteratorGetNext'][0].shape)
395
396 def testFromStructure(self):
397 test_cases = [{

Callers

nothing calls this directly

Calls 10

GetOpPropertiesMethod · 0.95
get_collection_refMethod · 0.80
ItemMethod · 0.80
as_defaultMethod · 0.45
GraphMethod · 0.45
from_tensorsMethod · 0.45
mapMethod · 0.45
get_nextMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected