From 5179853ac91618a77df59bbd36e9ecfbc7a7d995 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=98=8E=E5=86=AC?= <78149749+winter-wang@users.noreply.github.com> Date: Thu, 22 Jul 2021 10:54:02 +0800 Subject: [PATCH] [pass_enhance]fix the positon error in map_matmuil_to_mul_pass, test=develop (#34303) --- paddle/fluid/framework/ir/map_matmul_to_mul_pass.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/paddle/fluid/framework/ir/map_matmul_to_mul_pass.cc b/paddle/fluid/framework/ir/map_matmul_to_mul_pass.cc index 9542d3d3d4..6137682847 100644 --- a/paddle/fluid/framework/ir/map_matmul_to_mul_pass.cc +++ b/paddle/fluid/framework/ir/map_matmul_to_mul_pass.cc @@ -191,11 +191,6 @@ void MapMatmul2MulPass::ApplyImpl(ir::Graph* graph) const { int found_count = 0; auto handler = [&](const GraphPatternDetector::subgraph_t& subgraph, Graph* g) { - if (!IsCompat(subgraph, g)) { - LOG(WARNING) << "Pass in op compat failed."; - return; - } - VLOG(4) << "map matmul to mul"; GET_IR_NODE_FROM_SUBGRAPH(matmul_in_x, matmul_in_x, matmul_pattern); GET_IR_NODE_FROM_SUBGRAPH(matmul_in_y, matmul_in_y, matmul_pattern); @@ -221,6 +216,10 @@ void MapMatmul2MulPass::ApplyImpl(ir::Graph* graph) const { next_ops[0]->Name() == "elementwise_add"; if (flag) { + if (!IsCompat(subgraph, g)) { + LOG(WARNING) << "Pass in op compat failed."; + return; + } OpDesc desc; desc.SetType("mul"); desc.SetInput("X", {matmul_in_x->Name()}); -- GitLab