From c572c2128f2a22853937ae3823dbf94003ec559d Mon Sep 17 00:00:00 2001 From: frgfm Date: Thu, 22 Oct 2020 21:28:10 +0200 Subject: [PATCH 1/4] fix: Fixed constructor typing in models._utils --- torchvision/models/_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/torchvision/models/_utils.py b/torchvision/models/_utils.py index 7d8008c4f27..928a6f1c559 100644 --- a/torchvision/models/_utils.py +++ b/torchvision/models/_utils.py @@ -41,7 +41,7 @@ class IntermediateLayerGetter(nn.ModuleDict): "return_layers": Dict[str, str], } - def __init__(self, model: nn.Module, return_layers: Dict[str, str]): + def __init__(self, model: nn.Module, return_layers: Dict[str, str]) -> None: if not set(return_layers).issubset([name for name, _ in model.named_children()]): raise ValueError("return_layers are not present in model") orig_return_layers = return_layers From 0f09235c04065d3f3b0e3b1ad79405f6e5a65bf5 Mon Sep 17 00:00:00 2001 From: frgfm Date: Thu, 22 Oct 2020 21:28:17 +0200 Subject: [PATCH 2/4] fix: Fixed constructor typing in models.alexnet --- torchvision/models/alexnet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/torchvision/models/alexnet.py b/torchvision/models/alexnet.py index e2ec53d9a82..e679c679aa0 100644 --- a/torchvision/models/alexnet.py +++ b/torchvision/models/alexnet.py @@ -14,7 +14,7 @@ class AlexNet(nn.Module): - def __init__(self, num_classes: int = 1000): + def __init__(self, num_classes: int = 1000) -> None: super(AlexNet, self).__init__() self.features = nn.Sequential( nn.Conv2d(3, 64, kernel_size=11, stride=4, padding=2), From 8ae2bbf8fb44045bd8fa46d76de7116aaa045ba1 Mon Sep 17 00:00:00 2001 From: frgfm Date: Thu, 22 Oct 2020 21:28:25 +0200 Subject: [PATCH 3/4] fix: Fixed constructor typing in models.mnasnet --- torchvision/models/mnasnet.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/torchvision/models/mnasnet.py b/torchvision/models/mnasnet.py index 34fce9c07cc..9888d661bab 100644 --- a/torchvision/models/mnasnet.py +++ b/torchvision/models/mnasnet.py @@ -32,7 +32,7 @@ def __init__( stride: int, expansion_factor: int, bn_momentum: float = 0.1 - ): + ) -> None: super(_InvertedResidual, self).__init__() assert stride in [1, 2] assert kernel_size in [3, 5] @@ -109,7 +109,7 @@ def __init__( alpha: float, num_classes: int = 1000, dropout: float = 0.2 - ): + ) -> None: super(MNASNet, self).__init__() assert alpha > 0.0 self.alpha = alpha From be608126ec5e51d92994e37943a7ba6ec1329270 Mon Sep 17 00:00:00 2001 From: frgfm Date: Thu, 22 Oct 2020 21:28:32 +0200 Subject: [PATCH 4/4] fix: Fixed constructor typing in models.squeezenet --- torchvision/models/squeezenet.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/torchvision/models/squeezenet.py b/torchvision/models/squeezenet.py index 82448516c03..603eaa04a74 100644 --- a/torchvision/models/squeezenet.py +++ b/torchvision/models/squeezenet.py @@ -20,7 +20,7 @@ def __init__( squeeze_planes: int, expand1x1_planes: int, expand3x3_planes: int - ): + ) -> None: super(Fire, self).__init__() self.inplanes = inplanes self.squeeze = nn.Conv2d(inplanes, squeeze_planes, kernel_size=1) @@ -46,7 +46,7 @@ def __init__( self, version: str = '1_0', num_classes: int = 1000 - ): + ) -> None: super(SqueezeNet, self).__init__() self.num_classes = num_classes if version == '1_0':