Class OrtProviderOptions

  • All Implemented Interfaces:
    Direct Known Subclasses:
    OrtCUDAProviderOptions, OrtTensorRTProviderOptions

    public abstract class OrtProviderOptions
    extends java.lang.Object
    implements java.lang.AutoCloseable
    An abstract base class for execution provider options classes.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  OrtProviderOptions.OrtProviderSupplier
      Functional interface mirroring a Java supplier, but can throw OrtException.
    • Field Summary

      Modifier and Type Field Description
      protected boolean closed
      Is the native object closed?
      protected long nativeHandle
      The native pointer.
    • Constructor Summary

      Modifier Constructor Description
      protected OrtProviderOptions​(long nativeHandle)
      Constructs a OrtProviderOptions wrapped around a native pointer.
    • Field Detail

      • nativeHandle

        protected final long nativeHandle
        The native pointer.
      • closed

        protected boolean closed
        Is the native object closed?
    • Constructor Detail

      • OrtProviderOptions

        protected OrtProviderOptions​(long nativeHandle)
        Constructs a OrtProviderOptions wrapped around a native pointer.
        nativeHandle - The native pointer.
    • Method Detail

      • getApiHandle

        protected static long getApiHandle()
        Allow access to the api handle pointer for subclasses.
        The api handle.
      • getProvider

        public abstract OrtProvider getProvider()
        Gets the provider enum for this options instance.
        The provider enum.
      • applyToNative

        protected abstract void applyToNative()
                                       throws OrtException
        Applies the Java side configuration to the native side object.
        OrtException - If the native call failed.
      • isClosed

        public boolean isClosed()
        Is the native object closed?
        True if the native object has been released.
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
      • checkClosed

        protected void checkClosed()
        Checks if the OrtProviderOptions is closed, if so throws IllegalStateException.
      • close

        protected abstract void close​(long apiHandle,
                                      long nativeHandle)
        Native close method.
        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.
        provider - The OrtProvider for this options.
        createFunction - The create function.
        The pointer to the native provider options object.
        OrtException - If either the library load or provider options create call failed.