public class OrtEnvironment
extends java.lang.Object
implements java.lang.AutoCloseable
OrtSessions
which encapsulate specific models.| Modifier and Type | Class and Description |
|---|---|
static class |
OrtEnvironment.LoggingLevel
The logging level for messages from the environment and session.
|
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
DEFAULT_NAME |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the OrtEnvironment.
|
OrtSession |
createSession(byte[] modelArray)
Create a session using the default
OrtSession.SessionOptions, model and the default memory allocator. |
OrtSession |
createSession(byte[] modelArray,
OrtSession.SessionOptions options)
Create a session using the specified
OrtSession.SessionOptions, model and the default memory allocator. |
OrtSession |
createSession(java.lang.String modelPath)
Create a session using the default
OrtSession.SessionOptions, model and the default memory allocator. |
OrtSession |
createSession(java.lang.String modelPath,
OrtSession.SessionOptions options)
Create a session using the specified
OrtSession.SessionOptions, model and the default memory allocator. |
static OrtEnvironment |
getEnvironment()
Gets the OrtEnvironment.
|
static OrtEnvironment |
getEnvironment(OrtEnvironment.LoggingLevel logLevel)
Gets the OrtEnvironment.
|
static OrtEnvironment |
getEnvironment(OrtEnvironment.LoggingLevel loggingLevel,
java.lang.String name)
Gets the OrtEnvironment.
|
static OrtEnvironment |
getEnvironment(java.lang.String name)
Gets the OrtEnvironment.
|
boolean |
isClosed()
Is this environment closed?
|
void |
setTelemetry(boolean sendTelemetry)
Turns on or off the telemetry.
|
java.lang.String |
toString() |
public static final java.lang.String DEFAULT_NAME
public static OrtEnvironment getEnvironment()
DEFAULT_NAME and OrtEnvironment.LoggingLevel.ORT_LOGGING_LEVEL_WARNING.public static OrtEnvironment getEnvironment(java.lang.String name)
OrtEnvironment.LoggingLevel.ORT_LOGGING_LEVEL_WARNING.name - The logging id of the environment.public static OrtEnvironment getEnvironment(OrtEnvironment.LoggingLevel logLevel)
DEFAULT_NAME and the supplied logging level.logLevel - The logging level to use.public static OrtEnvironment getEnvironment(OrtEnvironment.LoggingLevel loggingLevel, java.lang.String name)
loggingLevel - The logging level to use.name - The log id.public OrtSession createSession(java.lang.String modelPath) throws OrtException
OrtSession.SessionOptions, model and the default memory allocator.modelPath - Path on disk to load the model from.OrtSession with the specified model.OrtException - If the model failed to load, wasn't compatible or caused an error.public OrtSession createSession(java.lang.String modelPath, OrtSession.SessionOptions options) throws OrtException
OrtSession.SessionOptions, model and the default memory allocator.modelPath - Path on disk to load the model from.options - The session options.OrtSession with the specified model.OrtException - If the model failed to load, wasn't compatible or caused an error.public OrtSession createSession(byte[] modelArray, OrtSession.SessionOptions options) throws OrtException
OrtSession.SessionOptions, model and the default memory allocator.modelArray - Byte array representing an ONNX model.options - The session options.OrtSession with the specified model.OrtException - If the model failed to parse, wasn't compatible or caused an error.public OrtSession createSession(byte[] modelArray) throws OrtException
OrtSession.SessionOptions, model and the default memory allocator.modelArray - Byte array representing an ONNX model.OrtSession with the specified model.OrtException - If the model failed to parse, wasn't compatible or caused an error.public void setTelemetry(boolean sendTelemetry)
throws OrtException
sendTelemetry - If true then send telemetry on onnxruntime usage.OrtException - If the call failed.public boolean isClosed()
public java.lang.String toString()
toString in class java.lang.Objectpublic void close()
throws OrtException
close in interface java.lang.AutoCloseableOrtException - If the close failed.