Before consolidated main

This commit is contained in:
Michael Hansen
2023-01-09 16:35:32 -06:00
parent 6c949aa5c5
commit dfa03d80e6
3 changed files with 7 additions and 6 deletions

View File

@@ -16,15 +16,16 @@ struct ModelSession {
vector<char *> outputNames;
Ort::AllocatorWithDefaultOptions allocator;
Ort::SessionOptions options;
Ort::Env env;
ModelSession() : onnx(nullptr){};
};
void loadModel(string modelPath, ModelSession &session) {
Ort::Env env(OrtLoggingLevel::ORT_LOGGING_LEVEL_WARNING,
instanceName.c_str());
env.DisableTelemetryEvents();
session.env = Ort::Env(OrtLoggingLevel::ORT_LOGGING_LEVEL_WARNING,
instanceName.c_str());
session.env.DisableTelemetryEvents();
// Slows down performance by ~2x
// session.options.SetIntraOpNumThreads(1);
@@ -44,7 +45,7 @@ void loadModel(string modelPath, ModelSession &session) {
session.options.DisableProfiling();
auto startTime = chrono::steady_clock::now();
session.onnx = Ort::Session(env, modelPath.c_str(), session.options);
session.onnx = Ort::Session(session.env, modelPath.c_str(), session.options);
auto endTime = chrono::steady_clock::now();
auto loadDuration = chrono::duration<double>(endTime - startTime);