From a6985c09cbc750cc3e097dbe9748f6aaf8ddf0f2 Mon Sep 17 00:00:00 2001 From: Oguz Ulgen Date: Thu, 1 Aug 2024 00:22:47 -0700 Subject: [PATCH] Add None return type to init -- functorch and torchgen (#132351) Pull Request resolved: https://github.com/pytorch/pytorch/pull/132351 Approved by: https://github.com/jamesjwu ghstack dependencies: #132335 --- functorch/dim/reference.py | 2 +- functorch/examples/compilation/fuse_module.py | 2 +- functorch/examples/maml_regression/evjang_transforms_module.py | 2 +- torchgen/_autoheuristic/pad_mm/train_pad_mm.py | 2 +- torchgen/_autoheuristic/train.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/functorch/dim/reference.py b/functorch/dim/reference.py index a7cec06aa65..ed7275bf666 100644 --- a/functorch/dim/reference.py +++ b/functorch/dim/reference.py @@ -383,7 +383,7 @@ _orig_getitem = torch.Tensor.__getitem__ class dim_tracker: - def __init__(self): + def __init__(self) -> None: self.dims = llist() self.count = [] diff --git a/functorch/examples/compilation/fuse_module.py b/functorch/examples/compilation/fuse_module.py index a0eb6034771..3e3c64d1da7 100644 --- a/functorch/examples/compilation/fuse_module.py +++ b/functorch/examples/compilation/fuse_module.py @@ -23,7 +23,7 @@ def run(mod, input): class Foo(nn.Module): - def __init__(self): + def __init__(self) -> None: super().__init__() self.param = nn.Parameter(torch.randn(1)) self.register_buffer("buf", torch.randn(1)) diff --git a/functorch/examples/maml_regression/evjang_transforms_module.py b/functorch/examples/maml_regression/evjang_transforms_module.py index b5fac551122..46235cab27e 100644 --- a/functorch/examples/maml_regression/evjang_transforms_module.py +++ b/functorch/examples/maml_regression/evjang_transforms_module.py @@ -18,7 +18,7 @@ mpl.use("Agg") class ThreeLayerNet(nn.Module): - def __init__(self): + def __init__(self) -> None: super().__init__() self.fc1 = nn.Linear(1, 40) self.relu1 = nn.ReLU() diff --git a/torchgen/_autoheuristic/pad_mm/train_pad_mm.py b/torchgen/_autoheuristic/pad_mm/train_pad_mm.py index d25978762dd..5417a099772 100644 --- a/torchgen/_autoheuristic/pad_mm/train_pad_mm.py +++ b/torchgen/_autoheuristic/pad_mm/train_pad_mm.py @@ -11,7 +11,7 @@ from torch._inductor.fx_passes.pad_mm import pad_mm_operations class AHTrainPadMM(AHTrain): - def __init__(self): + def __init__(self) -> None: super().__init__() def add_new_features(self, results): diff --git a/torchgen/_autoheuristic/train.py b/torchgen/_autoheuristic/train.py index a0ab37d8065..f79d4703fb1 100644 --- a/torchgen/_autoheuristic/train.py +++ b/torchgen/_autoheuristic/train.py @@ -33,7 +33,7 @@ class AHTrain: torch/_inductor/autoheuristic/artifacts/ directory. """ - def __init__(self): + def __init__(self) -> None: self.parser = argparse.ArgumentParser() self.add_base_arguments() self.args = None