未验证 提交 d19e2662 编写于 作者: C Chen Weihang 提交者: GitHub

clear old var in scope, test=develop (#24976) (#25261)

上级 556be6d7
...@@ -198,7 +198,11 @@ class RunProgramOpKernel : public framework::OpKernel<T> { ...@@ -198,7 +198,11 @@ class RunProgramOpKernel : public framework::OpKernel<T> {
auto exe_ctx = exe.Prepare(*program, 0, skip_vars); auto exe_ctx = exe.Prepare(*program, 0, skip_vars);
// get scope and clear old vars
framework::Scope &scope = *(out_scope_vec->front()); framework::Scope &scope = *(out_scope_vec->front());
auto local_vars = scope.LocalVarNames();
scope.EraseVars(local_vars);
// share input_vars & parameters into scope // share input_vars & parameters into scope
details::ShareVarsIntoScope(input_vars, input_var_names, &scope); details::ShareVarsIntoScope(input_vars, input_var_names, &scope);
details::ShareVarsIntoScope(param_vars, param_names, &scope); details::ShareVarsIntoScope(param_vars, param_names, &scope);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册