diff --git a/paddle/fluid/pybind/op_function_common.cc b/paddle/fluid/pybind/op_function_common.cc index 25dbf5ebb2f624c9d92c58146388aa29e6c85eaf..2f1408257ff1b9794ed52c91828aae81505834d7 100644 --- a/paddle/fluid/pybind/op_function_common.cc +++ b/paddle/fluid/pybind/op_function_common.cc @@ -87,7 +87,8 @@ bool PyObject_CheckLongOrToLong(PyObject** obj) { bool PyObject_CheckFloatOrToFloat(PyObject** obj) { // sometimes users provide PyLong or numpy.int64 but attr is float if (PyFloat_Check(*obj) || PyLong_Check(*obj) || - 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; } if (std::string(((PyTypeObject*)(*obj)->ob_type)->tp_name) // NOLINT