From e81f28f09d819fa923cfe49d4a2d10861a0c099d Mon Sep 17 00:00:00 2001 From: wanghuancoder Date: Thu, 9 Jun 2022 09:46:12 +0800 Subject: [PATCH] [Eager] fix pylayer forward output code (#43331) * fix pylayer forward output code * refine --- paddle/fluid/pybind/eager_py_layer.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/paddle/fluid/pybind/eager_py_layer.cc b/paddle/fluid/pybind/eager_py_layer.cc index a0cef6388c1..55d9f972db8 100644 --- a/paddle/fluid/pybind/eager_py_layer.cc +++ b/paddle/fluid/pybind/eager_py_layer.cc @@ -240,6 +240,8 @@ PyObject* pylayer_method_apply(PyObject* cls, PyObject* args, PyObject* outputs_tuple = nullptr; if (PyTuple_Check(outputs)) { outputs_tuple = outputs; + } else if (PyList_Check(outputs)) { + outputs_tuple = PyList_AsTuple(outputs); } else { outputs_tuple = PyTuple_New(1); Py_INCREF(outputs); -- GitLab