From 27bfe53b56a52c12884bc48127943f3bc6fe228b Mon Sep 17 00:00:00 2001 From: Megvii Engine Team Date: Thu, 21 Jul 2022 14:24:59 +0800 Subject: [PATCH] fix(imperative/dtype): make tensor.dtype instanceof np.dtype GitOrigin-RevId: fbb6d0439b6d2a133d7d2c2c7d42e0e6d8a8cff2 --- imperative/python/src/helper.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/imperative/python/src/helper.cpp b/imperative/python/src/helper.cpp index 7f38403b5..ede45bd76 100644 --- a/imperative/python/src/helper.cpp +++ b/imperative/python/src/helper.cpp @@ -675,12 +675,8 @@ PyObject* dtype_mgb2np(mgb::DType dtype) { Py_XINCREF(Py_None); return Py_None; } - if (dtype.has_param()) { - return reinterpret_cast(descr.release()); - } - PyObject* typeobj = reinterpret_cast(descr->typeobj); - Py_XINCREF(typeobj); - return typeobj; + // NOTE: the following is additional + return reinterpret_cast(descr.release()); } mgb::DType dtype_np2mgb(PyObject* obj) { -- GitLab