diff --git a/torch/csrc/autograd/python_torch_functions_manual.cpp b/torch/csrc/autograd/python_torch_functions_manual.cpp index 2817506ebdc..c36cf275a6b 100644 --- a/torch/csrc/autograd/python_torch_functions_manual.cpp +++ b/torch/csrc/autograd/python_torch_functions_manual.cpp @@ -279,6 +279,10 @@ static PyObject* THPVariable_get_device( ParsedArgs<1> parsed_args; auto r = parser.parse(args, kwargs, parsed_args); + if (r.has_torch_function()) { + return handle_torch_function( + r, nullptr, args, kwargs, THPVariableFunctionsModule, "torch"); + } if (r.idx == 0) { return wrap(r.tensor(0).get_device());