1717#include  " paddle/fluid/framework/ir/mkldnn/batch_norm_act_fuse_pass.h" 
1818#include  " paddle/fluid/framework/ir/mkldnn/pass_test_util.h" 
1919#include  " paddle/fluid/framework/op_desc.h" 
20+ #include  " paddle/fluid/framework/op_version_registry.h" 
2021#include  " paddle/fluid/framework/program_desc.h" 
2122#include  " paddle/fluid/platform/errors.h" 
2223
@@ -63,9 +64,9 @@ TEST(FuseBatchNormActOneDNNPass, ThrowIsTestTrainableStats) {
6364  //  No fusion in this attribute configuration
6465  constexpr  int  removed_nodes_count = 0 ;
6566
66-   EXPECT_THROW (
67-       test::RunPassAndAssert (&graph,  " x " ,  " act_y" 
68-       paddle::platform::EnforceNotMet);
67+   EXPECT_THROW (test::RunPassAndAssert (&graph,  " batch_norm_act_fuse_pass " ,  " x " , 
68+                                        " act_y" 
69+                 paddle::platform::EnforceNotMet);
6970}
7071
7172TEST (FuseBatchNormActOneDNNPass, FuseIsTest) {
@@ -83,8 +84,8 @@ TEST(FuseBatchNormActOneDNNPass, FuseIsTest) {
8384  Graph graph (prog);
8485  constexpr  int  removed_nodes_count = 2 ;
8586
86-   EXPECT_TRUE (
87-       test::RunPassAndAssert (&graph,  " x " ,  " act_y" 
87+   EXPECT_TRUE (test::RunPassAndAssert (&graph,  " batch_norm_act_fuse_pass " ,  " x " , 
88+                                       " act_y" 
8889  EXPECT_TRUE (test::AssertOpsCount (graph, {{" batch_norm" 1 }, {" relu" 0 }}));
8990
9091  for  (const  auto * node : graph.Nodes ()) {
@@ -121,9 +122,9 @@ TEST(FuseBatchNormActOneDNNPass, ThrowTrainableStats) {
121122  //  No fusion in this attribute configuration
122123  constexpr  int  removed_nodes_count = 0 ;
123124
124-   EXPECT_THROW (
125-       test::RunPassAndAssert (&graph,  " x " ,  " act_y" 
126-       paddle::platform::EnforceNotMet);
125+   EXPECT_THROW (test::RunPassAndAssert (&graph,  " batch_norm_act_fuse_pass " ,  " x " , 
126+                                        " act_y" 
127+                 paddle::platform::EnforceNotMet);
127128}
128129
129130TEST (FuseBatchNormActOneDNNPass, AllAttrsFalse) {
@@ -147,9 +148,9 @@ TEST(FuseBatchNormActOneDNNPass, AllAttrsFalse) {
147148  //  No fusion in this attribute configuration
148149  constexpr  int  removed_nodes_count = 0 ;
149150
150-   EXPECT_THROW (
151-       test::RunPassAndAssert (&graph,  " x " ,  " act_y" 
152-       paddle::platform::EnforceNotMet);
151+   EXPECT_THROW (test::RunPassAndAssert (&graph,  " batch_norm_act_fuse_pass " ,  " x " , 
152+                                        " act_y" 
153+                 paddle::platform::EnforceNotMet);
153154}
154155
155156TEST (FuseBatchNormActOneDNNPass, ThrowUseMkldnn) {
@@ -174,9 +175,15 @@ TEST(FuseBatchNormActOneDNNPass, ThrowUseMkldnn) {
174175  //  No fusion in this attribute configuration
175176  constexpr  int  removed_nodes_count = 0 ;
176177
177-   EXPECT_THROW (
178-       test::RunPassAndAssert (&graph, " x" " act_y" 
179-       paddle::platform::EnforceNotMet);
178+   EXPECT_THROW (test::RunPassAndAssert (&graph, " batch_norm_act_fuse_pass" " x" 
179+                                       " act_y" 
180+                paddle::platform::EnforceNotMet);
181+ }
182+ 
183+ TEST (FuseBatchNormActOneDNNPass, pass_op_version_check) {
184+   ASSERT_TRUE (
185+       paddle::framework::compatible::PassVersionCheckerRegistrar::GetInstance ()
186+           .IsPassCompatible (" batch_norm_act_fuse_pass" 
180187}
181188
182189}  //  namespace ir
0 commit comments