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