(self)
| 59 | |
| 60 | @test_util.deprecated_graph_mode_only |
| 61 | def testTimelineCpu(self): |
| 62 | run_options = config_pb2.RunOptions( |
| 63 | trace_level=config_pb2.RunOptions.FULL_TRACE) |
| 64 | run_metadata = config_pb2.RunMetadata() |
| 65 | |
| 66 | with self.session(use_gpu=False) as sess: |
| 67 | const1 = constant_op.constant(1.0, name='const1') |
| 68 | const2 = constant_op.constant(2.0, name='const2') |
| 69 | result = math_ops.add(const1, const2) + const1 * const2 |
| 70 | sess.run(result, options=run_options, run_metadata=run_metadata) |
| 71 | self.assertTrue(run_metadata.HasField('step_stats')) |
| 72 | step_stats = run_metadata.step_stats |
| 73 | devices = [d.device for d in step_stats.dev_stats] |
| 74 | self.assertTrue('/job:localhost/replica:0/task:0/device:CPU:0' in devices) |
| 75 | tl = timeline.Timeline(step_stats) |
| 76 | ctf = tl.generate_chrome_trace_format() |
| 77 | self._validateTrace(ctf) |
| 78 | tl = timeline.Timeline(step_stats) |
| 79 | ctf = tl.generate_chrome_trace_format(show_dataflow=False) |
| 80 | self._validateTrace(ctf) |
| 81 | tl = timeline.Timeline(step_stats) |
| 82 | ctf = tl.generate_chrome_trace_format(show_memory=False) |
| 83 | self._validateTrace(ctf) |
| 84 | tl = timeline.Timeline(step_stats) |
| 85 | ctf = tl.generate_chrome_trace_format( |
| 86 | show_memory=False, show_dataflow=False) |
| 87 | self._validateTrace(ctf) |
| 88 | |
| 89 | @test_util.deprecated_graph_mode_only |
| 90 | def testTimelineGpu(self): |
nothing calls this directly
no test coverage detected