diff --git a/torch/csrc/autograd/functions/utils.cpp b/torch/csrc/autograd/functions/utils.cpp index 485572d9ee812..a753492683617 100644 --- a/torch/csrc/autograd/functions/utils.cpp +++ b/torch/csrc/autograd/functions/utils.cpp @@ -50,7 +50,7 @@ void check_input_variables(const char* name, const variable_list& inputs, int ar for (int i = 0; i < required_args; ++i) { if (!inputs[i].defined()) { std::stringstream ss; - ss << name << ": expected Variable at argument " << i << " (got None)"; + ss << name << ": expected Tensor at argument " << i << " (got None)"; throw std::runtime_error(ss.str()); } } diff --git a/torch/csrc/utils/python_arg_parser.h b/torch/csrc/utils/python_arg_parser.h index d7c9114ecc58f..ac98098af80b3 100644 --- a/torch/csrc/utils/python_arg_parser.h +++ b/torch/csrc/utils/python_arg_parser.h @@ -176,7 +176,7 @@ inline at::Tensor PythonArgs::tensor(int i) { // a test for Py_None here; instead, you need to mark the argument // as *allowing none*; you can do this by writing 'Tensor?' instead // of 'Tensor' in the ATen metadata. - throw TypeError("expected Variable as argument %d, but got %s", i, + throw TypeError("expected Tensor as argument %d, but got %s", i, Py_TYPE(args[i])->tp_name); } return reinterpret_cast(args[i])->cdata; @@ -208,7 +208,7 @@ inline std::vector PythonArgs::tensorlist(int i) { for (int idx = 0; idx < size; idx++) { PyObject* obj = tuple ? PyTuple_GET_ITEM(arg, idx) : PyList_GET_ITEM(arg, idx); if (!THPVariable_Check(obj)) { - throw TypeError("expected Variable as element %d in argument %d, but got %s", + throw TypeError("expected Tensor as element %d in argument %d, but got %s", idx, i, Py_TYPE(args[i])->tp_name); } res[idx] = reinterpret_cast(obj)->cdata; @@ -229,7 +229,7 @@ inline std::array PythonArgs::tensorlist_n(int i) { for (int idx = 0; idx < size; idx++) { PyObject* obj = tuple ? PyTuple_GET_ITEM(arg, idx) : PyList_GET_ITEM(arg, idx); if (!THPVariable_Check(obj)) { - throw TypeError("expected Variable as element %d in argument %d, but got %s", + throw TypeError("expected Tensor as element %d in argument %d, but got %s", idx, i, Py_TYPE(args[i])->tp_name); } res[idx] = reinterpret_cast(obj)->cdata;