mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Rewrite Python built-in class `super()` calls. Only non-semantic changes should be applied. - #94587 - #94588 - #94592 Also, methods with only a `super()` call are removed: ```diff class MyModule(nn.Module): - def __init__(self): - super().__init__() - def forward(self, ...): ... ``` Some cases that change the semantics should be kept unchanged. E.g.:f152a79be9/caffe2/python/net_printer.py (L184-L190)
f152a79be9/test/test_jit_fuser_te.py (L2628-L2635)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/94592 Approved by: https://github.com/ezyang, https://github.com/seemethere
21 lines
641 B
Python
21 lines
641 B
Python
# Owner(s): ["module: intel"]
|
|
|
|
import torch
|
|
import unittest
|
|
from torch.testing._internal.common_utils import TestCase, run_tests, load_tests
|
|
|
|
# load_tests from common_utils is used to automatically filter tests for
|
|
# sharding on sandcastle. This line silences flake warnings
|
|
load_tests = load_tests
|
|
|
|
@unittest.skipIf(not torch.profiler.itt.is_available(), "ITT is required")
|
|
class TestItt(TestCase):
|
|
def test_itt(self):
|
|
# Just making sure we can see the symbols
|
|
torch.profiler.itt.range_push("foo")
|
|
torch.profiler.itt.mark("bar")
|
|
torch.profiler.itt.range_pop()
|
|
|
|
if __name__ == '__main__':
|
|
run_tests()
|