diff --git a/paddle/fluid/inference/api/analysis_config.cc b/paddle/fluid/inference/api/analysis_config.cc index 7c87974494d73adce2f059159fcb46d01f0d31aa..fc56cd1546c2c62db3d702becf5518905c657d00 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(),