OnnxRuntime
Global

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
 

Macros

#define ORT_API_VERSION   13
 The API version defined in this header. More...
 

Typedefs

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 OrtSessionOptions OrtSessionOptions
 
typedef struct OrtCustomOpDomain OrtCustomOpDomain
 
typedef struct OrtMapTypeInfo OrtMapTypeInfo
 
typedef struct OrtSequenceTypeInfo OrtSequenceTypeInfo
 
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 OrtCUDAProviderOptionsV2 OrtCUDAProviderOptionsV2
 
typedef struct OrtOp OrtOp
 
typedef struct OrtOpAttr OrtOpAttr
 
typedef OrtStatusOrtStatusPtr
 
typedef void(* OrtLoggingFunction) (void *param, OrtLoggingLevel severity, const char *category, const char *logid, const char *code_location, const char *message)
 
typedef struct OrtKernelInfo OrtKernelInfo
 
typedef struct OrtKernelContext OrtKernelContext
 
typedef struct OrtTrainingApi OrtTrainingApi
 
typedef void(* OrtThreadWorkerFn) (void *ort_worker_fn_param)
 Thread work loop function. More...
 
typedef const struct OrtCustomHandleTypeOrtCustomThreadHandle
 
typedef OrtCustomThreadHandle(* OrtCustomCreateThreadFn) (void *ort_custom_thread_creation_options, OrtThreadWorkerFn ort_thread_worker_fn, void *ort_worker_fn_param)
 Ort custom thread creation function. More...
 
typedef void(* OrtCustomJoinThreadFn) (OrtCustomThreadHandle ort_custom_thread_handle)
 Custom thread join function. More...
 

Enumerations

enum  ONNXTensorElementDataType {
  ONNX_TENSOR_ELEMENT_DATA_TYPE_UNDEFINED , ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT , ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT8 , ONNX_TENSOR_ELEMENT_DATA_TYPE_INT8 ,
  ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT16 , ONNX_TENSOR_ELEMENT_DATA_TYPE_INT16 , ONNX_TENSOR_ELEMENT_DATA_TYPE_INT32 , ONNX_TENSOR_ELEMENT_DATA_TYPE_INT64 ,
  ONNX_TENSOR_ELEMENT_DATA_TYPE_STRING , ONNX_TENSOR_ELEMENT_DATA_TYPE_BOOL , ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT16 , ONNX_TENSOR_ELEMENT_DATA_TYPE_DOUBLE ,
  ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT32 , ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT64 , ONNX_TENSOR_ELEMENT_DATA_TYPE_COMPLEX64 , ONNX_TENSOR_ELEMENT_DATA_TYPE_COMPLEX128 ,
  ONNX_TENSOR_ELEMENT_DATA_TYPE_BFLOAT16
}
 
enum  ONNXType {
  ONNX_TYPE_UNKNOWN , ONNX_TYPE_TENSOR , ONNX_TYPE_SEQUENCE , ONNX_TYPE_MAP ,
  ONNX_TYPE_OPAQUE , ONNX_TYPE_SPARSETENSOR , ONNX_TYPE_OPTIONAL
}
 
enum  OrtSparseFormat { ORT_SPARSE_UNDEFINED = 0 , ORT_SPARSE_COO = 0x1 , ORT_SPARSE_CSRC = 0x2 , ORT_SPARSE_BLOCK_SPARSE = 0x4 }
 
enum  OrtSparseIndicesFormat { ORT_SPARSE_COO_INDICES , ORT_SPARSE_CSR_INNER_INDICES , ORT_SPARSE_CSR_OUTER_INDICES , ORT_SPARSE_BLOCK_SPARSE_INDICES }
 
enum  OrtLoggingLevel {
  ORT_LOGGING_LEVEL_VERBOSE , ORT_LOGGING_LEVEL_INFO , ORT_LOGGING_LEVEL_WARNING , ORT_LOGGING_LEVEL_ERROR ,
  ORT_LOGGING_LEVEL_FATAL
}
 Logging severity levels. More...
 
enum  OrtErrorCode {
  ORT_OK , ORT_FAIL , ORT_INVALID_ARGUMENT , ORT_NO_SUCHFILE ,
  ORT_NO_MODEL , ORT_ENGINE_ERROR , ORT_RUNTIME_EXCEPTION , ORT_INVALID_PROTOBUF ,
  ORT_MODEL_LOADED , ORT_NOT_IMPLEMENTED , ORT_INVALID_GRAPH , ORT_EP_FAIL
}
 
enum  OrtOpAttrType {
  ORT_OP_ATTR_UNDEFINED = 0 , ORT_OP_ATTR_INT , ORT_OP_ATTR_INTS , ORT_OP_ATTR_FLOAT ,
  ORT_OP_ATTR_FLOATS , ORT_OP_ATTR_STRING , ORT_OP_ATTR_STRINGS
}
 
