diff --git a/paddle/fluid/pybind/op_function_common.cc b/paddle/fluid/pybind/op_function_common.cc index 1d483abd7746c104c3f1dcf318f45850e4fcb855..614689b148cdae7adaaeebd290a76d6dccca00db 100644 --- a/paddle/fluid/pybind/op_function_common.cc +++ b/paddle/fluid/pybind/op_function_common.cc @@ -59,13 +59,15 @@ class OpAttrTypeMap { extern PyTypeObject* g_varbase_pytype; extern PyTypeObject* g_vartype_pytype; extern PyTypeObject* g_blockdesc_pytype; +extern PyTypeObject* p_tensor_type; bool PyObject_CheckBool(PyObject** obj) { return PyBool_Check(*obj); } bool PyObject_CheckLongOrToLong(PyObject** obj) { if ((PyLong_Check(*obj) && !PyBool_Check(*obj)) || PyObject_IsInstance(*obj, (PyObject*)g_vartype_pytype) || // NOLINT - PyObject_IsInstance(*obj, (PyObject*)g_varbase_pytype)) { // NOLINT + PyObject_IsInstance(*obj, (PyObject*)g_varbase_pytype) || // NOLINT + PyObject_IsInstance(*obj, (PyObject*)p_tensor_type)) { // NOLINT return true; }