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

Method test_profile

tensorflow/python/eager/profiler_test.py:33–48  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

31class ProfilerTest(test_util.TensorFlowTestCase):
32
33 def test_profile(self):
34 profiler.start()
35 three = constant_op.constant(3)
36 five = constant_op.constant(5)
37 product = three * five
38 self.assertAllEqual(15, product)
39 with self.assertRaises(profiler.ProfilerAlreadyRunningError):
40 profiler.start()
41
42 profile_result = profiler.stop()
43 profile_pb = trace_events_pb2.Trace()
44 profile_pb.ParseFromString(profile_result)
45 profile_pb_str = '%s' % profile_pb
46 self.assertTrue('Mul' in profile_pb_str)
47 with self.assertRaises(profiler.ProfilerNotRunningError):
48 profiler.stop()
49
50 def test_save_profile(self):
51 logdir = self.get_temp_dir()

Callers

nothing calls this directly

Calls 6

startMethod · 0.45
constantMethod · 0.45
assertAllEqualMethod · 0.45
stopMethod · 0.45
TraceMethod · 0.45
ParseFromStringMethod · 0.45

Tested by

no test coverage detected