Skip to content

Commit 3756b60

Browse files
authored
Added annotation typing to models._utils (#2854)
* style: Added typing in models._utils * fix: Removed non-necessary import * fix: Removed type annotation of forward method * refactor: Removed un-necessary import
1 parent 8a0434d commit 3756b60

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

torchvision/models/_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import torch
44
from torch import nn
5-
from torch.jit.annotations import Dict
5+
from typing import Dict
66

77

88
class IntermediateLayerGetter(nn.ModuleDict):
@@ -41,7 +41,7 @@ class IntermediateLayerGetter(nn.ModuleDict):
4141
"return_layers": Dict[str, str],
4242
}
4343

44-
def __init__(self, model, return_layers):
44+
def __init__(self, model: nn.Module, return_layers: Dict[str, str]):
4545
if not set(return_layers).issubset([name for name, _ in model.named_children()]):
4646
raise ValueError("return_layers are not present in model")
4747
orig_return_layers = return_layers

0 commit comments

Comments
 (0)