enum  GraphOptimizationLevel { ORT_DISABLE_ALL = 0 , ORT_ENABLE_BASIC = 1 , ORT_ENABLE_EXTENDED = 2 , ORT_ENABLE_ALL = 99 }
 Graph optimization level. More...
 
enum  ExecutionMode { ORT_SEQUENTIAL = 0 , ORT_PARALLEL = 1 }
 
enum  OrtLanguageProjection {
  ORT_PROJECTION_C = 0 , ORT_PROJECTION_CPLUSPLUS = 1 , ORT_PROJECTION_CSHARP = 2 , ORT_PROJECTION_PYTHON = 3 ,
  ORT_PROJECTION_JAVA = 4 , ORT_PROJECTION_WINML = 5 , ORT_PROJECTION_NODEJS = 6
}
 Language projection identifiers /see OrtApi::SetLanguageProjection. More...
 
enum  OrtAllocatorType { OrtInvalidAllocator = -1 , OrtDeviceAllocator = 0 , OrtArenaAllocator = 1 }
 
enum  OrtMemType { OrtMemTypeCPUInput = -2 , OrtMemTypeCPUOutput = -1 , OrtMemTypeCPU = OrtMemTypeCPUOutput , OrtMemTypeDefault = 0 }
 Memory types for allocated memory, execution provider specific types should be extended in each provider. More...
 
enum  OrtCudnnConvAlgoSearch { OrtCudnnConvAlgoSearchExhaustive , OrtCudnnConvAlgoSearchHeuristic , OrtCudnnConvAlgoSearchDefault }
 Algorithm to use for cuDNN Convolution Op. More...
 
enum  OrtCustomOpInputOutputCharacteristic { INPUT_OUTPUT_REQUIRED = 0 , INPUT_OUTPUT_OPTIONAL }
 

Functions

const OrtApiBaseOrtGetApiBase (void)
 The Onnxruntime library's entry point to access the C API. More...
 
OrtStatusOrtSessionOptionsAppendExecutionProvider_CUDA (OrtSessionOptions *options, int device_id)
 
OrtStatusOrtSessionOptionsAppendExecutionProvider_MIGraphX (OrtSessionOptions *options, int device_id)
 

Detailed Description

ONNX Runtime C API

Macro Definition Documentation

◆ ORT_API_VERSION

#define ORT_API_VERSION   13

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 Documentation

◆ OrtArenaCfg

typedef struct OrtArenaCfg OrtArenaCfg

◆ OrtCUDAProviderOptionsV2

◆ OrtCustomCreateThreadFn

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

◆ OrtCustomJoinThreadFn

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

◆ OrtCustomOpDomain

◆ OrtCustomThreadHandle

◆ OrtEnv

typedef struct OrtEnv OrtEnv

◆ OrtIoBinding

typedef struct OrtIoBinding OrtIoBinding

◆ OrtKernelContext

◆ OrtKernelInfo

typedef struct OrtKernelInfo OrtKernelInfo

◆ OrtLoggingFunction

typedef void( * OrtLoggingFunction) (void *param, OrtLoggingLevel severity, const char *category, const char *logid, const char *code_location, const char *message)

◆ OrtMapTypeInfo

◆ OrtMemoryInfo

typedef struct OrtMemoryInfo OrtMemoryInfo

◆ OrtModelMetadata

◆ OrtOp

typedef struct OrtOp OrtOp

◆ OrtOpAttr

typedef struct OrtOpAttr OrtOpAttr

◆ OrtPrepackedWeightsContainer

◆ OrtRunOptions

typedef struct OrtRunOptions OrtRunOptions

◆ OrtSequenceTypeInfo

◆ OrtSession

typedef struct OrtSession OrtSession

◆ OrtSessionOptions

◆ OrtStatus

typedef struct OrtStatus OrtStatus

◆ OrtStatusPtr

◆ OrtTensorRTProviderOptionsV2

◆ OrtTensorTypeAndShapeInfo

◆ OrtThreadingOptions

◆ OrtThreadPoolParams

◆ OrtThreadWorkerFn

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

◆ OrtTrainingApi

◆ OrtTypeInfo

typedef struct OrtTypeInfo OrtTypeInfo

◆ OrtValue

typedef struct OrtValue OrtValue

Enumeration Type Documentation

◆ ExecutionMode

Enumerator
ORT_SEQUENTIAL 
ORT_PARALLEL 

◆ GraphOptimizationLevel

Graph optimization level.

Refer to https://www.onnxruntime.ai/docs/resources/graph-optimizations.html for an in-depth understanding of Graph Optimizations

Enumerator
ORT_DISABLE_ALL 
ORT_ENABLE_BASIC 
ORT_ENABLE_EXTENDED 
ORT_ENABLE_ALL 

◆ ONNXTensorElementDataType

Copied from TensorProto::DataType Currently, Ort doesn't support complex64, complex128

