From d68af02c04005fe60acae7f17cd728e36781b04d Mon Sep 17 00:00:00 2001 From: Wilber Date: Wed, 2 Dec 2020 22:11:51 +0800 Subject: [PATCH] fix analysis_config bug. (#29304) --- paddle/fluid/inference/api/analysis_config.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/paddle/fluid/inference/api/analysis_config.cc b/paddle/fluid/inference/api/analysis_config.cc index 7c87974494d..fc56cd1546c 100644 --- a/paddle/fluid/inference/api/analysis_config.cc +++ b/paddle/fluid/inference/api/analysis_config.cc @@ -182,6 +182,10 @@ AnalysisConfig::AnalysisConfig(const AnalysisConfig &other) { // deleted_pass. auto all_passes = kTRTSubgraphPasses; auto other_passes = other.pass_builder()->AllPasses(); + // We should sort them, because the user may call the SwitchIrDebug + // interface, which will change the pass. + std::sort(all_passes.begin(), all_passes.end()); + std::sort(other_passes.begin(), other_passes.end()); std::vector deleted_passes; std::set_difference(all_passes.begin(), all_passes.end(), other_passes.begin(), other_passes.end(), -- GitLab