mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-09 18:40:18 +08:00
[Model] Add skip valid backend check option -> FastDeployModel (#1445)
* [Model] Add skip valid backend check option -> FastDeployModel * [Model] Add skip valid backend check option -> FastDeployModel * [Model] Add skip valid backend check option -> FastDeployModel
This commit is contained in:
@@ -49,9 +49,20 @@ bool FastDeployModel::IsSupported(const std::vector<Backend>& backends,
|
|||||||
<< "the backend [" << backend
|
<< "the backend [" << backend
|
||||||
<< "] is supported for current model!" << std::endl;
|
<< "] is supported for current model!" << std::endl;
|
||||||
return true;
|
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);
|
return CheckBackendSupported(backends, backend);
|
||||||
#else
|
#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);
|
return CheckBackendSupported(backends, backend);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@@ -121,7 +121,16 @@ class FASTDEPLOY_DECL FastDeployModel {
|
|||||||
virtual double GetProfileTime() {
|
virtual double GetProfileTime() {
|
||||||
return runtime_->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
|
/** \brief Release reused input/output buffers
|
||||||
*/
|
*/
|
||||||
virtual void ReleaseReusedBuffer() {
|
virtual void ReleaseReusedBuffer() {
|
||||||
@@ -170,6 +179,8 @@ class FASTDEPLOY_DECL FastDeployModel {
|
|||||||
// whether to record inference time
|
// whether to record inference time
|
||||||
bool enable_record_time_of_runtime_ = false;
|
bool enable_record_time_of_runtime_ = false;
|
||||||
std::vector<double> time_of_runtime_;
|
std::vector<double> time_of_runtime_;
|
||||||
|
// enable the check for valid backend, default true.
|
||||||
|
bool enable_valid_backend_check_ = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace fastdeploy
|
} // namespace fastdeploy
|
||||||
|
Reference in New Issue
Block a user