From e86905ca0df59a0a550dba893cb7746f1c2e0fa0 Mon Sep 17 00:00:00 2001 From: DefTruth <31974251+DefTruth@users.noreply.github.com> Date: Tue, 28 Feb 2023 09:57:31 +0800 Subject: [PATCH] [Bug Fix] move enable_valid_backend_check option -> runtime_option (#1450) * [Model] Add skip valid backend check option -> FastDeployModel * [Model] Add skip valid backend check option -> FastDeployModel * [Model] Add skip valid backend check option -> FastDeployModel * [FastDeploy] move enable_valid_backend_check option -> runtime_option --- fastdeploy/fastdeploy_model.cc | 4 ++-- fastdeploy/fastdeploy_model.h | 12 ------------ fastdeploy/runtime/runtime_option.h | 12 ++++++++++++ 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/fastdeploy/fastdeploy_model.cc b/fastdeploy/fastdeploy_model.cc index a05a1a347..ead1f2004 100644 --- a/fastdeploy/fastdeploy_model.cc +++ b/fastdeploy/fastdeploy_model.cc @@ -49,7 +49,7 @@ bool FastDeployModel::IsSupported(const std::vector& backends, << "the backend [" << backend << "] is supported for current model!" << std::endl; return true; - } else if (!enable_valid_backend_check_) { + } else if (!runtime_option.enable_valid_backend_check) { FDWARNING << "Checking for valid backend is disable, we don't" << " check to see if the backend [" << backend << "] is supported for current model!" << std::endl; @@ -57,7 +57,7 @@ bool FastDeployModel::IsSupported(const std::vector& backends, } return CheckBackendSupported(backends, backend); #else - if (!enable_valid_backend_check_) { + if (!runtime_option.enable_valid_backend_check) { FDWARNING << "Checking for valid backend is disable, we don't" << " check to see if the backend [" << backend << "] is supported for current model!" << std::endl; diff --git a/fastdeploy/fastdeploy_model.h b/fastdeploy/fastdeploy_model.h index 62e51c074..27295b33e 100755 --- a/fastdeploy/fastdeploy_model.h +++ b/fastdeploy/fastdeploy_model.h @@ -121,16 +121,6 @@ class FASTDEPLOY_DECL FastDeployModel { virtual double GetProfileTime() { return runtime_->GetProfileTime(); } - /** \brief Enable to check if current backend set by user can be found at valid_xxx_backend. - */ - virtual void EnableValidBackendCheck() { - enable_valid_backend_check_ = true; - } - /** \brief Disable to check if current backend set by user can be found at valid_xxx_backend. - */ - virtual void DisableValidBackendCheck() { - enable_valid_backend_check_ = false; - } /** \brief Release reused input/output buffers */ virtual void ReleaseReusedBuffer() { @@ -179,8 +169,6 @@ class FASTDEPLOY_DECL FastDeployModel { // whether to record inference time bool enable_record_time_of_runtime_ = false; std::vector time_of_runtime_; - // enable the check for valid backend, default true. - bool enable_valid_backend_check_ = true; }; } // namespace fastdeploy diff --git a/fastdeploy/runtime/runtime_option.h b/fastdeploy/runtime/runtime_option.h index 4b7af8a99..a7d7492fb 100644 --- a/fastdeploy/runtime/runtime_option.h +++ b/fastdeploy/runtime/runtime_option.h @@ -178,9 +178,21 @@ struct FASTDEPLOY_DECL RuntimeOption { benchmark_option.enable_profile = false; } + /** \brief Enable to check if current backend set by user can be found at valid_xxx_backend. + */ + void EnableValidBackendCheck() { + enable_valid_backend_check = true; + } + /** \brief Disable to check if current backend set by user can be found at valid_xxx_backend. + */ + void DisableValidBackendCheck() { + enable_valid_backend_check = false; + } /// Benchmark option benchmark::BenchmarkOption benchmark_option; + // enable the check for valid backend, default true. + bool enable_valid_backend_check = true; // If model_from_memory is true, the model_file and params_file is // binary stream in memory;