Package ai.onnxruntime
Class OrtProviderOptions
java.lang.Object
ai.onnxruntime.OrtProviderOptions
- All Implemented Interfaces:
AutoCloseable
- Direct Known Subclasses:
OrtCUDAProviderOptions,OrtTensorRTProviderOptions
An abstract base class for execution provider options classes.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceFunctional interface mirroring a Java supplier, but can throw OrtException. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanIs the native object closed?protected final longThe native pointer. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedOrtProviderOptions(long nativeHandle) Constructs a OrtProviderOptions wrapped around a native pointer. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidApplies the Java side configuration to the native side object.protected voidChecks if the OrtProviderOptions is closed, if so throwsIllegalStateException.voidclose()protected abstract voidclose(long apiHandle, long nativeHandle) Native close method.protected static longAllow access to the api handle pointer for subclasses.abstract OrtProviderGets the provider enum for this options instance.booleanisClosed()Is the native object closed?protected static longloadLibraryAndCreate(OrtProvider provider, OrtProviderOptions.OrtProviderSupplier createFunction) Loads the provider's shared library (if necessary) and calls the create provider function.
-
Field Details
-
nativeHandle
protected final long nativeHandleThe native pointer. -
closed
protected boolean closedIs the native object closed?
-
-
Constructor Details
-
OrtProviderOptions
protected OrtProviderOptions(long nativeHandle) Constructs a OrtProviderOptions wrapped around a native pointer.- Parameters:
nativeHandle- The native pointer.
-
-
Method Details
-
getApiHandle
protected static long getApiHandle()Allow access to the api handle pointer for subclasses.- Returns:
- The api handle.
-
getProvider
Gets the provider enum for this options instance.- Returns:
- The provider enum.
-
applyToNative
Applies the Java side configuration to the native side object.- Throws:
OrtException- If the native call failed.
-
isClosed
public boolean isClosed()Is the native object closed?- Returns:
- True if the native object has been released.
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
checkClosed
protected void checkClosed()Checks if the OrtProviderOptions is closed, if so throwsIllegalStateException. -
close
protected abstract void close(long apiHandle, long nativeHandle) Native close method.- Parameters:
apiHandle- The api pointer.nativeHandle- The native options pointer.
-
loadLibraryAndCreate
protected static long loadLibraryAndCreate(OrtProvider provider, OrtProviderOptions.OrtProviderSupplier createFunction) throws OrtException Loads the provider's shared library (if necessary) and calls the create provider function.- Parameters:
provider- The OrtProvider for this options.createFunction- The create function.- Returns:
- The pointer to the native provider options object.
- Throws:
OrtException- If either the library load or provider options create call failed.
-