未验证 提交 f8202941 编写于 作者: Z zyfncg 提交者: GitHub

fix memory leak problen of set_value op (#38098)

* fix bug of set_value op

* fix BumpInplaceVersion

* polish some comments

* revert change of full_like
上级 f9f32b41
......@@ -970,6 +970,11 @@ void BindImperative(py::module *m_ptr) {
}
};
// NOTE(liym27):
// Increase the version of VarBase self because __setitem__ is an
// inplace operator for the VarBase self.
self->BumpInplaceVersion();
// 1. Check argumnets
bool parse_index = true;
......@@ -1137,10 +1142,6 @@ void BindImperative(py::module *m_ptr) {
SetTensorFromPyArray(self_tensor, self_numpy,
self_tensor->place(), false);
}
// NOTE(liym27):
// Increase the version of VarBase self because __setitem__ is an
// inplace operator for the VarBase self.
self->BumpInplaceVersion();
})
.def("_getitem_index_not_tensor",
[](std::shared_ptr<imperative::VarBase> &self, py::handle _index) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册