Browse Source

fix(imperative/dtype): fix is_dtype_equal

GitOrigin-RevId: b097c9c3ca
tags/v1.3.0
Megvii Engine Team 4 years ago
parent
commit
1d4baa4284
1 changed files with 2 additions and 3 deletions
  1. +2
    -3
      imperative/python/src/numpy_dtypes.cpp

+ 2
- 3
imperative/python/src/numpy_dtypes.cpp View File

@@ -91,9 +91,8 @@ bool _is_dtype_equal(PyArray_Descr* dt1, PyArray_Descr* dt2) {
PyDict_GetItemString(dt1->metadata, "mgb_dtype"), "zero_point");
PyObject* zp2 = PyDict_GetItemString(
PyDict_GetItemString(dt2->metadata, "mgb_dtype"), "zero_point");
if (!zp1 || !zp2) {
throw py::key_error("zero_point");
}
if (!zp1 && !zp2) return true;
if (!zp1 || !zp2) return false;
return PyLong_AsLong(zp1) == PyLong_AsLong(zp2);
}
if (!q1 && !q2) {


Loading…
Cancel
Save