Package ai.onnxruntime.providers
Class OrtCUDAProviderOptions
- java.lang.Object
-
- ai.onnxruntime.OrtProviderOptions
-
- ai.onnxruntime.providers.OrtCUDAProviderOptions
-
- All Implemented Interfaces:
java.lang.AutoCloseable
public final class OrtCUDAProviderOptions extends OrtProviderOptions
Options for configuring the CUDA execution provider.Supported options are listed on the ORT website.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ai.onnxruntime.OrtProviderOptions
OrtProviderOptions.OrtProviderSupplier
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<java.lang.String,java.lang.String>
options
A Java side copy of the options.-
Fields inherited from class ai.onnxruntime.OrtProviderOptions
closed, nativeHandle
-
-
Constructor Summary
Constructors Constructor Description OrtCUDAProviderOptions()
Constructs CUDA execution provider options for device 0.OrtCUDAProviderOptions(int deviceId)
Constructs CUDA execution provider options for the specified non-negative device id.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(java.lang.String key, java.lang.String value)
Adds a configuration option to this options.protected void
applyToNative()
Applies the Java side configuration to the native side object.protected void
applyToNative(long apiHandle, long nativeHandle, java.lang.String[] keys, java.lang.String[] values)
Adds the options to this options instance.protected void
close(long apiHandle, long nativeHandle)
Closes this options instance.java.lang.String
getOptionsString()
Returns the serialized options stringOrtProvider
getProvider()
Gets the provider enum for this options instance.void
parseOptionsString(java.lang.String serializedForm)
Parses the output ofgetOptionsString()
and adds those options to this options instance.java.lang.String
toString()
-
Methods inherited from class ai.onnxruntime.OrtProviderOptions
checkClosed, close, getApiHandle, isClosed, loadLibraryAndCreate
-
-
-
-
Constructor Detail
-
OrtCUDAProviderOptions
public OrtCUDAProviderOptions() throws OrtException
Constructs CUDA execution provider options for device 0.- Throws:
OrtException
- If CUDA is unavailable.
-
OrtCUDAProviderOptions
public OrtCUDAProviderOptions(int deviceId) throws OrtException
Constructs CUDA execution provider options for the specified non-negative device id.- Parameters:
deviceId
- The device id.- Throws:
OrtException
- If CUDA is unavailable.
-
-
Method Detail
-
getProvider
public OrtProvider getProvider()
Description copied from class:OrtProviderOptions
Gets the provider enum for this options instance.- Specified by:
getProvider
in classOrtProviderOptions
- Returns:
- The provider enum.
-
applyToNative
protected void applyToNative(long apiHandle, long nativeHandle, java.lang.String[] keys, java.lang.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 classOrtProviderOptions
- Parameters:
apiHandle
- The api pointer.nativeHandle
- The native options pointer.
-
add
public void add(java.lang.String key, java.lang.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(java.lang.String serializedForm) throws OrtException
Parses the output ofgetOptionsString()
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 java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getOptionsString
public java.lang.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 classOrtProviderOptions
- Throws:
OrtException
- If the native call failed.
-
-