Package ai.onnxruntime
Class OrtSession.RunOptions
java.lang.Object
ai.onnxruntime.OrtSession.RunOptions
- All Implemented Interfaces:
AutoCloseable
- Enclosing class:
- OrtSession
Used to control logging and termination of a call to
OrtSession.run(java.util.Map<java.lang.String, ? extends ai.onnxruntime.OnnxTensorLike>).-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddActiveLoraAdapter(OrtLoraAdapter loraAdapter) Adds the specified adapter to the list of active adapters for this run.voidaddRunConfigEntry(String key, String value) Adds a configuration entry to thisRunOptions.voidclose()Gets the current logging level set on this RunOptions.intGets the current logging verbosity level set on this RunOptions.Gets the String used to log information about this run.voidsetLogLevel(OrtLoggingLevel level) Sets the current logging level on this RunOptions.voidsetLogVerbosityLevel(int level) Sets the current logging verbosity level on this RunOptions.voidSets the run tag used in logging.voidsetTerminate(boolean terminate) Sets a flag so that all incompleteOrtSession.run(java.util.Map<java.lang.String, ? extends ai.onnxruntime.OnnxTensorLike>)calls using this instance ofRunOptionswill terminate as soon as possible.
-
Constructor Details
-
RunOptions
Creates a RunOptions.- Throws:
OrtException- If the construction of the native RunOptions failed.
-
-
Method Details
-
setLogLevel
Sets the current logging level on this RunOptions.- Parameters:
level- The new logging level.- Throws:
OrtException- If the native call failed.
-
getLogLevel
Gets the current logging level set on this RunOptions.- Returns:
- The logging level.
- Throws:
OrtException- If the native call failed.
-
setLogVerbosityLevel
Sets the current logging verbosity level on this RunOptions.- Parameters:
level- The new logging verbosity level.- Throws:
OrtException- If the native call failed.
-
getLogVerbosityLevel
Gets the current logging verbosity level set on this RunOptions.- Returns:
- The logging verbosity level.
- Throws:
OrtException- If the native call failed.
-
setRunTag
Sets the run tag used in logging.- Parameters:
runTag- The run tag in logging output.- Throws:
OrtException- If the native library call failed.
-
getRunTag
Gets the String used to log information about this run.- Returns:
- The run tag.
- Throws:
OrtException- If the native library call failed.
-
setTerminate
Sets a flag so that all incompleteOrtSession.run(java.util.Map<java.lang.String, ? extends ai.onnxruntime.OnnxTensorLike>)calls using this instance ofRunOptionswill terminate as soon as possible. If the flag is false, it resets thisRunOptionsso it can be used with other calls toOrtSession.run(java.util.Map<java.lang.String, ? extends ai.onnxruntime.OnnxTensorLike>).- Parameters:
terminate- If true terminate all runs associated with this RunOptions.- Throws:
OrtException- If the native library call failed.
-
addRunConfigEntry
Adds a configuration entry to thisRunOptions.Setting the same key will overwrite the value.
- Parameters:
key- The configuration key.value- The configuration value.- Throws:
OrtException- If the native library call failed.
-
addActiveLoraAdapter
Adds the specified adapter to the list of active adapters for this run.- Parameters:
loraAdapter- valid OrtLoraAdapter object- Throws:
OrtException- of the native library call failed
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-