mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-06 09:07:10 +08:00
Merge pull request #1552 from joey12300/fix_delete_pass
[Backend] Fix delete pass of paddle inference
This commit is contained in:
@@ -88,13 +88,6 @@ void PaddleBackend::BuildOption(const PaddleBackendOption& option) {
|
|||||||
if (!option.enable_log_info) {
|
if (!option.enable_log_info) {
|
||||||
config_.DisableGlogInfo();
|
config_.DisableGlogInfo();
|
||||||
}
|
}
|
||||||
if (!option.delete_pass_names.empty()) {
|
|
||||||
auto pass_builder = config_.pass_builder();
|
|
||||||
for (int i = 0; i < option.delete_pass_names.size(); i++) {
|
|
||||||
FDINFO << "Delete pass : " << option.delete_pass_names[i] << std::endl;
|
|
||||||
pass_builder->DeletePass(option.delete_pass_names[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (option.cpu_thread_num <= 0) {
|
if (option.cpu_thread_num <= 0) {
|
||||||
config_.SetCpuMathLibraryNumThreads(8);
|
config_.SetCpuMathLibraryNumThreads(8);
|
||||||
} else {
|
} else {
|
||||||
@@ -239,6 +232,15 @@ bool PaddleBackend::InitFromPaddle(const std::string& model_buffer,
|
|||||||
<< " to set TensorRT dynamic shape." << std::endl;
|
<< " to set TensorRT dynamic shape." << std::endl;
|
||||||
config_.EnableTunedTensorRtDynamicShape(shape_range_info, false);
|
config_.EnableTunedTensorRtDynamicShape(shape_range_info, false);
|
||||||
}
|
}
|
||||||
|
// Note(zhoushunjie): The pass deletion should be executed just before
|
||||||
|
// creating predictor.
|
||||||
|
if (!option.delete_pass_names.empty()) {
|
||||||
|
auto pass_builder = config_.pass_builder();
|
||||||
|
for (int i = 0; i < option.delete_pass_names.size(); i++) {
|
||||||
|
FDINFO << "Delete pass : " << option.delete_pass_names[i] << std::endl;
|
||||||
|
pass_builder->DeletePass(option.delete_pass_names[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
predictor_ = paddle_infer::CreatePredictor(config_);
|
predictor_ = paddle_infer::CreatePredictor(config_);
|
||||||
initialized_ = true;
|
initialized_ = true;
|
||||||
return true;
|
return true;
|
||||||
|
Reference in New Issue
Block a user