![]() |
ONNX Runtime
|
Classes | |
struct | OrtAllocator |
Memory allocation interface. More... | |
struct | OrtCUDAProviderOptions |
CUDA Provider Options. More... | |
struct | OrtROCMProviderOptions |
ROCM Provider Options. More... | |
struct | OrtTensorRTProviderOptions |
TensorRT Provider Options. More... | |
struct | OrtMIGraphXProviderOptions |
MIGraphX Provider Options. More... | |
struct | OrtOpenVINOProviderOptions |
OpenVINO Provider Options. More... | |
struct | OrtApiBase |
The helper interface to get the right version of OrtApi. More... | |
struct | OrtCustomHandleType |
struct | OrtApi |
The C API. More... | |
struct | OrtCustomOp |
struct | OrtModelEditorApi |
The OrtModelEditorApi struct provides functions to create or edit an ONNX model. More... | |
struct | OrtCompileApi |
The OrtCompileApi struct provides functions to compile ONNX models. More... | |
struct | OrtEpApi |
struct | OrtEp |
The OrtEp struct provides functions to implement for an execution provider. More... | |
struct | OrtEpFactory |
The OrtEpFactory provides functions to create and manage execution providers. More... | |
Macros | |
#define | ORT_API_VERSION 23 |
The API version defined in this header. | |
Typedefs | |
typedef enum ONNXTensorElementDataType | ONNXTensorElementDataType |
typedef enum ONNXType | ONNXType |
typedef enum OrtSparseFormat | OrtSparseFormat |
typedef enum OrtLoggingLevel | OrtLoggingLevel |
Logging severity levels. | |
typedef enum OrtErrorCode | OrtErrorCode |
typedef enum OrtOpAttrType | OrtOpAttrType |
typedef struct OrtEnv | OrtEnv |
typedef struct OrtStatus | OrtStatus |
typedef struct OrtMemoryInfo | OrtMemoryInfo |
typedef struct OrtIoBinding | OrtIoBinding |
typedef struct OrtSession | OrtSession |
typedef struct OrtValue | OrtValue |
typedef struct OrtRunOptions | OrtRunOptions |
typedef struct OrtTypeInfo | OrtTypeInfo |
typedef struct OrtTensorTypeAndShapeInfo | OrtTensorTypeAndShapeInfo |
typedef struct OrtMapTypeInfo | OrtMapTypeInfo |
typedef struct OrtSequenceTypeInfo | OrtSequenceTypeInfo |
typedef struct OrtOptionalTypeInfo | OrtOptionalTypeInfo |
typedef struct OrtSessionOptions | OrtSessionOptions |
typedef struct OrtCustomOpDomain | OrtCustomOpDomain |
typedef struct OrtModelMetadata | OrtModelMetadata |
typedef struct OrtThreadPoolParams | OrtThreadPoolParams |
typedef struct OrtThreadingOptions | OrtThreadingOptions |
typedef struct OrtArenaCfg | OrtArenaCfg |
typedef struct OrtPrepackedWeightsContainer | OrtPrepackedWeightsContainer |
typedef struct OrtTensorRTProviderOptionsV2 | OrtTensorRTProviderOptionsV2 |
typedef struct OrtNvTensorRtRtxProviderOptions | OrtNvTensorRtRtxProviderOptions |
typedef struct OrtCUDAProviderOptionsV2 | OrtCUDAProviderOptionsV2 |
typedef struct OrtCANNProviderOptions | OrtCANNProviderOptions |
typedef struct OrtDnnlProviderOptions | OrtDnnlProviderOptions |
typedef struct OrtOp | OrtOp |
typedef struct OrtOpAttr | OrtOpAttr |
typedef struct OrtLogger | OrtLogger |
typedef struct OrtShapeInferContext | OrtShapeInferContext |
typedef struct OrtLoraAdapter | OrtLoraAdapter |
typedef struct OrtValueInfo | OrtValueInfo |
typedef struct OrtNode | OrtNode |
typedef struct OrtGraph | OrtGraph |
typedef struct OrtModel | OrtModel |
typedef struct OrtModelCompilationOptions | OrtModelCompilationOptions |
typedef struct OrtHardwareDevice | OrtHardwareDevice |
typedef struct OrtEpDevice | OrtEpDevice |
typedef struct OrtKeyValuePairs | OrtKeyValuePairs |
typedef OrtStatus * | OrtStatusPtr |
typedef struct OrtAllocator | OrtAllocator |
Memory allocation interface. | |
typedef void(* | OrtLoggingFunction) (void *param, OrtLoggingLevel severity, const char *category, const char *logid, const char *code_location, const char *message) |
typedef enum GraphOptimizationLevel | GraphOptimizationLevel |
Graph optimization level. | |
typedef enum ExecutionMode | ExecutionMode |
typedef enum OrtLanguageProjection | OrtLanguageProjection |
Language projection identifiers /see OrtApi::SetLanguageProjection. | |
typedef struct OrtKernelInfo | OrtKernelInfo |
typedef struct OrtKernelContext | OrtKernelContext |
typedef struct OrtCustomOp | OrtCustomOp |
typedef enum OrtAllocatorType | OrtAllocatorType |
typedef enum OrtMemType | OrtMemType |
Memory types for allocated memory, execution provider specific types should be extended in each provider. | |
typedef enum OrtMemoryInfoDeviceType | OrtMemoryInfoDeviceType |
This mimics OrtDevice type constants so they can be returned in the API. | |
typedef enum OrtHardwareDeviceType | OrtHardwareDeviceType |
typedef enum OrtExecutionProviderDevicePolicy | OrtExecutionProviderDevicePolicy |
These are the default EP selection policies used by ORT when doing automatic EP selection. | |
typedef OrtStatus *(* | EpSelectionDelegate) (const OrtEpDevice **ep_devices, size_t num_devices, const OrtKeyValuePairs *model_metadata, const OrtKeyValuePairs *runtime_metadata, const OrtEpDevice **selected, size_t max_selected, size_t *num_selected, void *state) |
Delegate to allow providing custom OrtEpDevice selection logic. | |
typedef enum OrtCudnnConvAlgoSearch | OrtCudnnConvAlgoSearch |
Algorithm to use for cuDNN Convolution Op. | |
typedef struct OrtCUDAProviderOptions | OrtCUDAProviderOptions |
CUDA Provider Options. | |
typedef struct OrtROCMProviderOptions | OrtROCMProviderOptions |
ROCM Provider Options. | |
typedef struct OrtTensorRTProviderOptions | OrtTensorRTProviderOptions |
TensorRT Provider Options. | |
typedef struct OrtMIGraphXProviderOptions | OrtMIGraphXProviderOptions |
MIGraphX Provider Options. | |
typedef struct OrtOpenVINOProviderOptions | OrtOpenVINOProviderOptions |
OpenVINO Provider Options. | |
typedef struct OrtApi | OrtApi |
typedef struct OrtTrainingApi | OrtTrainingApi |
typedef struct OrtModelEditorApi | OrtModelEditorApi |
typedef struct OrtCompileApi | OrtCompileApi |
typedef struct OrtEpApi | OrtEpApi |
typedef struct OrtApiBase | OrtApiBase |
typedef void(* | OrtThreadWorkerFn) (void *ort_worker_fn_param) |
Thread work loop function. | |
typedef const struct OrtCustomHandleType * | OrtCustomThreadHandle |
typedef OrtCustomThreadHandle(* | OrtCustomCreateThreadFn) (void *ort_custom_thread_creation_options, OrtThreadWorkerFn ort_thread_worker_fn, void *ort_worker_fn_param) |
Ort custom thread creation function. | |
typedef void(* | OrtCustomJoinThreadFn) (OrtCustomThreadHandle ort_custom_thread_handle) |
Custom thread join function. | |
typedef OrtStatus *(* | RegisterCustomOpsFn) (OrtSessionOptions *options, const OrtApiBase *api) |
typedef void(* | RunAsyncCallbackFn) (void *user_data, OrtValue **outputs, size_t num_outputs, OrtStatusPtr status) |
Callback function for RunAsync. | |
typedef enum OrtCustomOpInputOutputCharacteristic | OrtCustomOpInputOutputCharacteristic |
typedef struct OrtEp | OrtEp |
typedef struct OrtEpFactory | OrtEpFactory |
typedef OrtStatus *(* | CreateEpApiFactoriesFn) (const char *registered_name, const OrtApiBase *ort_api_base, OrtEpFactory **factories, size_t max_factories, size_t *num_factories) |
The function signature that ORT will call to create OrtEpFactory instances. | |
typedef OrtStatus *(* | ReleaseEpApiFactoryFn) (OrtEpFactory *factory) |
The function signature that ORT will call to release an OrtEpFactory instance. | |
Functions | |
const OrtApiBase * | OrtGetApiBase (void) |
The Onnxruntime library's entry point to access the C API. | |
OrtStatus * | OrtSessionOptionsAppendExecutionProvider_CUDA (OrtSessionOptions *options, int device_id) |
OrtStatus * | OrtSessionOptionsAppendExecutionProvider_ROCM (OrtSessionOptions *options, int device_id) |
OrtStatus * | OrtSessionOptionsAppendExecutionProvider_MIGraphX (OrtSessionOptions *options, int device_id) |
OrtStatus * | OrtSessionOptionsAppendExecutionProvider_Dnnl (OrtSessionOptions *options, int use_arena) |
OrtStatus * | OrtSessionOptionsAppendExecutionProvider_Tensorrt (OrtSessionOptions *options, int device_id) |
ONNX Runtime C API
#define ORT_API_VERSION 23 |
The API version defined in this header.
This value is used by some API functions to behave as this version of the header expects.
typedef OrtStatus *(* CreateEpApiFactoriesFn) (const char *registered_name, const OrtApiBase *ort_api_base, OrtEpFactory **factories, size_t max_factories, size_t *num_factories) |
The function signature that ORT will call to create OrtEpFactory instances.
This must be available in a function called 'CreateEpFactories' in the execution provider library.
[in] | registered_name | The name the execution library is registered with by RegisterExecutionProviderLibrary |
[in] | ort_api_base | The OrtApiBase instance that is used by the factory to get the OrtApi instance for the version of ORT that the library was compiled against. |
[in,out] | factories | The implementation should create and add OrtEpFactory instances to this pre-allocated array. i.e. usage is factories[0] = new MyEpFactory(); |
[in] | max_factories | The maximum number of OrtEpFactory instances that can be added to factories . Current default is to allow 4 factories. This can be increased in the future if needed. |
[out] | num_factories | The number of OrtEpFactory instances created by the factory and added to factories . |
typedef OrtStatus *( * EpSelectionDelegate) (const OrtEpDevice **ep_devices, size_t num_devices, const OrtKeyValuePairs *model_metadata, const OrtKeyValuePairs *runtime_metadata, const OrtEpDevice **selected, size_t max_selected, size_t *num_selected, void *state) |
Delegate to allow providing custom OrtEpDevice selection logic.
This delegate is called by the EP selection code to allow the user to provide custom device selection logic. The user can use this to select OrtEpDevice instances from the list of available devices.
ep_devices | The list of available devices. |
num_devices | The number of available devices. |
model_metadata | The model metadata. |
runtime_metadata | The runtime metadata. May be nullptr. |
selected | Pre-allocated array to populate with selected OrtEpDevice pointers from ep_devices. |
max_selected | The maximum number of devices that can be selected in the pre-allocated array. Currently the maximum is 8. |
num_selected | The number of selected devices. |
state | Opaque pointer. Required to use the delegate from other languages like C# and python. |
typedef enum ExecutionMode ExecutionMode |
typedef enum GraphOptimizationLevel GraphOptimizationLevel |
Graph optimization level.
Refer to https://www.onnxruntime.ai/docs/performance/graph-optimizations.html#graph-optimization-levels for an in-depth understanding of the Graph Optimization Levels.
typedef enum ONNXTensorElementDataType ONNXTensorElementDataType |
Copied from TensorProto::DataType Currently, Ort doesn't support complex64, complex128
typedef struct OrtAllocator OrtAllocator |
Memory allocation interface.
Structure of function pointers that defines a memory allocator. This can be created and filled in by the user for custom allocators.
When an allocator is passed to any function, be sure that the allocator object is not destroyed until the last allocated object using it is freed.
typedef enum OrtAllocatorType OrtAllocatorType |
typedef struct OrtApiBase OrtApiBase |
typedef struct OrtArenaCfg OrtArenaCfg |
typedef struct OrtCANNProviderOptions OrtCANNProviderOptions |
typedef struct OrtCompileApi OrtCompileApi |
typedef struct OrtCUDAProviderOptions OrtCUDAProviderOptions |
CUDA Provider Options.
typedef struct OrtCUDAProviderOptionsV2 OrtCUDAProviderOptionsV2 |
typedef enum OrtCudnnConvAlgoSearch OrtCudnnConvAlgoSearch |
Algorithm to use for cuDNN Convolution Op.
typedef OrtCustomThreadHandle(* OrtCustomCreateThreadFn) (void *ort_custom_thread_creation_options, OrtThreadWorkerFn ort_thread_worker_fn, void *ort_worker_fn_param) |
Ort custom thread creation function.
The function should return a thread handle to be used in onnxruntime thread pools Onnxruntime will throw exception on return value of nullptr or 0, indicating that the function failed to create a thread
typedef void(* OrtCustomJoinThreadFn) (OrtCustomThreadHandle ort_custom_thread_handle) |
Custom thread join function.
Onnxruntime thread pool destructor will call the function to join a custom thread. Argument ort_custom_thread_handle is the value returned by OrtCustomCreateThreadFn
typedef struct OrtCustomOp OrtCustomOp |
typedef struct OrtCustomOpDomain OrtCustomOpDomain |
typedef const struct OrtCustomHandleType* OrtCustomThreadHandle |
typedef struct OrtDnnlProviderOptions OrtDnnlProviderOptions |
typedef struct OrtEpDevice OrtEpDevice |
typedef struct OrtEpFactory OrtEpFactory |
typedef enum OrtErrorCode OrtErrorCode |
These are the default EP selection policies used by ORT when doing automatic EP selection.
typedef struct OrtHardwareDevice OrtHardwareDevice |
typedef enum OrtHardwareDeviceType OrtHardwareDeviceType |
typedef struct OrtIoBinding OrtIoBinding |
typedef struct OrtKernelContext OrtKernelContext |
typedef struct OrtKernelInfo OrtKernelInfo |
typedef struct OrtKeyValuePairs OrtKeyValuePairs |
typedef enum OrtLanguageProjection OrtLanguageProjection |
Language projection identifiers /see OrtApi::SetLanguageProjection.
typedef void( * OrtLoggingFunction) (void *param, OrtLoggingLevel severity, const char *category, const char *logid, const char *code_location, const char *message) |
typedef enum OrtLoggingLevel OrtLoggingLevel |
Logging severity levels.
In typical API usage, specifying a logging severity level specifies the minimum severity of log messages to show.
typedef struct OrtLoraAdapter OrtLoraAdapter |
typedef struct OrtMapTypeInfo OrtMapTypeInfo |
typedef struct OrtMemoryInfo OrtMemoryInfo |
typedef enum OrtMemoryInfoDeviceType OrtMemoryInfoDeviceType |
This mimics OrtDevice type constants so they can be returned in the API.
typedef enum OrtMemType OrtMemType |
Memory types for allocated memory, execution provider specific types should be extended in each provider.
typedef struct OrtMIGraphXProviderOptions OrtMIGraphXProviderOptions |
MIGraphX Provider Options.
typedef struct OrtModelCompilationOptions OrtModelCompilationOptions |
typedef struct OrtModelEditorApi OrtModelEditorApi |
typedef struct OrtModelMetadata OrtModelMetadata |
typedef struct OrtNvTensorRtRtxProviderOptions OrtNvTensorRtRtxProviderOptions |
typedef enum OrtOpAttrType OrtOpAttrType |
typedef struct OrtOpenVINOProviderOptions OrtOpenVINOProviderOptions |
OpenVINO Provider Options.
This Struct is frozen since ORT 1.13.0. Its maintained part of Legacy API for compatibility.
For latest OpenVINO Provider Options update to the ProviderOptions map.
Latest OpenVINO Provider Options are listed in the onnxruntime document.
typedef struct OrtOptionalTypeInfo OrtOptionalTypeInfo |
typedef struct OrtPrepackedWeightsContainer OrtPrepackedWeightsContainer |
typedef struct OrtROCMProviderOptions OrtROCMProviderOptions |
ROCM Provider Options.
typedef struct OrtRunOptions OrtRunOptions |
typedef struct OrtSequenceTypeInfo OrtSequenceTypeInfo |
typedef struct OrtSession OrtSession |
typedef struct OrtSessionOptions OrtSessionOptions |
typedef struct OrtShapeInferContext OrtShapeInferContext |
typedef enum OrtSparseFormat OrtSparseFormat |
typedef OrtStatus* OrtStatusPtr |
typedef struct OrtTensorRTProviderOptions OrtTensorRTProviderOptions |
TensorRT Provider Options.
typedef struct OrtTensorRTProviderOptionsV2 OrtTensorRTProviderOptionsV2 |
typedef struct OrtTensorTypeAndShapeInfo OrtTensorTypeAndShapeInfo |
typedef struct OrtThreadingOptions OrtThreadingOptions |
typedef struct OrtThreadPoolParams OrtThreadPoolParams |
typedef void(* OrtThreadWorkerFn) (void *ort_worker_fn_param) |
Thread work loop function.
Onnxruntime will provide the working loop on custom thread creation Argument is an onnxruntime built-in type which will be provided when thread pool calls OrtCustomCreateThreadFn
typedef struct OrtTrainingApi OrtTrainingApi |
typedef struct OrtTypeInfo OrtTypeInfo |
typedef struct OrtValueInfo OrtValueInfo |
typedef OrtStatus *( * RegisterCustomOpsFn) (OrtSessionOptions *options, const OrtApiBase *api) |
typedef OrtStatus *(* ReleaseEpApiFactoryFn) (OrtEpFactory *factory) |
The function signature that ORT will call to release an OrtEpFactory instance.
This must be available in a function called 'ReleaseEpFactory' in the execution provider library.
[in] | factory | The OrtEpFactory instance to release. |
typedef void(* RunAsyncCallbackFn) (void *user_data, OrtValue **outputs, size_t num_outputs, OrtStatusPtr status) |
Callback function for RunAsync.
[in] | user_data | User specific data that passed back to the callback |
[out] | outputs | On succeed, outputs host inference results, on error, the value will be nullptr |
[out] | num_outputs | Number of outputs, on error, the value will be zero |
[out] | status | On error, status will provide details |
enum ExecutionMode |
Graph optimization level.
Refer to https://www.onnxruntime.ai/docs/performance/graph-optimizations.html#graph-optimization-levels for an in-depth understanding of the Graph Optimization Levels.
Enumerator | |
---|---|
ORT_DISABLE_ALL | |
ORT_ENABLE_BASIC | |
ORT_ENABLE_EXTENDED | |
ORT_ENABLE_ALL |
Copied from TensorProto::DataType Currently, Ort doesn't support complex64, complex128
enum ONNXType |
enum OrtAllocatorType |
enum OrtErrorCode |
These are the default EP selection policies used by ORT when doing automatic EP selection.
Language projection identifiers /see OrtApi::SetLanguageProjection.
Enumerator | |
---|---|
ORT_PROJECTION_C | |
ORT_PROJECTION_CPLUSPLUS | |
ORT_PROJECTION_CSHARP | |
ORT_PROJECTION_PYTHON | |
ORT_PROJECTION_JAVA | |
ORT_PROJECTION_WINML | |
ORT_PROJECTION_NODEJS |
enum OrtLoggingLevel |
Logging severity levels.
In typical API usage, specifying a logging severity level specifies the minimum severity of log messages to show.
enum OrtMemType |
Memory types for allocated memory, execution provider specific types should be extended in each provider.
enum OrtOpAttrType |
enum OrtSparseFormat |
const OrtApiBase * OrtGetApiBase | ( | void | ) |
The Onnxruntime library's entry point to access the C API.
Call this to get the a pointer to an OrtApiBase
OrtStatus * OrtSessionOptionsAppendExecutionProvider_CUDA | ( | OrtSessionOptions * | options, |
int | device_id | ||
) |
OrtStatus * OrtSessionOptionsAppendExecutionProvider_Dnnl | ( | OrtSessionOptions * | options, |
int | use_arena | ||
) |
OrtStatus * OrtSessionOptionsAppendExecutionProvider_MIGraphX | ( | OrtSessionOptions * | options, |
int | device_id | ||
) |
OrtStatus * OrtSessionOptionsAppendExecutionProvider_ROCM | ( | OrtSessionOptions * | options, |
int | device_id | ||
) |
OrtStatus * OrtSessionOptionsAppendExecutionProvider_Tensorrt | ( | OrtSessionOptions * | options, |
int | device_id | ||
) |