未验证 提交 a5627df3 编写于 作者: W Wilber 提交者: GitHub

fix mem release error. (#32655)

后续修复计划是啥
上级 7ae0a80f
...@@ -191,22 +191,8 @@ bool AnalysisPredictor::PrepareScope( ...@@ -191,22 +191,8 @@ bool AnalysisPredictor::PrepareScope(
status_is_cloned_ = true; status_is_cloned_ = true;
} else { } else {
paddle::framework::InitDevices(); paddle::framework::InitDevices();
scope_.reset(new paddle::framework::Scope(), [](framework::Scope *scope) { // TODO(wilber): we need to release memory occupied by weights.
delete scope; scope_.reset(new paddle::framework::Scope());
#if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP)
for (int dev_id = 0; dev_id < paddle::platform::GetCUDADeviceCount();
++dev_id) {
memory::Release(platform::CUDAPlace(dev_id));
}
#endif
#ifdef PADDLE_WITH_XPU
for (int dev_id = 0; dev_id < paddle::platform::GetXPUDeviceCount();
++dev_id) {
memory::Release(platform::XPUPlace(dev_id));
}
#endif
memory::Release(platform::CPUPlace());
});
status_is_cloned_ = false; status_is_cloned_ = false;
} }
sub_scope_ = &scope_->NewScope(); sub_scope_ = &scope_->NewScope();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册