Use a single thread when loading models (#703)

This commit is contained in:
Fangjun Kuang
2024-03-26 13:35:33 +08:00
committed by GitHub
parent 305c373107
commit d364610605
4 changed files with 12 additions and 0 deletions

View File

@@ -34,6 +34,8 @@ static ModelType GetModelType(char *model_data, size_t model_data_length,
bool debug) {
Ort::Env env(ORT_LOGGING_LEVEL_WARNING);
Ort::SessionOptions sess_opts;
sess_opts.SetIntraOpNumThreads(1);
sess_opts.SetInterOpNumThreads(1);
auto sess = std::make_unique<Ort::Session>(env, model_data, model_data_length,
sess_opts);