[BE] [1/3] Rewrite super() calls in caffe2 and benchmarks (#94587)

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/94587
Approved by: https://github.com/ezyang
This commit is contained in:
Xuehai Pan
2023-02-11 18:19:44 +00:00
committed by PyTorch MergeBot
parent aa6f0ace2f
commit 8d45f555d7
97 changed files with 207 additions and 239 deletions

View File

@ -15,9 +15,6 @@ def scriptAndSave(module, fileName):
print('=' * 80)
class Test(torch.jit.ScriptModule):
def __init__(self):
super(Test, self).__init__()
@torch.jit.script_method
def forward(self, input):
return None