From 77a5b8b031c9c0b27ced9e5398faa75a709bf1d5 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: Wed, 7 Jul 2021 18:55:06 +0800 Subject: [PATCH] fix some errors about pass enhance, test=develop (#33993) --- .../fluid/framework/ir/conv_elementwise_add2_act_fuse_pass.cc | 3 ++- .../fluid/framework/ir/mkldnn/conv_bias_mkldnn_fuse_pass.cc | 2 +- paddle/fluid/framework/ir/squared_mat_sub_fuse_pass.cc | 4 ++-- paddle/fluid/operators/compat/batch_norm.pbtxt | 4 ---- paddle/fluid/operators/compat/relu.pbtxt | 4 ++++ 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/paddle/fluid/framework/ir/conv_elementwise_add2_act_fuse_pass.cc b/paddle/fluid/framework/ir/conv_elementwise_add2_act_fuse_pass.cc index f2a295694dc..573436d393b 100644 --- a/paddle/fluid/framework/ir/conv_elementwise_add2_act_fuse_pass.cc +++ b/paddle/fluid/framework/ir/conv_elementwise_add2_act_fuse_pass.cc @@ -91,7 +91,8 @@ ConvElementwiseAdd2ActFusePass::ConvElementwiseAdd2ActFusePass() { .End() .AddAttr("axis") // the first elementwise_add-axis needs to be 1, the second has to be -1 - .IsIntIn({1, -1}) + // or 0 + .IsIntIn({1, -1, 0}) .End(); AddOpCompat(OpCompat("relu")) diff --git a/paddle/fluid/framework/ir/mkldnn/conv_bias_mkldnn_fuse_pass.cc b/paddle/fluid/framework/ir/mkldnn/conv_bias_mkldnn_fuse_pass.cc index efad207e172..74bbe24eb82 100644 --- a/paddle/fluid/framework/ir/mkldnn/conv_bias_mkldnn_fuse_pass.cc +++ b/paddle/fluid/framework/ir/mkldnn/conv_bias_mkldnn_fuse_pass.cc @@ -70,7 +70,7 @@ ConvBiasFusePass::ConvBiasFusePass() { .IsTensor() .End() .AddAttr("axis") - .IsNumEQ(-1) + .IsIntIn({-1, 0}) .End(); } diff --git a/paddle/fluid/framework/ir/squared_mat_sub_fuse_pass.cc b/paddle/fluid/framework/ir/squared_mat_sub_fuse_pass.cc index 95fe979a335..62f1db426c4 100644 --- a/paddle/fluid/framework/ir/squared_mat_sub_fuse_pass.cc +++ b/paddle/fluid/framework/ir/squared_mat_sub_fuse_pass.cc @@ -436,7 +436,7 @@ SquaredMatSubFusePass::SquaredMatSubFusePass() { .IsTensor() .End() .AddAttr("axis") - .IsNumEQ(-1) + .IsIntIn({-1, 0}) .End(); AddOpCompat(OpCompat("elementwise_mul")) @@ -450,7 +450,7 @@ SquaredMatSubFusePass::SquaredMatSubFusePass() { .IsTensor() .End() .AddAttr("axis") - .IsNumEQ(-1) + .IsIntIn({-1, 0}) .End(); AddOpCompat(OpCompat("fill_constant")) diff --git a/paddle/fluid/operators/compat/batch_norm.pbtxt b/paddle/fluid/operators/compat/batch_norm.pbtxt index ed6162fb91c..92b5647a507 100644 --- a/paddle/fluid/operators/compat/batch_norm.pbtxt +++ b/paddle/fluid/operators/compat/batch_norm.pbtxt @@ -46,10 +46,6 @@ extra { name: "@ENABLE_CACHE_RUNTIME_CONTEXT@" type: BOOLEAN } - attrs { - name: "@ENABLE_CACHE_RUNTIME_CONTEXT@" - type: BOOLEAN - } attrs { name: "is_test" type: BOOLEAN diff --git a/paddle/fluid/operators/compat/relu.pbtxt b/paddle/fluid/operators/compat/relu.pbtxt index 9a184bf03d0..b70458aaa3c 100644 --- a/paddle/fluid/operators/compat/relu.pbtxt +++ b/paddle/fluid/operators/compat/relu.pbtxt @@ -12,6 +12,10 @@ extra { name: "@ENABLE_CACHE_RUNTIME_CONTEXT@" type: BOOLEAN } + attrs { + name: "X0_threshold" + type: FLOAT + } attrs { name: "out_threshold" type: FLOAT -- GitLab