From 3ea19b759649feabf45860e4e4c808c26845c3c7 Mon Sep 17 00:00:00 2001 From: tensor-tang Date: Fri, 7 Sep 2018 18:48:45 +0800 Subject: [PATCH] fix bug and fc pass ut --- paddle/fluid/framework/ir/graph_pattern_detector.cc | 9 ++++----- paddle/fluid/inference/analysis/analyzer_lac_tester.cc | 1 + paddle/fluid/inference/analysis/analyzer_ner_tester.cc | 1 + 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/paddle/fluid/framework/ir/graph_pattern_detector.cc b/paddle/fluid/framework/ir/graph_pattern_detector.cc index 69a323a8bd8..5ca75095158 100644 --- a/paddle/fluid/framework/ir/graph_pattern_detector.cc +++ b/paddle/fluid/framework/ir/graph_pattern_detector.cc @@ -536,22 +536,21 @@ PDNode* patterns::FC(PDPattern* pattern, const std::string& name_scope, mul_out_var = pattern->NewNode(name_scope, "mul_out") ->AsIntermediate() ->assert_is_only_output_of_op("mul") - ->assert_is_op_input("elementwise_add", "X"); + ->assert_is_op_input("elementwise_add"); // bias bias = pattern->NewNode(name_scope, "fc_bias") ->AsInput() - ->assert_is_persistable_var() - ->assert_is_op_input("elementwise_add", "Y"); + ->assert_is_op_input("elementwise_add"); // output fc_out = pattern->NewNode(name_scope, "fc_out") ->AsOutput() - ->assert_is_op_output("elementwise_add", "Out"); + ->assert_is_op_output("elementwise_add"); mul_op->LinksFrom({x, mul_weight_var}).LinksTo({mul_out_var}); elementwise_add_op->LinksFrom({mul_out_var, bias}).LinksTo({fc_out}); } else { fc_out = pattern->NewNode(name_scope, "fc_out") ->AsOutput() - ->assert_is_op_output("mul", "Out"); + ->assert_is_op_output("mul"); mul_op->LinksFrom({mul_weight_var, x}).LinksTo({fc_out}); } return fc_out; diff --git a/paddle/fluid/inference/analysis/analyzer_lac_tester.cc b/paddle/fluid/inference/analysis/analyzer_lac_tester.cc index 4ff7251473f..b906b32cf5f 100644 --- a/paddle/fluid/inference/analysis/analyzer_lac_tester.cc +++ b/paddle/fluid/inference/analysis/analyzer_lac_tester.cc @@ -15,6 +15,7 @@ #include "paddle/fluid/inference/analysis/analyzer.h" #include #include "paddle/fluid/framework/ir/fuse_pass_base.h" +#include "paddle/fluid/inference/analysis/ut_helper.h" #include "paddle/fluid/inference/api/analysis_predictor.h" #include "paddle/fluid/inference/api/helper.h" #include "paddle/fluid/inference/api/paddle_inference_pass.h" diff --git a/paddle/fluid/inference/analysis/analyzer_ner_tester.cc b/paddle/fluid/inference/analysis/analyzer_ner_tester.cc index f5c5d73aeb4..661b047ed7c 100644 --- a/paddle/fluid/inference/analysis/analyzer_ner_tester.cc +++ b/paddle/fluid/inference/analysis/analyzer_ner_tester.cc @@ -15,6 +15,7 @@ #include "paddle/fluid/inference/analysis/analyzer.h" #include #include "paddle/fluid/framework/ir/fuse_pass_base.h" +#include "paddle/fluid/inference/analysis/ut_helper.h" #include "paddle/fluid/inference/api/analysis_predictor.h" #include "paddle/fluid/inference/api/helper.h" #include "paddle/fluid/inference/api/paddle_inference_pass.h" -- GitLab