未验证 提交 fd1c0d7f 编写于 作者: S ShenLiang 提交者: GitHub

[BugFix]Fix tuple output bug of pylayer (#48533)

* fix bug of pylayer

* fix bug
上级 91af6df8
...@@ -445,11 +445,14 @@ PyObject* pylayer_method_apply(PyObject* cls, ...@@ -445,11 +445,14 @@ PyObject* pylayer_method_apply(PyObject* cls,
} }
if (outputs_size == 1) { if (outputs_size == 1) {
if (!PyTuple_Check(outputs) && !PyList_Check(outputs)) {
Py_XDECREF(outputs); Py_XDECREF(outputs);
outputs = PyTuple_GetItem(outputs_tuple, 0); outputs = PyTuple_GetItem(outputs_tuple, 0);
Py_INCREF(outputs); Py_INCREF(outputs);
Py_XDECREF(outputs_tuple); Py_XDECREF(outputs_tuple);
} }
}
Py_XDECREF(forward_args); Py_XDECREF(forward_args);
Py_XDECREF(kwargs_value_list); Py_XDECREF(kwargs_value_list);
Py_XDECREF(backward_function); Py_XDECREF(backward_function);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册