Class RunOptions
java.lang.Object
smile.onnx.RunOptions
- All Implemented Interfaces:
AutoCloseable
Per-run configuration options passed to
InferenceSession.run(Map, String[], RunOptions).
Instances must be closed after the run completes.
try (var runOpts = new RunOptions()) {
runOpts.setLogTag("my-run").setLogSeverityLevel(LoggingLevel.WARNING);
OrtValue[] outputs = session.run(inputMap, outputNames, runOpts);
}
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddConfigEntry(String key, String value) Adds a run-level configuration entry.voidclose()setLogSeverityLevel(LoggingLevel level) Sets the minimum log severity for this run.Sets the log tag for this run.setLogVerbosityLevel(int level) Sets the log verbosity level for this run.Requests termination of the current run.Clears the termination flag set bysetTerminate().
-
Constructor Details
-
RunOptions
public RunOptions()Creates a newRunOptionswith default settings.
-
-
Method Details
-
setLogTag
Sets the log tag for this run.- Parameters:
tag- a short string to identify this run in log messages.- Returns:
- this object for chaining.
-
setLogVerbosityLevel
Sets the log verbosity level for this run.- Parameters:
level- verbosity level (higher = more verbose).- Returns:
- this object for chaining.
-
setLogSeverityLevel
Sets the minimum log severity for this run.- Parameters:
level- the minimum severity level.- Returns:
- this object for chaining.
-
setTerminate
Requests termination of the current run. This can be called from another thread to cancel a running inference.- Returns:
- this object for chaining.
-
unsetTerminate
Clears the termination flag set bysetTerminate().- Returns:
- this object for chaining.
-
addConfigEntry
Adds a run-level configuration entry.- Parameters:
key- the configuration key.value- the configuration value.- Returns:
- this object for chaining.
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-