Enumerator
ONNX_TENSOR_ELEMENT_DATA_TYPE_UNDEFINED 
ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT 
ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT8 
ONNX_TENSOR_ELEMENT_DATA_TYPE_INT8 
ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT16 
ONNX_TENSOR_ELEMENT_DATA_TYPE_INT16 
ONNX_TENSOR_ELEMENT_DATA_TYPE_INT32 
ONNX_TENSOR_ELEMENT_DATA_TYPE_INT64 
ONNX_TENSOR_ELEMENT_DATA_TYPE_STRING 
ONNX_TENSOR_ELEMENT_DATA_TYPE_BOOL 
ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT16 
ONNX_TENSOR_ELEMENT_DATA_TYPE_DOUBLE 
ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT32 
ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT64 
ONNX_TENSOR_ELEMENT_DATA_TYPE_COMPLEX64 
ONNX_TENSOR_ELEMENT_DATA_TYPE_COMPLEX128 
ONNX_TENSOR_ELEMENT_DATA_TYPE_BFLOAT16 

◆ ONNXType

enum ONNXType
Enumerator
ONNX_TYPE_UNKNOWN 
ONNX_TYPE_TENSOR 
ONNX_TYPE_SEQUENCE 
ONNX_TYPE_MAP 
ONNX_TYPE_OPAQUE 
ONNX_TYPE_SPARSETENSOR 
ONNX_TYPE_OPTIONAL 

◆ OrtAllocatorType

Enumerator
OrtInvalidAllocator 
OrtDeviceAllocator 
OrtArenaAllocator 

◆ OrtCudnnConvAlgoSearch

Algorithm to use for cuDNN Convolution Op.

Enumerator
OrtCudnnConvAlgoSearchExhaustive 
OrtCudnnConvAlgoSearchHeuristic 
OrtCudnnConvAlgoSearchDefault 

◆ OrtCustomOpInputOutputCharacteristic

Enumerator
INPUT_OUTPUT_REQUIRED 
INPUT_OUTPUT_OPTIONAL 

◆ OrtErrorCode

Enumerator
ORT_OK 
ORT_FAIL 
ORT_INVALID_ARGUMENT 
ORT_NO_SUCHFILE 
ORT_NO_MODEL 
ORT_ENGINE_ERROR 
ORT_RUNTIME_EXCEPTION 
ORT_INVALID_PROTOBUF 
ORT_MODEL_LOADED 
ORT_NOT_IMPLEMENTED 
ORT_INVALID_GRAPH 
ORT_EP_FAIL 

◆ OrtLanguageProjection

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 

◆ OrtLoggingLevel

Logging severity levels.

In typical API usage, specifying a logging severity level specifies the minimum severity of log messages to show.

Enumerator
ORT_LOGGING_LEVEL_VERBOSE 

Verbose informational messages (least severe).

ORT_LOGGING_LEVEL_INFO 

Informational messages.

ORT_LOGGING_LEVEL_WARNING 

Warning messages.

ORT_LOGGING_LEVEL_ERROR 

Error messages.

ORT_LOGGING_LEVEL_FATAL 

Fatal error messages (most severe).

◆ OrtMemType

enum OrtMemType

Memory types for allocated memory, execution provider specific types should be extended in each provider.

Enumerator
OrtMemTypeCPUInput 

Any CPU memory used by non-CPU execution provider.

OrtMemTypeCPUOutput 

CPU accessible memory outputted by non-CPU execution provider, i.e. CUDA_PINNED.

OrtMemTypeCPU 

Temporary CPU accessible memory allocated by non-CPU execution provider, i.e. CUDA_PINNED.

OrtMemTypeDefault 

The default allocator for execution provider.

◆ OrtOpAttrType

Enumerator
ORT_OP_ATTR_UNDEFINED 
ORT_OP_ATTR_INT 
ORT_OP_ATTR_INTS 
ORT_OP_ATTR_FLOAT 
ORT_OP_ATTR_FLOATS 
ORT_OP_ATTR_STRING 
ORT_OP_ATTR_STRINGS 

◆ OrtSparseFormat

Enumerator
ORT_SPARSE_UNDEFINED 
ORT_SPARSE_COO 
ORT_SPARSE_CSRC 
ORT_SPARSE_BLOCK_SPARSE 

◆ OrtSparseIndicesFormat

Enumerator
ORT_SPARSE_COO_INDICES 
ORT_SPARSE_CSR_INNER_INDICES 
ORT_SPARSE_CSR_OUTER_INDICES 
ORT_SPARSE_BLOCK_SPARSE_INDICES 

Function Documentation

◆ OrtGetApiBase()

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

◆ OrtSessionOptionsAppendExecutionProvider_CUDA()

OrtStatus * OrtSessionOptionsAppendExecutionProvider_CUDA ( OrtSessionOptions options,
int  device_id 
)

◆ OrtSessionOptionsAppendExecutionProvider_MIGraphX()

OrtStatus * OrtSessionOptionsAppendExecutionProvider_MIGraphX ( OrtSessionOptions options,
int  device_id 
)