Skip to content

Commit e86905c

Browse files
authored
[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
1 parent 08fa693 commit e86905c

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

fastdeploy/fastdeploy_model.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,15 @@ bool FastDeployModel::IsSupported(const std::vector<Backend>& backends,
4949
<< "the backend [" << backend
5050
<< "] is supported for current model!" << std::endl;
5151
return true;
52-
} else if (!enable_valid_backend_check_) {
52+
} else if (!runtime_option.enable_valid_backend_check) {
5353
FDWARNING << "Checking for valid backend is disable, we don't"
5454
<< " check to see if the backend [" << backend
5555
<< "] is supported for current model!" << std::endl;
5656
return true;
5757
}
5858
return CheckBackendSupported(backends, backend);
5959
#else
60-
if (!enable_valid_backend_check_) {
60+
if (!runtime_option.enable_valid_backend_check) {
6161
FDWARNING << "Checking for valid backend is disable, we don't"
6262
<< " check to see if the backend [" << backend
6363
<< "] is supported for current model!" << std::endl;

fastdeploy/fastdeploy_model.h

-12
Original file line numberDiff line numberDiff line change
@@ -121,16 +121,6 @@ class FASTDEPLOY_DECL FastDeployModel {
121121
virtual double GetProfileTime() {
122122
return runtime_->GetProfileTime();
123123
}
124-
/** \brief Enable to check if current backend set by user can be found at valid_xxx_backend.
125-
*/
126-
virtual void EnableValidBackendCheck() {
127-
enable_valid_backend_check_ = true;
128-
}
129-
/** \brief Disable to check if current backend set by user can be found at valid_xxx_backend.
130-
*/
131-
virtual void DisableValidBackendCheck() {
132-
enable_valid_backend_check_ = false;
133-
}
134124
/** \brief Release reused input/output buffers
135125
*/
136126
virtual void ReleaseReusedBuffer() {
@@ -179,8 +169,6 @@ class FASTDEPLOY_DECL FastDeployModel {
179169
// whether to record inference time
180170
bool enable_record_time_of_runtime_ = false;
181171
std::vector<double> time_of_runtime_;
182-
// enable the check for valid backend, default true.
183-
bool enable_valid_backend_check_ = true;
184172
};
185173

186174
} // namespace fastdeploy

fastdeploy/runtime/runtime_option.h

+12
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,21 @@ struct FASTDEPLOY_DECL RuntimeOption {
178178
benchmark_option.enable_profile = false;
179179
}
180180

181+
/** \brief Enable to check if current backend set by user can be found at valid_xxx_backend.
182+
*/
183+
void EnableValidBackendCheck() {
184+
enable_valid_backend_check = true;
185+
}
186+
/** \brief Disable to check if current backend set by user can be found at valid_xxx_backend.
187+
*/
188+
void DisableValidBackendCheck() {
189+
enable_valid_backend_check = false;
190+
}
181191

182192
/// Benchmark option
183193
benchmark::BenchmarkOption benchmark_option;
194+
// enable the check for valid backend, default true.
195+
bool enable_valid_backend_check = true;
184196

185197
// If model_from_memory is true, the model_file and params_file is
186198
// binary stream in memory;

0 commit comments

Comments
 (0)