MCPcopy Create free account
hub / github.com/pytorch/pytorch / test_section

Method test_section

test/jit/test_script_profile.py:81–105  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

79 last = stats
80
81 def test_section(self):
82 seq = Sequence()
83
84 @torch.jit.script
85 def fn():
86 p = torch.jit._ScriptProfile()
87 p.enable()
88 _ = seq(torch.rand((10, 100)))
89 p.disable()
90 stats0 = p.dump_string()
91
92 _ = seq(torch.rand((10, 10)))
93 stats1 = p.dump_string()
94
95 p.enable()
96 _ = seq(torch.rand((10, 10)))
97 p.disable()
98 stats2 = p.dump_string()
99
100 p.enable()
101 return stats0, stats1, stats2
102
103 s0, s1, s2 = fn()
104 self.assertEqual(s0, s1)
105 self.assertNotEqual(s1, s2)
106
107 def test_empty(self):
108 p = torch.jit._ScriptProfile()

Callers

nothing calls this directly

Calls 4

assertNotEqualMethod · 0.80
SequenceClass · 0.70
fnFunction · 0.50
assertEqualMethod · 0.45

Tested by

no test coverage detected