提交 97178868 编写于 作者: M Megvii Engine Team

fix(imperative/dtype): use envvar to control behavior

GitOrigin-RevId: 8f11fa0c7e0ffec8f3dd9c7003fa9bebf8961e2b
上级 27bfe53b
......@@ -675,8 +675,17 @@ PyObject* dtype_mgb2np(mgb::DType dtype) {
Py_XINCREF(Py_None);
return Py_None;
}
// NOTE: the following is additional
static bool use_typeobj_as_dtype = MGB_GETENV("MGE_USE_TYPEOBJ_AS_DTYPE");
if (use_typeobj_as_dtype) {
if (dtype.has_param()) {
return reinterpret_cast<PyObject*>(descr.release());
}
PyObject* typeobj = reinterpret_cast<PyObject*>(descr->typeobj);
Py_XINCREF(typeobj);
return typeobj;
} else {
return reinterpret_cast<PyObject*>(descr.release());
}
}
mgb::DType dtype_np2mgb(PyObject* obj) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册