This website works better with JavaScript.
Home
Issues
Pull Requests
Milestones
Repositories
Datasets
Forum
实训
竞赛
大数据
应用
Register
Sign In
OpenI
/
MegEngine
Not watched
Unwatch
Watch all
Watch but not notify
1
Star
0
Fork
0
Code
Releases
31
Wiki
Activity
Issues
0
Pull Requests
0
Datasets
Model
Cloudbrain
Browse Source
fix(mge/tensor): fix mem leak when getting value in trace
GitOrigin-RevId:
1dabd88e09
release-1.2
Megvii Engine Team
4 years ago
parent
3a4e0598ba
commit
e0fffa5286
2 changed files
with
4 additions
and
3 deletions
Split View
Diff Options
Show Stats
Download Patch File
Download Diff File
+1
-2
imperative/python/megengine/jit/tracing.py
+3
-1
imperative/python/src/tensor.cpp
+ 1
- 2
imperative/python/megengine/jit/tracing.py
View File
@@ -1002,8 +1002,7 @@ class CompiledTensorProxy:
else:
# c++ will throw TraceReadError
return None
if self._isscalar:
self.__value = self.__value.squeeze()
# c++ side will handle scalar case
return self.__value
def _dev_tensor(self):
+ 3
- 1
imperative/python/src/tensor.cpp
View File
@@ -393,7 +393,9 @@ PyObject* TensorWrapper::numpy() {
throw TraceReadError("value of this tensor is not read in trace");
}
if (m_tensor->m_flags & Tensor::Flags::SCALAR) {
np_val = PyArray_Squeeze(reinterpret_cast<PyArrayObject*>(np_val));
PyObject *np_scalar = PyArray_Squeeze(reinterpret_cast<PyArrayObject*>(np_val));
Py_DECREF(np_val);
return np_scalar;
}
return np_val;
}
Write
Preview
Loading…
Cancel
Save