From c76e80bc8e949e24e185e7eebf8164daaae69a75 Mon Sep 17 00:00:00 2001 From: Megvii Engine Team Date: Tue, 14 Jun 2022 11:09:52 +0800 Subject: [PATCH] fix(mge): fix mem leak of numpy method of DeviceTensorND GitOrigin-RevId: 06082145f6f6eff2cf5d7783a3b0ad021bee721d --- imperative/python/src/common.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imperative/python/src/common.cpp b/imperative/python/src/common.cpp index 6947625d..5f0d1ffe 100644 --- a/imperative/python/src/common.cpp +++ b/imperative/python/src/common.cpp @@ -142,7 +142,7 @@ void init_common(py::module m) { .def("numpy", [](const DeviceTensorND& self) { HostTensorND hv; hv.copy_from(self).sync(); - return py::handle( + return py::reinterpret_steal( npy::ndarray_from_tensor(hv, npy::ShareType::TRY_SHARE)); });