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

fix(mge/functional): fix illegal memory access

GitOrigin-RevId: 8a965ddfbf4c51c96f10414e727f1d78b07bf20d
上级 95b2a36f
......@@ -427,8 +427,8 @@ py::object _astype_cpp(py::handle tensor, py::handle dtype_hdl) {
"can not convert to numpy.dtype from %s",
dtype_hdl.ptr()->ob_type->tp_name));
}
PyArray_Descr* cur = npy::dtype_mgb2np_descr(_get_dtype(tensor)).get();
if (!dtype_equal(cur, descr)) {
auto&& cur = npy::dtype_mgb2np_descr(_get_dtype(tensor));
if (!dtype_equal(cur.get(), descr)) {
std::shared_ptr<OpDef> op = TypeCvt::make(npy::dtype_np2mgb_descr(descr));
py::object Op = py::cast(op);
PyObject* p[2] = {Op.ptr(), tensor.ptr()};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册