diff --git a/torch/_C/__init__.pyi.in b/torch/_C/__init__.pyi.in index 66ecec5fe0e..5bbecdb1125 100644 --- a/torch/_C/__init__.pyi.in +++ b/torch/_C/__init__.pyi.in @@ -831,7 +831,7 @@ class Generator(object): # Defined in torch/csrc/utils/python_dispatch.cpp -def _dispatch_library(kind: str, name: str, dispatch: str, file: str, linenum: Any) -> Any: ... +def _dispatch_library(kind: str, name: str, dispatch: str, file: str = "", linenum: Any = 0) -> Any: ... # Defined in torch/csrc/utils/init.cpp class BenchmarkConfig(object): diff --git a/torch/_python_dispatcher.py b/torch/_python_dispatcher.py index f886a85efd3..ee2c7d27945 100644 --- a/torch/_python_dispatcher.py +++ b/torch/_python_dispatcher.py @@ -66,7 +66,7 @@ class PythonDispatcher: def __init__(self): C._dispatch_check_invariants(self.name) # type: ignore[attr-defined] - self.ref = C._dispatch_library("FRAGMENT", self.namespace, "") # type: ignore[attr-defined] + self.ref = C._dispatch_library("FRAGMENT", self.namespace, "") self.ref.def_("foo(Tensor x) -> Tensor") """