diff --git a/paddle/fluid/inference/api/analysis_config.cc b/paddle/fluid/inference/api/analysis_config.cc index fd7031b01dd5bb021a5f8c4aaf9b3773e040619a..47b45f8e4f4f1332d550f7fcddbec9a29782ac8a 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 3c2ff9601f3a8e6dce8bd8a87b676ba486b59e39..7cf50f21948638718690cd976a81f005d18d3720 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);