From fe6a8409241f69d52661e555fb02a1e1daca3cf7 Mon Sep 17 00:00:00 2001 From: Qiao Longfei Date: Thu, 7 Mar 2019 11:41:55 +0800 Subject: [PATCH] fix delete recv ops --- .../framework/details/async_ssa_graph_executor.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/paddle/fluid/framework/details/async_ssa_graph_executor.cc b/paddle/fluid/framework/details/async_ssa_graph_executor.cc index 3f4d9f6ca42..e7cc14b0d15 100644 --- a/paddle/fluid/framework/details/async_ssa_graph_executor.cc +++ b/paddle/fluid/framework/details/async_ssa_graph_executor.cc @@ -48,9 +48,9 @@ void ProcessGraph(std::vector graphs, Scope *scope) { RpcCtxMap send_varname_to_ctx; RpcCtxMap recv_varname_to_ctx; for (auto i = 0; i < graphs.size(); ++i) { + std::vector nodes_to_delete; for (auto &node : graphs[i]->Nodes()) { VLOG(3) << "node name " << node->Name(); - std::vector nodes_to_delete; if (node && node->IsOp()) { if (node->Name() == "send") { auto send_var_name = node->Op()->Input("X")[0]; @@ -78,12 +78,12 @@ void ProcessGraph(std::vector graphs, Scope *scope) { VLOG(3) << "find and remove an recv op: " << recv_varname_to_ctx[recv_var_name]; } - VLOG(3) << "delete all recv ops"; - for (auto *node : nodes_to_delete) { - graphs[i]->RemoveNode(node); - } } } + VLOG(3) << "delete all recv ops"; + for (auto *node : nodes_to_delete) { + graphs[i]->RemoveNode(node); + } } // init communicator here if (send_varname_to_ctx.size() > 0) { -- GitLab