未验证 提交 3030e8c2 编写于 作者: W WangXi 提交者: GitHub

fix lod_tensor_array gc (#42377)

上级 24ec6ed0
...@@ -156,6 +156,9 @@ void DeleteUnusedTensors(const Scope &scope, ...@@ -156,6 +156,9 @@ void DeleteUnusedTensors(const Scope &scope,
for (auto &t : *lod_tensor_arr) { for (auto &t : *lod_tensor_arr) {
garbages.emplace_back(t.MoveMemoryHolder()); garbages.emplace_back(t.MoveMemoryHolder());
} }
// NOTE(wangxi): need clear the vector, otherwise lod_tensor_arr.size() is
// wrong, if size() decrease in next step, an error maybe occur.
lod_tensor_arr->clear();
} else if (var->IsType<Strings>()) { } else if (var->IsType<Strings>()) {
} else { } else {
PADDLE_THROW(platform::errors::Unimplemented( PADDLE_THROW(platform::errors::Unimplemented(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册