(self)
| 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 = [{ |
nothing calls this directly
no test coverage detected