|
38 | 38 |
|
39 | 39 | def match_named_modules(
|
40 | 40 | model: torch.nn.Module,
|
41 |
| - targets: Iterable[str] | None, |
42 |
| - ignore: Iterable[str] | None = None, |
| 41 | + targets: Optional[Iterable[str]] = None, |
| 42 | + ignore: Optional[Iterable[str]] = None, |
43 | 43 | fused: Optional[FusedMappping] = None,
|
44 | 44 | warn_on_fail: bool = False,
|
45 | 45 | ) -> Generator[Tuple[str, torch.nn.Module]]:
|
@@ -77,8 +77,8 @@ def match_named_modules(
|
77 | 77 |
|
78 | 78 | def match_named_parameters(
|
79 | 79 | model: torch.nn.Module,
|
80 |
| - targets: Iterable[str] | None = None, |
81 |
| - ignore: Iterable[str] | None = None, |
| 80 | + targets: Optional[Iterable[str]] = None, |
| 81 | + ignore: Optional[Iterable[str]] = None, |
82 | 82 | fused: Optional[FusedMappping] = None,
|
83 | 83 | warn_on_fail: bool = False,
|
84 | 84 | ) -> Generator[Tuple[str, torch.nn.Module, torch.nn.Parameter]]:
|
@@ -158,8 +158,8 @@ def match_targets(
|
158 | 158 |
|
159 | 159 | def match_modules_set(
|
160 | 160 | model: torch.nn.Module,
|
161 |
| - targets: Iterable[str] | None = None, |
162 |
| - ignore: Iterable[str] | None = None, |
| 161 | + targets: Optional[Iterable[str]] = None, |
| 162 | + ignore: Optional[Iterable[str]] = None, |
163 | 163 | ) -> Generator[Iterable[torch.nn.Module]]:
|
164 | 164 | """
|
165 | 165 | Yields modules grouped with the same order and size as `targets`.
|
|
0 commit comments