未验证 提交 033b2748 编写于 作者: Z zhangbo9674 提交者: GitHub

fix python c bug for eager tensor (#41158)

上级 08c3edb3
...@@ -59,13 +59,15 @@ class OpAttrTypeMap { ...@@ -59,13 +59,15 @@ class OpAttrTypeMap {
extern PyTypeObject* g_varbase_pytype; extern PyTypeObject* g_varbase_pytype;
extern PyTypeObject* g_vartype_pytype; extern PyTypeObject* g_vartype_pytype;
extern PyTypeObject* g_blockdesc_pytype; extern PyTypeObject* g_blockdesc_pytype;
extern PyTypeObject* p_tensor_type;
bool PyObject_CheckBool(PyObject** obj) { return PyBool_Check(*obj); } bool PyObject_CheckBool(PyObject** obj) { return PyBool_Check(*obj); }
bool PyObject_CheckLongOrToLong(PyObject** obj) { bool PyObject_CheckLongOrToLong(PyObject** obj) {
if ((PyLong_Check(*obj) && !PyBool_Check(*obj)) || if ((PyLong_Check(*obj) && !PyBool_Check(*obj)) ||
PyObject_IsInstance(*obj, (PyObject*)g_vartype_pytype) || // NOLINT 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; return true;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册