From 014b1aff6ecd3eedc1d4f992000b3762166fd45a Mon Sep 17 00:00:00 2001 From: Pei Yang Date: Fri, 24 Apr 2020 19:18:39 +0800 Subject: [PATCH] remove conv_bn_fuse_pass and fc_fuse_pass in trt int8 calibration. test=develop (#24040) --- paddle/fluid/inference/api/analysis_config.cc | 7 +++++++ .../fluid/inference/tests/api/trt_split_converter_test.cc | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/paddle/fluid/inference/api/analysis_config.cc b/paddle/fluid/inference/api/analysis_config.cc index fd7031b01dd..47b45f8e4f4 100644 --- a/paddle/fluid/inference/api/analysis_config.cc +++ b/paddle/fluid/inference/api/analysis_config.cc @@ -279,7 +279,14 @@ void AnalysisConfig::Update() { if (use_tensorrt_) { pass_builder()->ClearPasses(); + bool use_calib_int8 = + (tensorrt_precision_mode_ == AnalysisConfig::Precision::kInt8) && + trt_use_calib_mode_; for (const auto &pass : kTRTSubgraphPasses) { + if (use_calib_int8 && + (pass == "conv_bn_fuse_pass" || pass == "fc_fuse_pass")) { + continue; + } pass_builder()->AppendPass(pass); } } diff --git a/paddle/fluid/inference/tests/api/trt_split_converter_test.cc b/paddle/fluid/inference/tests/api/trt_split_converter_test.cc index 3c2ff9601f3..7cf50f21948 100644 --- a/paddle/fluid/inference/tests/api/trt_split_converter_test.cc +++ b/paddle/fluid/inference/tests/api/trt_split_converter_test.cc @@ -29,7 +29,7 @@ TEST(TensorRT, split_converter) { config.SetModel(model_dir); config.SwitchUseFeedFetchOps(false); config.EnableTensorRtEngine(1 << 20, batch_size, 1, - AnalysisConfig::Precision::kFloat32, false); + AnalysisConfig::Precision::kInt8, false, true); auto predictor = CreatePaddlePredictor(config); -- GitLab