diff --git a/fastdeploy/fastdeploy_model.cc b/fastdeploy/fastdeploy_model.cc index 2eb25e383..a05a1a347 100644 --- a/fastdeploy/fastdeploy_model.cc +++ b/fastdeploy/fastdeploy_model.cc @@ -49,9 +49,20 @@ 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_) { + FDWARNING << "Checking for valid backend is disable, we don't" + << " check to see if the backend [" << backend + << "] is supported for current model!" << std::endl; + return true; } return CheckBackendSupported(backends, backend); #else + if (!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; + return true; + } return CheckBackendSupported(backends, backend); #endif } diff --git a/fastdeploy/fastdeploy_model.h b/fastdeploy/fastdeploy_model.h index bd7320912..62e51c074 100755 --- a/fastdeploy/fastdeploy_model.h +++ b/fastdeploy/fastdeploy_model.h @@ -121,7 +121,16 @@ 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() { @@ -170,6 +179,8 @@ 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