From fdb719a1bf01e01bb639370b701e7f7d30fbd145 Mon Sep 17 00:00:00 2001 From: liuwei1031 <46661762+liuwei1031@users.noreply.github.com> Date: Tue, 9 Apr 2019 23:11:54 +0800 Subject: [PATCH] avoid optimize variable used in subblock, test=develop (#16739) --- paddle/fluid/framework/details/inplace_op_pass.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/paddle/fluid/framework/details/inplace_op_pass.cc b/paddle/fluid/framework/details/inplace_op_pass.cc index a47542534c8..84c9e4a379a 100644 --- a/paddle/fluid/framework/details/inplace_op_pass.cc +++ b/paddle/fluid/framework/details/inplace_op_pass.cc @@ -533,6 +533,9 @@ void GraphView::Build(ir::Graph* g) { }; for (auto& node : g->Nodes()) { if (!node->IsOp()) continue; + // avoid optimize the variable used in sub-blocks + if (OpHasSubBlock(node->Op())) update_skip_set(node); + if (node->Name() == "send") update_skip_set(node); if (node->Name() == "recv") update_skip_set(node); if (node->Name() == "prefetch") update_skip_set(node); -- GitLab