From 3809fca66921dcddb997694da3ea5632feb5d06c Mon Sep 17 00:00:00 2001 From: Wilber Date: Wed, 2 Dec 2020 23:07:16 +0800 Subject: [PATCH] cherry-pick 29304. (#29305) --- 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