Set default session options for ONNX-RT stateless eval
@@ -30,6 +30,9 @@ public class OnnxEvaluator {
environment = OrtEnvironment.getEnvironment();
OrtSession.SessionOptions options = new OrtSession.SessionOptions();
options.setOptimizationLevel(OrtSession.SessionOptions.OptLevel.ALL_OPT);
+ options.setIntraOpNumThreads(Math.max(1, Runtime.getRuntime().availableProcessors() / 4));
+ options.setInterOpNumThreads(1);
+ options.setExecutionMode(OrtSession.SessionOptions.ExecutionMode.SEQUENTIAL);
session = environment.createSession(modelPath, options);
} catch (OrtException e) {
throw new RuntimeException("ONNX Runtime exception", e);
