Skip to content

Added annotation typing to models._utils #2854

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 5 commits into from
Oct 22, 2020
Merged
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: 2 additions & 2 deletions torchvision/models/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import torch
from torch import nn
from torch.jit.annotations import Dict
from typing import Dict


class IntermediateLayerGetter(nn.ModuleDict):
Expand Down Expand Up @@ -41,7 +41,7 @@ class IntermediateLayerGetter(nn.ModuleDict):
"return_layers": Dict[str, str],
}

def __init__(self, model, return_layers):
def __init__(self, model: nn.Module, return_layers: Dict[str, str]):
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
Expand Down