Unverified Commit 8dfcff74 authored by Philip Meier's avatar Philip Meier Committed by GitHub
Browse files

partially enable type checking for .models (#2668)

* partially enable mypy for .models

* fix existing errors

* ignore error instead of using Union
parent be0b6d96
......@@ -4,15 +4,23 @@ files = torchvision
show_error_codes = True
pretty = True
;[mypy-torchvision.datasets.*]
[mypy-torchvision.io._video_opt.*]
;ignore_errors = True
ignore_errors = True
[mypy-torchvision.io._video_opt.*]
[mypy-torchvision.io.*]
ignore_errors = True
[mypy-torchvision.models.detection.*]
ignore_errors = True
[mypy-torchvision.models.densenet.*]
ignore_errors = True
[mypy-torchvision.models.*]
[mypy-torchvision.models.quantization.*]
ignore_errors = True
......
......@@ -193,12 +193,11 @@ class GoogLeNet(nn.Module):
return x, aux2, aux1
@torch.jit.unused
def eager_outputs(self, x, aux2, aux1):
# type: (Tensor, Optional[Tensor], Optional[Tensor]) -> GoogLeNetOutputs
def eager_outputs(self, x: Tensor, aux2: Tensor, aux1: Optional[Tensor]) -> GoogLeNetOutputs:
if self.training and self.aux_logits:
return _GoogLeNetOutputs(x, aux2, aux1)
else:
return x
return x # type: ignore[return-value]
def forward(self, x):
# type: (Tensor) -> GoogLeNetOutputs
......
......@@ -188,12 +188,11 @@ class Inception3(nn.Module):
return x, aux
@torch.jit.unused
def eager_outputs(self, x, aux):
# type: (Tensor, Optional[Tensor]) -> InceptionOutputs
def eager_outputs(self, x: torch.Tensor, aux: Optional[Tensor]) -> InceptionOutputs:
if self.training and self.aux_logits:
return InceptionOutputs(x, aux)
else:
return x
return x # type: ignore[return-value]
def forward(self, x):
x = self._transform_input(x)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment