Skip to content

Fixed typing exception throwing issues with JIT #3029

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ ignore_errors = True

ignore_errors = True

[mypy-torchvision.models.densenet.*]

ignore_errors=True

[mypy-torchvision.models.detection.*]

ignore_errors = True
Expand Down
6 changes: 3 additions & 3 deletions torchvision/models/densenet.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ def closure(*inputs):
def forward(self, input: List[Tensor]) -> Tensor:
pass

@torch.jit._overload_method # type: ignore[no-redef] # noqa: F811
@torch.jit._overload_method # noqa: F811
def forward(self, input: Tensor) -> Tensor:
pass

# torchscript does not yet support *args, so we overload method
# allowing it to take either a List[Tensor] or single Tensor
def forward(self, input: Tensor) -> Tensor: # type: ignore[no-redef] # noqa: F811
def forward(self, input: Tensor) -> Tensor: # noqa: F811
if isinstance(input, Tensor):
prev_features = [input]
else:
Expand Down Expand Up @@ -121,7 +121,7 @@ def __init__(
)
self.add_module('denselayer%d' % (i + 1), layer)

def forward(self, init_features: Tensor) -> Tensor: # type: ignore[override]
def forward(self, init_features: Tensor) -> Tensor:
features = [init_features]
for name, layer in self.items():
new_features = layer(features)
Expand Down