Skip to content

Commit

Permalink
Replace Variables to Tensors (pytorch#8309)
Browse files Browse the repository at this point in the history
  • Loading branch information
vishwakftw authored and weiyangfb committed Jun 11, 2018
1 parent 637f842 commit 36a2076
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion torch/csrc/autograd/functions/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
Expand Down
6 changes: 3 additions & 3 deletions torch/csrc/utils/python_arg_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<THPVariable*>(args[i])->cdata;
Expand Down Expand Up @@ -208,7 +208,7 @@ inline std::vector<at::Tensor> 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<THPVariable*>(obj)->cdata;
Expand All @@ -229,7 +229,7 @@ inline std::array<at::Tensor, N> 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<THPVariable*>(obj)->cdata;
Expand Down

0 comments on commit 36a2076

Please sign in to comment.