Class OrtTensorRTProviderOptions

java.lang.Object
ai.onnxruntime.OrtProviderOptions
ai.onnxruntime.providers.OrtTensorRTProviderOptions
All Implemented Interfaces:
AutoCloseable

public final class OrtTensorRTProviderOptions extends OrtProviderOptions
Options for configuring the TensorRT execution provider.

Supported options are listed on the ORT website.

  • Field Details

    • options

      protected final Map<String,String> options
      A Java side copy of the options.
  • Constructor Details

    • OrtTensorRTProviderOptions

      public OrtTensorRTProviderOptions() throws OrtException
      Constructs TensorRT execution provider options for device 0.
      Throws:
      OrtException - If TensorRT is unavailable.
    • OrtTensorRTProviderOptions

      public OrtTensorRTProviderOptions(int deviceId) throws OrtException
      Constructs TensorRT execution provider options for the specified non-negative device id.
      Parameters:
      deviceId - The device id.
      Throws:
      OrtException - If TensorRT is unavailable.
  • Method Details

    • getProvider

      public OrtProvider getProvider()
      Description copied from class: OrtProviderOptions
      Gets the provider enum for this options instance.
      Specified by:
      getProvider in class OrtProviderOptions
      Returns:
      The provider enum.
    • applyToNative

      protected void applyToNative(long apiHandle, long nativeHandle, String[] keys, String[] values) throws OrtException
      Adds the options to this options instance.
      Parameters:
      apiHandle - The api pointer.
      nativeHandle - The native options pointer.
      keys - The option keys.
      values - The option values.
      Throws:
      OrtException - If the addition failed.
    • close

      protected void close(long apiHandle, long nativeHandle)
      Closes this options instance.
      Specified by:
      close in class OrtProviderOptions
      Parameters:
      apiHandle - The api pointer.
      nativeHandle - The native options pointer.
    • add

      public void add(String key, String value) throws OrtException
      Adds a configuration option to this options.
      Parameters:
      key - The key.
      value - The value.
      Throws:
      OrtException - If the addition failed.
    • parseOptionsString

      public void parseOptionsString(String serializedForm) throws OrtException
      Parses the output of getOptionsString() and adds those options to this options instance.
      Parameters:
      serializedForm - The serialized form to parse.
      Throws:
      OrtException - If the option could not be added.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getOptionsString

      public String getOptionsString()
      Returns the serialized options string
      Returns:
      The serialized options string.
    • applyToNative

      protected void applyToNative() throws OrtException
      Description copied from class: OrtProviderOptions
      Applies the Java side configuration to the native side object.
      Specified by:
      applyToNative in class OrtProviderOptions
      Throws:
      OrtException - If the native call failed.