Skip to content

Commit 99e7370

Browse files
author
root
committed
Update on "extend torch.jit._overload to module methods"
Follow up to #23886, add the same overload api specified in PEP 484 to module methods to reduce the friction of adding method overloads that was brought up in #23266. The usage is: ``` @torch.jit.overload def add(self, y: int) -> int: ... @torch.jit.overload def add(self, y: float) -> float: ... def add(): ... ```
1 parent 940597e commit 99e7370

File tree

1 file changed

+0
-8
lines changed

1 file changed

+0
-8
lines changed

torch/_jit_internal.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -278,14 +278,6 @@ def _get_fn_overloads(qual_name):
278278
def _clear_fn_overloads(qual_name):
279279
del _overloaded_fns[qual_name]
280280

281-
# overloading registration
282-
# overloads get registered in this file, and compiled in torch/jit/__init__.py
283-
# so that they can be imported in nn/functional.py without an import cycle
284-
285-
# qualified_name => list[overload_functions]
286-
287-
_overloaded_fns = {} # noqa: T484
288-
289281
def get_class_name(method):
290282
current_frame = sys._current_frames()[threading.currentThread().ident]
291283

0 commit comments

Comments
 (0)