(self)
| 330 | op_properties['IteratorGetNext'][0].shape) |
| 331 | |
| 332 | def testInterleave(self): |
| 333 | test_cases = [{ |
| 334 | 'tensor': 0, |
| 335 | 'shape': tensor_shape.TensorShape([]) |
| 336 | }, { |
| 337 | 'tensor': np.array([1, 2, 3]), |
| 338 | 'shape': tensor_shape.TensorShape([3]) |
| 339 | }, { |
| 340 | 'tensor': np.array([[1, 2, 3]]), |
| 341 | 'shape': tensor_shape.TensorShape([1, 3]) |
| 342 | }] |
| 343 | |
| 344 | for test_case in test_cases: |
| 345 | with ops.Graph().as_default() as g: |
| 346 | dataset = dataset_ops.Dataset.range(42) |
| 347 | |
| 348 | def make_dataset(tensor): |
| 349 | |
| 350 | def dataset_fn(n): |
| 351 | return dataset_ops.Dataset.from_tensors(tensor).repeat(n) |
| 352 | |
| 353 | return dataset_fn |
| 354 | |
| 355 | dataset = dataset.interleave( |
| 356 | make_dataset(test_case['tensor']), cycle_length=42) |
| 357 | iterator = dataset_ops.make_one_shot_iterator(dataset) |
| 358 | get_next = iterator.get_next() |
| 359 | train_op = ops.get_collection_ref(ops.GraphKeys.TRAIN_OP) |
| 360 | train_op.append(get_next) |
| 361 | mg = meta_graph.create_meta_graph_def(graph=g) |
| 362 | grappler_item = item.Item(mg) |
| 363 | op_properties = grappler_item.GetOpProperties() |
| 364 | self.assertEqual(test_case['shape'], |
| 365 | op_properties['IteratorGetNext'][0].shape) |
| 366 | |
| 367 | def testMap(self): |
| 368 | test_cases = [{ |
nothing calls this directly
no test coverage detected