HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OrtApi Struct Reference

The C API. More...

#include <onnxruntime_c_api.h>

Public Member Functions

 ORT_API2_STATUS (SynchronizeBoundInputs, _Inout_ OrtIoBinding *binding_ptr)
 Synchronize bound inputs. The call may be necessary for some providers, such as cuda, in case the system that allocated bound memory operated on a different stream. However, the operation is provider specific and could be a no-op. More...
 
 ORT_API2_STATUS (SynchronizeBoundOutputs, _Inout_ OrtIoBinding *binding_ptr)
 Synchronize bound outputs. The call may be necessary for some providers, such as cuda, in case the system that allocated bound memory operated on a different stream. However, the operation is provider specific and could be a no-op. More...
 
 ORT_API2_STATUS (SessionOptionsAppendExecutionProvider_MIGraphX, _In_ OrtSessionOptions *options, _In_ const OrtMIGraphXProviderOptions *migraphx_options)
 Append MIGraphX provider to session options. More...
 
 ORT_API2_STATUS (AddExternalInitializers, _In_ OrtSessionOptions *options, _In_reads_(input_len) const char *const *initializer_names, _In_reads_(input_len) const OrtValue *const *initializers, size_t initializers_num)
 Replace initialized Tensors with external data with the data provided in initializers. More...
 
 ORT_API2_STATUS (CreateOpAttr, _In_ const char *name, _In_ const void *data, _In_ int len, _In_ OrtOpAttrType type, _Outptr_ OrtOpAttr **op_attr)
 : Create attribute of onnxruntime operator More...
 
 ORT_CLASS_RELEASE (OpAttr)
 
 ORT_API2_STATUS (CreateOp, _In_ const OrtKernelInfo *info, _In_ const char *op_name, _In_ const char *domain, _In_ int version, _In_opt_ const char **type_constraint_names, _In_opt_ const ONNXTensorElementDataType *type_constraint_values, _In_opt_ int type_constraint_count, _In_opt_ const OrtOpAttr *const *attr_values, _In_opt_ int attr_count, _In_ int input_count, _In_ int output_count, _Outptr_ OrtOp **ort_op)
 : Create onnxruntime native operator More...
 
 ORT_API2_STATUS (InvokeOp, _In_ const OrtKernelContext *context, _In_ const OrtOp *ort_op, _In_ const OrtValue *const *input_values, _In_ int input_count, _Inout_ OrtValue *const *output_values, _In_ int output_count)
 : Invoke the operator created by OrtApi::CreateOp The inputs must follow the order as specified in onnx specification More...
 
 ORT_CLASS_RELEASE (Op)
 
 ORT_API2_STATUS (SessionOptionsAppendExecutionProvider, _In_ OrtSessionOptions *options, _In_ const char *provider_name, _In_reads_(num_keys) const char *const *provider_options_keys, _In_reads_(num_keys) const char *const *provider_options_values, _In_ size_t num_keys)
 : Append execution provider to the session options. More...
 
 ORT_API2_STATUS (CopyKernelInfo, _In_ const OrtKernelInfo *info, _Outptr_ OrtKernelInfo **info_copy)
 
 ORT_CLASS_RELEASE (KernelInfo)
 
const OrtTrainingApi
*ORT_API_CALL
GetTrainingApi (uint32_t version) NO_EXCEPTION
 
 ORT_API2_STATUS (SessionOptionsAppendExecutionProvider_CANN, _In_ OrtSessionOptions *options, _In_ const OrtCANNProviderOptions *cann_options)
 Append CANN provider to session options. More...
 
 ORT_API2_STATUS (CreateCANNProviderOptions, _Outptr_ OrtCANNProviderOptions **out)
 Create an OrtCANNProviderOptions. More...
 
 ORT_API2_STATUS (UpdateCANNProviderOptions, _Inout_ OrtCANNProviderOptions *cann_options, _In_reads_(num_keys) const char *const *provider_options_keys, _In_reads_(num_keys) const char *const *provider_options_values, _In_ size_t num_keys)
 Set options in a CANN Execution Provider. More...
 
 ORT_API2_STATUS (GetCANNProviderOptionsAsString, _In_ const OrtCANNProviderOptions *cann_options, _Inout_ OrtAllocator *allocator, _Outptr_ char **ptr)
 Get serialized CANN provider options string. More...
 
 void (ORT_API_CALL *ReleaseCANNProviderOptions)(_Frees_ptr_opt_ OrtCANNProviderOptions *input)
 Release an OrtCANNProviderOptions. More...
 
 void (ORT_API_CALL *MemoryInfoGetDeviceType)(_In_ const OrtMemoryInfo *ptr
 
 ORT_API2_STATUS (UpdateEnvWithCustomLogLevel, _In_ OrtEnv *ort_env, OrtLoggingLevel log_severity_level)
 
 ORT_API2_STATUS (SetGlobalIntraOpThreadAffinity, _Inout_ OrtThreadingOptions *tp_options, const char *affinity_string)
 
 ORT_API2_STATUS (RegisterCustomOpsLibrary_V2, _Inout_ OrtSessionOptions *options, _In_ const ORTCHAR_T *library_name)
 Register custom ops from a shared library. More...
 
 ORT_API2_STATUS (RegisterCustomOpsUsingFunction, _Inout_ OrtSessionOptions *options, _In_ const char *registration_func_name)
 Register custom ops by calling a RegisterCustomOpsFn function. More...
 

Public Attributes

_Out_ OrtMemoryInfoDeviceTypeout
 

OrtStatus

OrtStatus *ORT_API_CALLCreateStatus (OrtErrorCode code, _In_ const char *msg) NO_EXCEPTION ORT_ALL_ARGS_NONNULL
 Create an OrtStatus from a null terminated string. More...
 
 OrtErrorCode (ORT_API_CALL *GetErrorCode)(_In_ const OrtStatus *status) NO_EXCEPTION ORT_ALL_ARGS_NONNULL
 Get OrtErrorCode from OrtStatus. More...
 
const char *ORT_API_CALLGetErrorMessage (_In_ const OrtStatus *status) NO_EXCEPTION ORT_ALL_ARGS_NONNULL
 Get error string from OrtStatus. More...
 
 ORT_CLASS_RELEASE (Status)
 Create an OrtStatus from a null terminated string. More...
 

OrtEnv

 ORT_API2_STATUS (CreateEnv, OrtLoggingLevel log_severity_level, _In_ const char *logid, _Outptr_ OrtEnv **out)
 Create an OrtEnv. More...
 
 ORT_API2_STATUS (CreateEnvWithCustomLogger, OrtLoggingFunction logging_function, _In_opt_ void *logger_param, OrtLoggingLevel log_severity_level, _In_ const char *logid, _Outptr_ OrtEnv **out)
 Create an OrtEnv. More...
 
 ORT_API2_STATUS (EnableTelemetryEvents, _In_ const OrtEnv *env)
 Enable Telemetry. More...
 
 ORT_API2_STATUS (DisableTelemetryEvents, _In_ const OrtEnv *env)
 Disable Telemetry. More...
 
 ORT_CLASS_RELEASE (Env)
 Create an OrtEnv. More...
 
 ORT_API2_STATUS (CreateEnvWithGlobalThreadPools, OrtLoggingLevel log_severity_level, _In_ const char *logid, _In_ const OrtThreadingOptions *tp_options, _Outptr_ OrtEnv **out)
 Create an OrtEnv. More...
 
 ORT_API2_STATUS (CreateAndRegisterAllocator, _Inout_ OrtEnv *env, _In_ const OrtMemoryInfo *mem_info, _In_ const OrtArenaCfg *arena_cfg)
 Create an allocator and register it with the ::OrtEnv. More...
 
 ORT_API2_STATUS (SetLanguageProjection, _In_ const OrtEnv *ort_env, _In_ OrtLanguageProjection projection)
 Set language projection. More...
 
 ORT_API2_STATUS (CreateEnvWithCustomLoggerAndGlobalThreadPools, OrtLoggingFunction logging_function, _In_opt_ void *logger_param, OrtLoggingLevel log_severity_level, _In_ const char *logid, _In_ const struct OrtThreadingOptions *tp_options, _Outptr_ OrtEnv **out)
 

OrtSession

 ORT_API2_STATUS (CreateSession, _In_ const OrtEnv *env, _In_ const ORTCHAR_T *model_path, _In_ const OrtSessionOptions *options, _Outptr_ OrtSession **out)
 Create an OrtSession from a model file. More...
 
 ORT_API2_STATUS (CreateSessionFromArray, _In_ const OrtEnv *env, _In_ const void *model_data, size_t model_data_length, _In_ const OrtSessionOptions *options, _Outptr_ OrtSession **out)
 Create an OrtSession from memory. More...
 
 ORT_API2_STATUS (Run, _Inout_ OrtSession *session, _In_opt_ const OrtRunOptions *run_options, _In_reads_(input_len) const char *const *input_names, _In_reads_(input_len) const OrtValue *const *inputs, size_t input_len, _In_reads_(output_names_len) const char *const *output_names, size_t output_names_len, _Inout_updates_all_(output_names_len) OrtValue **outputs)
 Run the model in an ::OrtSession. More...
 
 ORT_API2_STATUS (SessionGetInputCount, _In_ const OrtSession *session, _Out_ size_t *out)
 Get input count for a session. More...
 
 ORT_API2_STATUS (SessionGetOutputCount, _In_ const OrtSession *session, _Out_ size_t *out)
 Get output count for a session. More...
 
 ORT_API2_STATUS (SessionGetOverridableInitializerCount, _In_ const OrtSession *session, _Out_ size_t *out)
 Get overridable initializer count. More...
 
 ORT_API2_STATUS (SessionGetInputTypeInfo, _In_ const OrtSession *session, size_t index, _Outptr_ OrtTypeInfo **type_info)
 Get input type information. More...
 
 ORT_API2_STATUS (SessionGetOutputTypeInfo, _In_ const OrtSession *session, size_t index, _Outptr_ OrtTypeInfo **type_info)
 Get output type information. More...
 
 ORT_API2_STATUS (SessionGetOverridableInitializerTypeInfo, _In_ const OrtSession *session, size_t index, _Outptr_ OrtTypeInfo **type_info)
 Get overridable initializer type information. More...
 
 ORT_API2_STATUS (SessionGetInputName, _In_ const OrtSession *session, size_t index, _Inout_ OrtAllocator *allocator, _Outptr_ char **value)
 Get input name. More...
 
 ORT_API2_STATUS (SessionGetOutputName, _In_ const OrtSession *session, size_t index, _Inout_ OrtAllocator *allocator, _Outptr_ char **value)
 Get output name. More...
 
 ORT_API2_STATUS (SessionGetOverridableInitializerName, _In_ const OrtSession *session, size_t index, _Inout_ OrtAllocator *allocator, _Outptr_ char **value)
 Get overridable initializer name. More...
 
 ORT_CLASS_RELEASE (Session)
 Create an OrtSession from a model file. More...
 
 ORT_API2_STATUS (SessionEndProfiling, _In_ OrtSession *session, _Inout_ OrtAllocator *allocator, _Outptr_ char **out)
 End profiling and return filename of the profile data. More...
 
 ORT_API2_STATUS (SessionGetModelMetadata, _In_ const OrtSession *session, _Outptr_ OrtModelMetadata **out)
 Get ::OrtModelMetadata from an ::OrtSession. More...
 
 ORT_API2_STATUS (RunWithBinding, _Inout_ OrtSession *session, _In_ const OrtRunOptions *run_options, _In_ const OrtIoBinding *binding_ptr)
 Run a model using Io Bindings for the inputs & outputs. More...
 
 ORT_API2_STATUS (CreateIoBinding, _Inout_ OrtSession *session, _Outptr_ OrtIoBinding **out)
 Create an ::OrtIoBinding instance. More...
 
 ORT_API2_STATUS (SessionGetProfilingStartTimeNs, _In_ const OrtSession *session, _Outptr_ uint64_t *out)
 Return the time that profiling was started. More...
 
 ORT_API2_STATUS (CreateSessionWithPrepackedWeightsContainer, _In_ const OrtEnv *env, _In_ const ORTCHAR_T *model_path, _In_ const OrtSessionOptions *options, _Inout_ OrtPrepackedWeightsContainer *prepacked_weights_container, _Outptr_ OrtSession **out)
 Create session with prepacked weights container. More...
 
 ORT_API2_STATUS (CreateSessionFromArrayWithPrepackedWeightsContainer, _In_ const OrtEnv *env, _In_ const void *model_data, size_t model_data_length, _In_ const OrtSessionOptions *options, _Inout_ OrtPrepackedWeightsContainer *prepacked_weights_container, _Outptr_ OrtSession **out)
 Create session from memory with prepacked weights container. More...
 

OrtSessionOptions

Custom operator APIs

 ORT_API2_STATUS (CreateSessionOptions, _Outptr_ OrtSessionOptions **options)
 Create an ::OrtSessionOptions object. More...
 
 ORT_API2_STATUS (SetOptimizedModelFilePath, _Inout_ OrtSessionOptions *options, _In_ const ORTCHAR_T *optimized_model_filepath)
 Set filepath to save optimized model after graph level transformations. More...
 
 ORT_API2_STATUS (CloneSessionOptions, _In_ const OrtSessionOptions *in_options, _Outptr_ OrtSessionOptions **out_options)
 Create a copy of an existing ::OrtSessionOptions. More...
 
 ORT_API2_STATUS (SetSessionExecutionMode, _Inout_ OrtSessionOptions *options, ExecutionMode execution_mode)
 Set execution mode. More...
 
 ORT_API2_STATUS (EnableProfiling, _Inout_ OrtSessionOptions *options, _In_ const ORTCHAR_T *profile_file_prefix)
 Enable profiling for a session. More...
 
 ORT_API2_STATUS (DisableProfiling, _Inout_ OrtSessionOptions *options)
 Disable profiling for a session. More...
 
 ORT_API2_STATUS (EnableMemPattern, _Inout_ OrtSessionOptions *options)
 Enable the memory pattern optimization. More...
 
 ORT_API2_STATUS (DisableMemPattern, _Inout_ OrtSessionOptions *options)
 Disable the memory pattern optimization. More...
 
 ORT_API2_STATUS (EnableCpuMemArena, _Inout_ OrtSessionOptions *options)
 Enable the memory arena on CPU. More...
 
 ORT_API2_STATUS (DisableCpuMemArena, _Inout_ OrtSessionOptions *options)
 Disable the memory arena on CPU. More...
 
 ORT_API2_STATUS (SetSessionLogId, _Inout_ OrtSessionOptions *options, const char *logid)
 Set session log id. More...
 
 ORT_API2_STATUS (SetSessionLogVerbosityLevel, _Inout_ OrtSessionOptions *options, int session_log_verbosity_level)
 Set session log verbosity level. More...
 
 ORT_API2_STATUS (SetSessionLogSeverityLevel, _Inout_ OrtSessionOptions *options, int session_log_severity_level)
 Set session log severity level. More...
 
 ORT_API2_STATUS (SetSessionGraphOptimizationLevel, _Inout_ OrtSessionOptions *options, GraphOptimizationLevel graph_optimization_level)
 Set the optimization level to apply when loading a graph. More...
 
 ORT_API2_STATUS (SetIntraOpNumThreads, _Inout_ OrtSessionOptions *options, int intra_op_num_threads)
 Sets the number of threads used to parallelize the execution within nodes. More...
 
 ORT_API2_STATUS (SetInterOpNumThreads, _Inout_ OrtSessionOptions *options, int inter_op_num_threads)
 Sets the number of threads used to parallelize the execution of the graph. More...
 
 ORT_API2_STATUS (AddCustomOpDomain, _Inout_ OrtSessionOptions *options, _In_ OrtCustomOpDomain *custom_op_domain)
 Add custom op domain to a session options. More...
 
 ORT_API2_STATUS (RegisterCustomOpsLibrary, _Inout_ OrtSessionOptions *options, _In_ const char *library_path, _Outptr_ void **library_handle)
 
 ORT_API2_STATUS (AddFreeDimensionOverride, _Inout_ OrtSessionOptions *options, _In_ const char *dim_denotation, _In_ int64_t dim_value)
 Override session symbolic dimensions. More...
 
 ORT_CLASS_RELEASE (SessionOptions)
 Create an ::OrtSessionOptions object. More...
 
 ORT_API2_STATUS (DisablePerSessionThreads, _Inout_ OrtSessionOptions *options)
 Use global thread pool on a session. More...
 
 ORT_API2_STATUS (AddFreeDimensionOverrideByName, _Inout_ OrtSessionOptions *options, _In_ const char *dim_name, _In_ int64_t dim_value)
 
 ORT_API2_STATUS (AddSessionConfigEntry, _Inout_ OrtSessionOptions *options, _In_z_ const char *config_key, _In_z_ const char *config_value)
 Set a session configuration entry as a pair of strings. More...
 
 ORT_API2_STATUS (AddInitializer, _Inout_ OrtSessionOptions *options, _In_z_ const char *name, _In_ const OrtValue *val)
 Add a pre-allocated initializer to a session. More...
 
 ORT_API2_STATUS (SessionOptionsAppendExecutionProvider_CUDA, _In_ OrtSessionOptions *options, _In_ const OrtCUDAProviderOptions *cuda_options)
 Append CUDA provider to session options. More...
 
 ORT_API2_STATUS (SessionOptionsAppendExecutionProvider_ROCM, _In_ OrtSessionOptions *options, _In_ const OrtROCMProviderOptions *rocm_options)
 Append ROCM execution provider to the session options. More...
 
 ORT_API2_STATUS (SessionOptionsAppendExecutionProvider_OpenVINO, _In_ OrtSessionOptions *options, _In_ const OrtOpenVINOProviderOptions *provider_options)
 Append OpenVINO execution provider to the session options. More...
 
 ORT_API2_STATUS (SessionOptionsAppendExecutionProvider_TensorRT, _In_ OrtSessionOptions *options, _In_ const OrtTensorRTProviderOptions *tensorrt_options)
 Append TensorRT provider to session options. More...
 
 ORT_API2_STATUS (SessionOptionsAppendExecutionProvider_TensorRT_V2, _In_ OrtSessionOptions *options, _In_ const OrtTensorRTProviderOptionsV2 *tensorrt_options)
 Append TensorRT execution provider to the session options. More...
 
 ORT_API2_STATUS (EnableOrtCustomOps, _Inout_ OrtSessionOptions *options)
 Enable custom operators. More...
 
 ORT_API2_STATUS (HasValue, _In_ const OrtValue *value, _Out_ int *out)
 Sets out to 1 iff an optional type OrtValue has an element, 0 otherwise (OrtValue is None) Use this API to find if the optional type OrtValue is None or not. If the optional type OrtValue is not None, use the OrtValue just like any other OrtValue. For example, if you get an OrtValue that corresponds to Optional(tensor) and if HasValue() returns true, use it as tensor and so on. More...
 
 ORT_API2_STATUS (SessionOptionsAppendExecutionProvider_CUDA_V2, _In_ OrtSessionOptions *options, _In_ const OrtCUDAProviderOptionsV2 *cuda_options)
 Append CUDA execution provider to the session options. More...
 
 ORT_API2_STATUS (HasSessionConfigEntry, _In_ const OrtSessionOptions *options, _In_z_ const char *config_key, _Out_ int *out)
 Checks if the given session configuration entry exists. More...
 
 ORT_API2_STATUS (GetSessionConfigEntry, _In_ const OrtSessionOptions *options, _In_z_ const char *config_key, _Out_ char *config_value, _Inout_ size_t *size)
 Get a session configuration value. More...
 

OrtCustomOpDomain

 ORT_API2_STATUS (CreateCustomOpDomain, _In_ const char *domain, _Outptr_ OrtCustomOpDomain **out)
 Create a custom op domain. More...
 
 ORT_API2_STATUS (CustomOpDomain_Add, _Inout_ OrtCustomOpDomain *custom_op_domain, _In_ const OrtCustomOp *op)
 Add a custom op to a custom op domain. More...
 
 ORT_CLASS_RELEASE (CustomOpDomain)
 Create a custom op domain. More...
 

OrtRunOptions

 ORT_API2_STATUS (CreateRunOptions, _Outptr_ OrtRunOptions **out)
 Create an OrtRunOptions. More...
 
 ORT_API2_STATUS (RunOptionsSetRunLogVerbosityLevel, _Inout_ OrtRunOptions *options, int log_verbosity_level)
 Set per-run log verbosity level. More...
 
 ORT_API2_STATUS (RunOptionsSetRunLogSeverityLevel, _Inout_ OrtRunOptions *options, int log_severity_level)
 Set per-run log severity level. More...
 
 ORT_API2_STATUS (RunOptionsSetRunTag, _Inout_ OrtRunOptions *options, _In_ const char *run_tag)
 Set per-run tag. More...
 
 ORT_API2_STATUS (RunOptionsGetRunLogVerbosityLevel, _In_ const OrtRunOptions *options, _Out_ int *log_verbosity_level)
 Get per-run log verbosity level. More...
 
 ORT_API2_STATUS (RunOptionsGetRunLogSeverityLevel, _In_ const OrtRunOptions *options, _Out_ int *log_severity_level)
 Get per-run log severity level. More...
 
 ORT_API2_STATUS (RunOptionsGetRunTag, _In_ const OrtRunOptions *options, _Out_ const char **run_tag)
 Get per-run tag. More...
 
 ORT_API2_STATUS (RunOptionsSetTerminate, _Inout_ OrtRunOptions *options)
 Set terminate flag. More...
 
 ORT_API2_STATUS (RunOptionsUnsetTerminate, _Inout_ OrtRunOptions *options)
 Clears the terminate flag. More...
 
 ORT_CLASS_RELEASE (RunOptions)
 Create an OrtRunOptions. More...
 
 ORT_API2_STATUS (AddRunConfigEntry, _Inout_ OrtRunOptions *options, _In_z_ const char *config_key, _In_z_ const char *config_value)
 Set a single run configuration entry as a pair of strings. More...
 

OrtValue

 ORT_API2_STATUS (CreateTensorAsOrtValue, _Inout_ OrtAllocator *allocator, _In_ const int64_t *shape, size_t shape_len, ONNXTensorElementDataType type, _Outptr_ OrtValue **out)
 Create a tensor. More...
 
 ORT_API2_STATUS (CreateTensorWithDataAsOrtValue, _In_ const OrtMemoryInfo *info, _Inout_ void *p_data, size_t p_data_len, _In_ const int64_t *shape, size_t shape_len, ONNXTensorElementDataType type, _Outptr_ OrtValue **out)
 Create a tensor backed by a user supplied buffer. More...
 
 ORT_API2_STATUS (IsTensor, _In_ const OrtValue *value, _Out_ int *out)
 Return if an OrtValue is a tensor type. More...
 
 ORT_API2_STATUS (GetTensorMutableData, _In_ OrtValue *value, _Outptr_ void **out)
 Get a pointer to the raw data inside a tensor. More...
 
 ORT_API2_STATUS (FillStringTensor, _Inout_ OrtValue *value, _In_ const char *const *s, size_t s_len)
 Set all strings at once in a string tensor. More...
 
 ORT_API2_STATUS (GetStringTensorDataLength, _In_ const OrtValue *value, _Out_ size_t *len)
 Get total byte length for all strings in a string tensor. More...
 
 ORT_API2_STATUS (GetStringTensorContent, _In_ const OrtValue *value, _Out_writes_bytes_all_(s_len) void *s, size_t s_len, _Out_writes_all_(offsets_len) size_t *offsets, size_t offsets_len)
 Get all strings from a string tensor. More...
 
 ORT_API2_STATUS (GetTensorTypeAndShape, _In_ const OrtValue *value, _Outptr_ OrtTensorTypeAndShapeInfo **out)
 Get type and shape information from a tensor OrtValue. More...
 
 ORT_API2_STATUS (GetTypeInfo, _In_ const OrtValue *value, _Outptr_result_maybenull_ OrtTypeInfo **out)
 Get type information of an OrtValue. More...
 
 ORT_API2_STATUS (GetValueType, _In_ const OrtValue *value, _Out_ enum ONNXType *out)
 Get ONNXType of an OrtValue. More...
 
 ORT_API2_STATUS (GetValue, _In_ const OrtValue *value, int index, _Inout_ OrtAllocator *allocator, _Outptr_ OrtValue **out)
 Get non tensor data from an OrtValue. More...
 
 ORT_API2_STATUS (GetValueCount, _In_ const OrtValue *value, _Out_ size_t *out)
 Get non tensor value count from an OrtValue. More...
 
 ORT_API2_STATUS (CreateValue, _In_reads_(num_values) const OrtValue *const *in, size_t num_values, enum ONNXType value_type, _Outptr_ OrtValue **out)
 Create a map or sequence OrtValue. More...
 
 ORT_API2_STATUS (CreateOpaqueValue, _In_z_ const char *domain_name, _In_z_ const char *type_name, _In_ const void *data_container, size_t data_container_size, _Outptr_ OrtValue **out)
 Create an opaque (custom user defined type) OrtValue. More...
 
 ORT_API2_STATUS (GetOpaqueValue, _In_ const char *domain_name, _In_ const char *type_name, _In_ const OrtValue *in, _Out_ void *data_container, size_t data_container_size)
 Get internal data from an opaque (custom user defined type) OrtValue. More...
 
 ORT_CLASS_RELEASE (Value)
 Create a tensor. More...
 
 ORT_API2_STATUS (GetStringTensorElementLength, _In_ const OrtValue *value, size_t index, _Out_ size_t *out)
 Get the length of a single string in a string tensor. More...
 
 ORT_API2_STATUS (GetStringTensorElement, _In_ const OrtValue *value, size_t s_len, size_t index, _Out_writes_bytes_all_(s_len) void *s)
 Get a single string from a string tensor. More...
 
 ORT_API2_STATUS (FillStringTensorElement, _Inout_ OrtValue *value, _In_ const char *s, size_t index)
 Set a single string in a string tensor. More...
 
 ORT_API2_STATUS (TensorAt, _Inout_ OrtValue *value, const int64_t *location_values, size_t location_values_count, _Outptr_ void **out)
 Direct memory access to a specified tensor element. More...
 
 ORT_API2_STATUS (IsSparseTensor, _In_ const OrtValue *value, _Out_ int *out)
 Sets *out to 1 iff an OrtValue is a SparseTensor, and 0 otherwise. More...
 
 ORT_API2_STATUS (CreateSparseTensorAsOrtValue, _Inout_ OrtAllocator *allocator, _In_ const int64_t *dense_shape, size_t dense_shape_len, ONNXTensorElementDataType type, _Outptr_ OrtValue **out)
 Create an OrtValue with a sparse tensor that is empty. More...
 
 ORT_API2_STATUS (FillSparseTensorCoo, _Inout_ OrtValue *ort_value, _In_ const OrtMemoryInfo *data_mem_info, _In_ const int64_t *values_shape, size_t values_shape_len, _In_ const void *values, _In_ const int64_t *indices_data, size_t indices_num)
 
 ORT_API2_STATUS (FillSparseTensorCsr, _Inout_ OrtValue *ort_value, _In_ const OrtMemoryInfo *data_mem_info, _In_ const int64_t *values_shape, size_t values_shape_len, _In_ const void *values, _In_ const int64_t *inner_indices_data, size_t inner_indices_num, _In_ const int64_t *outer_indices_data, size_t outer_indices_num)
 
 ORT_API2_STATUS (FillSparseTensorBlockSparse, _Inout_ OrtValue *ort_value, _In_ const OrtMemoryInfo *data_mem_info, _In_ const int64_t *values_shape, size_t values_shape_len, _In_ const void *values, _In_ const int64_t *indices_shape_data, size_t indices_shape_len, _In_ const int32_t *indices_data)
 
 ORT_API2_STATUS (CreateSparseTensorWithValuesAsOrtValue, _In_ const OrtMemoryInfo *info, _Inout_ void *p_data, _In_ const int64_t *dense_shape, size_t dense_shape_len, _In_ const int64_t *values_shape, size_t values_shape_len, ONNXTensorElementDataType type, _Outptr_ OrtValue **out)
 
 ORT_API2_STATUS (UseCooIndices, _Inout_ OrtValue *ort_value, _Inout_ int64_t *indices_data, size_t indices_num)
 
 ORT_API2_STATUS (UseCsrIndices, _Inout_ OrtValue *ort_value, _Inout_ int64_t *inner_data, size_t inner_num, _Inout_ int64_t *outer_data, size_t outer_num)
 
 ORT_API2_STATUS (UseBlockSparseIndices, _Inout_ OrtValue *ort_value, const int64_t *indices_shape, size_t indices_shape_len, _Inout_ int32_t *indices_data)
 
 ORT_API2_STATUS (GetSparseTensorFormat, _In_ const OrtValue *ort_value, _Out_ enum OrtSparseFormat *out)
 Returns sparse tensor format enum iff a given ort value contains an instance of sparse tensor. More...
 
 ORT_API2_STATUS (GetSparseTensorValuesTypeAndShape, _In_ const OrtValue *ort_value, _Outptr_ OrtTensorTypeAndShapeInfo **out)
 Returns data type and shape of sparse tensor values (nnz) iff OrtValue contains a SparseTensor. More...
 
 ORT_API2_STATUS (GetSparseTensorValues, _In_ const OrtValue *ort_value, _Outptr_ const void **out)
 Returns numeric data for sparse tensor values (nnz). For string values use GetStringTensor*(). More...
 
 ORT_API2_STATUS (GetSparseTensorIndicesTypeShape, _In_ const OrtValue *ort_value, enum OrtSparseIndicesFormat indices_format, _Outptr_ OrtTensorTypeAndShapeInfo **out)
 Returns data type, shape for the type of indices specified by indices_format. More...
 
 ORT_API2_STATUS (GetSparseTensorIndices, _In_ const OrtValue *ort_value, enum OrtSparseIndicesFormat indices_format, _Out_ size_t *num_indices, _Outptr_ const void **indices)
 Returns indices data for the type of the indices specified by indices_format. More...
 

OrtTypeInfo

 ORT_API2_STATUS (CastTypeInfoToTensorInfo, _In_ const OrtTypeInfo *type_info, _Outptr_result_maybenull_ const OrtTensorTypeAndShapeInfo **out)
 Get ::OrtTensorTypeAndShapeInfo from an ::OrtTypeInfo. More...
 
 ORT_API2_STATUS (GetOnnxTypeFromTypeInfo, _In_ const OrtTypeInfo *type_info, _Out_ enum ONNXType *out)
 Get ONNXType from ::OrtTypeInfo. More...
 
 ORT_CLASS_RELEASE (TypeInfo)
 Get ::OrtTensorTypeAndShapeInfo from an ::OrtTypeInfo. More...
 
 ORT_API2_STATUS (GetDenotationFromTypeInfo, _In_ const OrtTypeInfo *type_info, _Out_ const char **const denotation, _Out_ size_t *len)
 Get denotation from type information. More...
 
 ORT_API2_STATUS (CastTypeInfoToMapTypeInfo, _In_ const OrtTypeInfo *type_info, _Outptr_result_maybenull_ const OrtMapTypeInfo **out)
 Get detailed map information from an ::OrtTypeInfo. More...
 
 ORT_API2_STATUS (CastTypeInfoToSequenceTypeInfo, _In_ const OrtTypeInfo *type_info, _Outptr_result_maybenull_ const OrtSequenceTypeInfo **out)
 Cast ::OrtTypeInfo to an ::OrtSequenceTypeInfo. More...
 

OrtTensorTypeAndShapeInfo

 ORT_API2_STATUS (CreateTensorTypeAndShapeInfo, _Outptr_ OrtTensorTypeAndShapeInfo **out)
 Create an ::OrtTensorTypeAndShapeInfo object. More...
 
 ORT_API2_STATUS (SetTensorElementType, _Inout_ OrtTensorTypeAndShapeInfo *info, enum ONNXTensorElementDataType type)
 Set element type in ::OrtTensorTypeAndShapeInfo. More...
 
 ORT_API2_STATUS (SetDimensions, OrtTensorTypeAndShapeInfo *info, _In_ const int64_t *dim_values, size_t dim_count)
 Set shape information in ::OrtTensorTypeAndShapeInfo. More...
 
 ORT_API2_STATUS (GetTensorElementType, _In_ const OrtTensorTypeAndShapeInfo *info, _Out_ enum ONNXTensorElementDataType *out)
 Get element type in ::OrtTensorTypeAndShapeInfo. More...
 
 ORT_API2_STATUS (GetDimensionsCount, _In_ const OrtTensorTypeAndShapeInfo *info, _Out_ size_t *out)
 Get dimension count in ::OrtTensorTypeAndShapeInfo. More...
 
 ORT_API2_STATUS (GetDimensions, _In_ const OrtTensorTypeAndShapeInfo *info, _Out_ int64_t *dim_values, size_t dim_values_length)
 Get dimensions in ::OrtTensorTypeAndShapeInfo. More...
 
 ORT_API2_STATUS (GetSymbolicDimensions, _In_ const OrtTensorTypeAndShapeInfo *info, _Out_writes_all_(dim_params_length) const char *dim_params[], size_t dim_params_length)
 Get symbolic dimension names in ::OrtTensorTypeAndShapeInfo. More...
 
 ORT_API2_STATUS (GetTensorShapeElementCount, _In_ const OrtTensorTypeAndShapeInfo *info, _Out_ size_t *out)
 Get total number of elements in a tensor shape from an ::OrtTensorTypeAndShapeInfo. More...
 
 ORT_CLASS_RELEASE (TensorTypeAndShapeInfo)
 Create an ::OrtTensorTypeAndShapeInfo object. More...
 

OrtMemoryInfo

 ORT_API2_STATUS (CreateMemoryInfo, _In_ const char *name, enum OrtAllocatorType type, int id, enum OrtMemType mem_type, _Outptr_ OrtMemoryInfo **out)
 Create an OrtMemoryInfo. More...
 
 ORT_API2_STATUS (CreateCpuMemoryInfo, enum OrtAllocatorType type, enum OrtMemType mem_type, _Outptr_ OrtMemoryInfo **out)
 Create an OrtMemoryInfo for CPU memory. More...
 
 ORT_API2_STATUS (CompareMemoryInfo, _In_ const OrtMemoryInfo *info1, _In_ const OrtMemoryInfo *info2, _Out_ int *out)
 Compare OrtMemoryInfo objects for equality. More...
 
 ORT_API2_STATUS (MemoryInfoGetName, _In_ const OrtMemoryInfo *ptr, _Out_ const char **out)
 Get name from OrtMemoryInfo. More...
 
 ORT_API2_STATUS (MemoryInfoGetId, _In_ const OrtMemoryInfo *ptr, _Out_ int *out)
 Get the id from OrtMemoryInfo. More...
 
 ORT_API2_STATUS (MemoryInfoGetMemType, _In_ const OrtMemoryInfo *ptr, _Out_ OrtMemType *out)
 Get the OrtMemType from OrtMemoryInfo. More...
 
 ORT_API2_STATUS (MemoryInfoGetType, _In_ const OrtMemoryInfo *ptr, _Out_ OrtAllocatorType *out)
 Get the OrtAllocatorType from OrtMemoryInfo. More...
 
 ORT_CLASS_RELEASE (MemoryInfo)
 Create an OrtMemoryInfo. More...
 

OrtAllocator

 ORT_API2_STATUS (AllocatorAlloc, _Inout_ OrtAllocator *ort_allocator, size_t size, _Outptr_ void **out)
 Calls OrtAllocator::Alloc function. More...
 
 ORT_API2_STATUS (AllocatorFree, _Inout_ OrtAllocator *ort_allocator, void *p)
 Calls OrtAllocator::Free function. More...
 
 ORT_API2_STATUS (AllocatorGetInfo, _In_ const OrtAllocator *ort_allocator, _Outptr_ const struct OrtMemoryInfo **out)
 Calls OrtAllocator::Info function. More...
 
 ORT_API2_STATUS (GetAllocatorWithDefaultOptions, _Outptr_ OrtAllocator **out)
 Get the default allocator. More...
 
 ORT_API2_STATUS (CreateAllocator, _In_ const OrtSession *session, _In_ const OrtMemoryInfo *mem_info, _Outptr_ OrtAllocator **out)
 Create an allocator for an ::OrtSession following an OrtMemoryInfo. More...
 
 ORT_CLASS_RELEASE (Allocator)
 Release an OrtAllocator obtained from OrtApi::CreateAllocator. More...
 
 ORT_API2_STATUS (RegisterAllocator, _Inout_ OrtEnv *env, _In_ OrtAllocator *allocator)
 Register a custom allocator. More...
 
 ORT_API2_STATUS (UnregisterAllocator, _Inout_ OrtEnv *env, _In_ const OrtMemoryInfo *mem_info)
 Unregister a custom allocator. More...
 

OrtKernelInfo

Custom operator APIs.

 ORT_API2_STATUS (KernelInfoGetAttribute_float, _In_ const OrtKernelInfo *info, _In_ const char *name, _Out_ float *out)
 Get a float stored as an attribute in the graph node. More...
 
 ORT_API2_STATUS (KernelInfoGetAttribute_int64, _In_ const OrtKernelInfo *info, _In_ const char *name, _Out_ int64_t *out)
 Fetch a 64-bit int stored as an attribute in the graph node. More...
 
 ORT_API2_STATUS (KernelInfoGetAttribute_string, _In_ const OrtKernelInfo *info, _In_ const char *name, _Out_ char *out, _Inout_ size_t *size)
 Fetch a string stored as an attribute in the graph node. More...
 
 ORT_API2_STATUS (KernelInfoGetAttributeArray_float, _In_ const OrtKernelInfo *info, _In_ const char *name, _Out_ float *out, _Inout_ size_t *size)
 Fetch an array of int64_t values stored as an attribute in the graph node. More...
 
 ORT_API2_STATUS (KernelInfoGetAttributeArray_int64, _In_ const OrtKernelInfo *info, _In_ const char *name, _Out_ int64_t *out, _Inout_ size_t *size)
 Fetch an array of int64_t values stored as an attribute in the graph node. More...
 
 ORT_API2_STATUS (KernelInfo_GetInputCount, _In_ const OrtKernelInfo *info, _Out_ size_t *out)
 Get the number of inputs from OrtKernelInfo. More...
 
 ORT_API2_STATUS (KernelInfo_GetOutputCount, _In_ const OrtKernelInfo *info, _Out_ size_t *out)
 Get the number of outputs from OrtKernelInfo. More...
 
 ORT_API2_STATUS (KernelInfo_GetInputName, _In_ const OrtKernelInfo *info, size_t index, _Out_ char *out, _Inout_ size_t *size)
 Get the name of a OrtKernelInfo's input. More...
 
 ORT_API2_STATUS (KernelInfo_GetOutputName, _In_ const OrtKernelInfo *info, size_t index, _Out_ char *out, _Inout_ size_t *size)
 Get the name of a OrtKernelInfo's output. More...
 
 ORT_API2_STATUS (KernelInfo_GetInputTypeInfo, _In_ const OrtKernelInfo *info, size_t index, _Outptr_ OrtTypeInfo **type_info)
 Get the type information for a OrtKernelInfo's input. More...
 
 ORT_API2_STATUS (KernelInfo_GetOutputTypeInfo, _In_ const OrtKernelInfo *info, size_t index, _Outptr_ OrtTypeInfo **type_info)
 Get the type information for a OrtKernelInfo's output. More...
 
 ORT_API2_STATUS (KernelInfoGetAttribute_tensor, _In_ const OrtKernelInfo *info, _In_z_ const char *name, _Inout_ OrtAllocator *allocator, _Outptr_ OrtValue **out)
 Get a OrtValue tensor stored as an attribute in the graph node. More...
 

OrtKernelContext

Custom operator APIs.

 ORT_API2_STATUS (KernelContext_GetInputCount, _In_ const OrtKernelContext *context, _Out_ size_t *out)
 Used for custom operators, get the input count of a kernel. More...
 
 ORT_API2_STATUS (KernelContext_GetOutputCount, _In_ const OrtKernelContext *context, _Out_ size_t *out)
 Used for custom operators, get the output count of a kernel. More...
 
 ORT_API2_STATUS (KernelContext_GetInput, _In_ const OrtKernelContext *context, _In_ size_t index, _Out_ const OrtValue **out)
 Used for custom operators, get an input of a kernel. More...
 
 ORT_API2_STATUS (KernelContext_GetOutput, _Inout_ OrtKernelContext *context, _In_ size_t index, _In_ const int64_t *dim_values, size_t dim_count, _Outptr_ OrtValue **out)
 Used for custom operators, get an output of a kernel. More...
 
 ORT_API2_STATUS (KernelContext_GetGPUComputeStream, _In_ const OrtKernelContext *context, _Outptr_ void **out)
 Used for custom operators, gets the GPU compute stream to use to launch the custom a GPU kernel. More...
 

OrtMapTypeInfo

 ORT_API2_STATUS (GetMapKeyType, _In_ const OrtMapTypeInfo *map_type_info, _Out_ enum ONNXTensorElementDataType *out)
 Get key type from an ::OrtMapTypeInfo. More...
 
 ORT_API2_STATUS (GetMapValueType, _In_ const OrtMapTypeInfo *map_type_info, _Outptr_ OrtTypeInfo **type_info)
 Get the value type from an ::OrtMapTypeInfo. More...
 
 ORT_CLASS_RELEASE (MapTypeInfo)
 Get key type from an ::OrtMapTypeInfo. More...
 

OrtSequenceTypeInfo

 ORT_API2_STATUS (GetSequenceElementType, _In_ const OrtSequenceTypeInfo *sequence_type_info, _Outptr_ OrtTypeInfo **type_info)
 Get element type from an ::OrtSequenceTypeInfo. More...
 
 ORT_CLASS_RELEASE (SequenceTypeInfo)
 Get element type from an ::OrtSequenceTypeInfo. More...
 

OrtModelMetadata

 ORT_API2_STATUS (ModelMetadataGetProducerName, _In_ const OrtModelMetadata *model_metadata, _Inout_ OrtAllocator *allocator, _Outptr_ char **value)
 Get producer name from an ::OrtModelMetadata. More...
 
 ORT_API2_STATUS (ModelMetadataGetGraphName, _In_ const OrtModelMetadata *model_metadata, _Inout_ OrtAllocator *allocator, _Outptr_ char **value)
 Get graph name from an ::OrtModelMetadata. More...
 
 ORT_API2_STATUS (ModelMetadataGetDomain, _In_ const OrtModelMetadata *model_metadata, _Inout_ OrtAllocator *allocator, _Outptr_ char **value)
 Get domain from an ::OrtModelMetadata. More...
 
 ORT_API2_STATUS (ModelMetadataGetDescription, _In_ const OrtModelMetadata *model_metadata, _Inout_ OrtAllocator *allocator, _Outptr_ char **value)
 Get description from an ::OrtModelMetadata. More...
 
 ORT_API2_STATUS (ModelMetadataLookupCustomMetadataMap, _In_ const OrtModelMetadata *model_metadata, _Inout_ OrtAllocator *allocator, _In_ const char *key, _Outptr_result_maybenull_ char **value)
 Return data for a key in the custom metadata map in an ::OrtModelMetadata. More...
 
 ORT_API2_STATUS (ModelMetadataGetVersion, _In_ const OrtModelMetadata *model_metadata, _Out_ int64_t *value)
 Get version number from an ::OrtModelMetadata. More...
 
 ORT_CLASS_RELEASE (ModelMetadata)
 Get producer name from an ::OrtModelMetadata. More...
 
 ORT_API2_STATUS (ModelMetadataGetCustomMetadataMapKeys, _In_ const OrtModelMetadata *model_metadata, _Inout_ OrtAllocator *allocator, _Outptr_result_buffer_maybenull_(*num_keys) char ***keys, _Out_ int64_t *num_keys)
 
 ORT_API2_STATUS (ModelMetadataGetGraphDescription, _In_ const OrtModelMetadata *model_metadata, _Inout_ OrtAllocator *allocator, _Outptr_ char **value)
 

OrtThreadingOptions

 ORT_API2_STATUS (CreateThreadingOptions, _Outptr_ OrtThreadingOptions **out)
 Create an ::OrtThreadingOptions. More...
 
 ORT_CLASS_RELEASE (ThreadingOptions)
 Create an ::OrtThreadingOptions. More...
 
 ORT_API2_STATUS (SetGlobalIntraOpNumThreads, _Inout_ OrtThreadingOptions *tp_options, int intra_op_num_threads)
 Set global intra-op thread count. More...
 
 ORT_API2_STATUS (SetGlobalInterOpNumThreads, _Inout_ OrtThreadingOptions *tp_options, int inter_op_num_threads)
 Set global inter-op thread count. More...
 
 ORT_API2_STATUS (SetGlobalSpinControl, _Inout_ OrtThreadingOptions *tp_options, int allow_spinning)
 Set global spin control options. More...
 
 ORT_API2_STATUS (SetGlobalDenormalAsZero, _Inout_ OrtThreadingOptions *tp_options)
 Set threading flush-to-zero and denormal-as-zero. More...
 
 ORT_API2_STATUS (SetGlobalCustomCreateThreadFn, _Inout_ OrtThreadingOptions *tp_options, _In_ OrtCustomCreateThreadFn ort_custom_create_thread_fn)
 Set custom thread creation function for global thread pools. More...
 
 ORT_API2_STATUS (SetGlobalCustomThreadCreationOptions, _Inout_ OrtThreadingOptions *tp_options, _In_ void *ort_custom_thread_creation_options)
 Set custom thread creation options for global thread pools. More...
 
 ORT_API2_STATUS (SetGlobalCustomJoinThreadFn, _Inout_ OrtThreadingOptions *tp_options, _In_ OrtCustomJoinThreadFn ort_custom_join_thread_fn)
 Set custom thread join function for global thread pools. More...
 

Misc

 ORT_API2_STATUS (GetAvailableProviders, _Outptr_ char ***out_ptr, _Out_ int *provider_length)
 Get the names of all available providers. More...
 
 ORT_API2_STATUS (ReleaseAvailableProviders, _In_ char **ptr, _In_ int providers_length)
 Release data from OrtApi::GetAvailableProviders. More...
 
 ORT_API2_STATUS (SetCurrentGpuDeviceId, _In_ int device_id)
 Set current GPU device ID. More...
 
 ORT_API2_STATUS (GetCurrentGpuDeviceId, _In_ int *device_id)
 Get current GPU device ID. More...
 

OrtIoBinding

 ORT_CLASS_RELEASE (IoBinding)
 Release an ::OrtIoBinding obtained from OrtApi::CreateIoBinding. More...
 
 ORT_API2_STATUS (BindInput, _Inout_ OrtIoBinding *binding_ptr, _In_ const char *name, _In_ const OrtValue *val_ptr)
 Bind an OrtValue to an ::OrtIoBinding input. More...
 
 ORT_API2_STATUS (BindOutput, _Inout_ OrtIoBinding *binding_ptr, _In_ const char *name, _In_ const OrtValue *val_ptr)
 Bind an OrtValue to an ::OrtIoBinding output. More...
 
 ORT_API2_STATUS (BindOutputToDevice, _Inout_ OrtIoBinding *binding_ptr, _In_ const char *name, _In_ const OrtMemoryInfo *mem_info_ptr)
 Bind an ::OrtIoBinding output to a device. More...
 
 ORT_API2_STATUS (GetBoundOutputNames, _In_ const OrtIoBinding *binding_ptr, _In_ OrtAllocator *allocator, _Out_ char **buffer, _Out_writes_all_(count) size_t **lengths, _Out_ size_t *count)
 Get the names of an ::OrtIoBinding's outputs. More...
 
 ORT_API2_STATUS (GetBoundOutputValues, _In_ const OrtIoBinding *binding_ptr, _In_ OrtAllocator *allocator, _Out_writes_all_(output_count) OrtValue ***output, _Out_ size_t *output_count)
 Get the output OrtValue objects from an ::OrtIoBinding. More...
 
 void (ORT_API_CALL *ClearBoundInputs)(_Inout_ OrtIoBinding *binding_ptr) NO_EXCEPTION ORT_ALL_ARGS_NONNULL
 Clears any previously set Inputs for an ::OrtIoBinding. More...
 
 void (ORT_API_CALL *ClearBoundOutputs)(_Inout_ OrtIoBinding *binding_ptr) NO_EXCEPTION ORT_ALL_ARGS_NONNULL
 Clears any previously set Outputs for an ::OrtIoBinding. More...
 

OrtArenaCfg

 ORT_API2_STATUS (CreateArenaCfg, _In_ size_t max_mem, int arena_extend_strategy, int initial_chunk_size_bytes, int max_dead_bytes_per_chunk, _Outptr_ OrtArenaCfg **out)
 
 ORT_CLASS_RELEASE (ArenaCfg)
 
 ORT_API2_STATUS (CreateArenaCfgV2, _In_reads_(num_keys) const char *const *arena_config_keys, _In_reads_(num_keys) const size_t *arena_config_values, _In_ size_t num_keys, _Outptr_ OrtArenaCfg **out)
 Create an OrtArenaCfg. More...
 

OrtPrepackedWeightsContainer

 ORT_API2_STATUS (CreatePrepackedWeightsContainer, _Outptr_ OrtPrepackedWeightsContainer **out)
 Create an ::OrtPrepackedWeightsContainer. More...
 
 ORT_CLASS_RELEASE (PrepackedWeightsContainer)
 Release OrtPrepackedWeightsContainer instance. More...
 

OrtTensorRTProviderOptionsV2

 ORT_API2_STATUS (CreateTensorRTProviderOptions, _Outptr_ OrtTensorRTProviderOptionsV2 **out)
 Create an OrtTensorRTProviderOptionsV2. More...
 
 ORT_API2_STATUS (UpdateTensorRTProviderOptions, _Inout_ OrtTensorRTProviderOptionsV2 *tensorrt_options, _In_reads_(num_keys) const char *const *provider_options_keys, _In_reads_(num_keys) const char *const *provider_options_values, _In_ size_t num_keys)
 Set options in a TensorRT Execution Provider. More...
 
 ORT_API2_STATUS (GetTensorRTProviderOptionsAsString, _In_ const OrtTensorRTProviderOptionsV2 *tensorrt_options, _Inout_ OrtAllocator *allocator, _Outptr_ char **ptr)
 Get serialized TensorRT provider options string. More...
 
 void (ORT_API_CALL *ReleaseTensorRTProviderOptions)(_Frees_ptr_opt_ OrtTensorRTProviderOptionsV2 *input)
 Release an OrtTensorRTProviderOptionsV2. More...
 

GetTensorMemoryInfo

 ORT_API2_STATUS (GetTensorMemoryInfo, _In_ const OrtValue *value, _Out_ const OrtMemoryInfo **mem_info)
 Returns a pointer to the OrtMemoryInfo of a Tensor. More...
 

GetExecutionProviderApi

 ORT_API2_STATUS (GetExecutionProviderApi, _In_ const char *provider_name, _In_ uint32_t version, _Outptr_ const void **provider_api)
 Get a pointer to the requested version of the Execution Provider specific API extensions to the OrtApi. More...
 

SessionOptions

 ORT_API2_STATUS (SessionOptionsSetCustomCreateThreadFn, _Inout_ OrtSessionOptions *options, _In_ OrtCustomCreateThreadFn ort_custom_create_thread_fn)
 Set custom thread creation function. More...
 
 ORT_API2_STATUS (SessionOptionsSetCustomThreadCreationOptions, _Inout_ OrtSessionOptions *options, _In_ void *ort_custom_thread_creation_options)
 Set creation options for custom thread. More...
 
 ORT_API2_STATUS (SessionOptionsSetCustomJoinThreadFn, _Inout_ OrtSessionOptions *options, _In_ OrtCustomJoinThreadFn ort_custom_join_thread_fn)
 Set custom thread join function. More...
 

OrtCUDAProviderOptionsV2

 ORT_API2_STATUS (CreateCUDAProviderOptions, _Outptr_ OrtCUDAProviderOptionsV2 **out)
 Create an OrtCUDAProviderOptionsV2. More...
 
 ORT_API2_STATUS (UpdateCUDAProviderOptions, _Inout_ OrtCUDAProviderOptionsV2 *cuda_options, _In_reads_(num_keys) const char *const *provider_options_keys, _In_reads_(num_keys) const char *const *provider_options_values, _In_ size_t num_keys)
 Set options in a CUDA Execution Provider. More...
 
 ORT_API2_STATUS (GetCUDAProviderOptionsAsString, _In_ const OrtCUDAProviderOptionsV2 *cuda_options, _Inout_ OrtAllocator *allocator, _Outptr_ char **ptr)
 
 void (ORT_API_CALL *ReleaseCUDAProviderOptions)(_Frees_ptr_opt_ OrtCUDAProviderOptionsV2 *input)
 Release an OrtCUDAProviderOptionsV2. More...
 

Detailed Description

The C API.

All C API functions are defined inside this structure as pointers to functions. Call OrtApiBase::GetApi to get a pointer to it

Definition at line 637 of file onnxruntime_c_api.h.

Member Function Documentation

OrtStatus* ORT_API_CALL* OrtApi::CreateStatus ( OrtErrorCode  code,
_In_ const char *  msg 
)

Create an OrtStatus from a null terminated string.

Parameters
[in]code
[in]msgA null-terminated string. Its contents will be copied.
Returns
A new OrtStatus object, must be destroyed with OrtApi::ReleaseStatus
const char* ORT_API_CALL* OrtApi::GetErrorMessage ( _In_ const OrtStatus *  status)

Get error string from OrtStatus.

Parameters
[in]status
Returns
The error message inside the status. Do not free the returned value.
const OrtTrainingApi* ORT_API_CALL* OrtApi::GetTrainingApi ( uint32_t  version)
OrtApi::ORT_API2_STATUS ( CreateEnv  ,
OrtLoggingLevel  log_severity_level,
_In_ const char *  logid,
_Outptr_ OrtEnv **  out 
)

Create an OrtEnv.

Parameters
[in]log_severity_levelThe log severity level.
[in]logidThe log identifier.
[out]outReturned newly created OrtEnv. Must be freed with OrtApi::ReleaseEnv

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( CreateEnvWithCustomLogger  ,
OrtLoggingFunction  logging_function,
_In_opt_ void logger_param,
OrtLoggingLevel  log_severity_level,
_In_ const char *  logid,
_Outptr_ OrtEnv **  out 
)

Create an OrtEnv.

Parameters
[in]logging_functionA pointer to a logging function.
[in]logger_paramA pointer to arbitrary data passed as the OrtLoggingFunction param parameter to logging_function.
[in]log_severity_levelThe log severity level.
[in]logidThe log identifier.
[out]outReturned newly created OrtEnv. Must be freed with OrtApi::ReleaseEnv

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( EnableTelemetryEvents  ,
_In_ const OrtEnv *  env 
)

Enable Telemetry.

Note
Telemetry events are on by default since they are lightweight
Parameters
[in]envdoc} snippets.dox OrtStatus Return Value
OrtApi::ORT_API2_STATUS ( DisableTelemetryEvents  ,
_In_ const OrtEnv *  env 
)

Disable Telemetry.

See Also
OrtApi::EnableTelemetryEvents
Parameters
[in]envdoc} snippets.dox OrtStatus Return Value
OrtApi::ORT_API2_STATUS ( CreateSession  ,
_In_ const OrtEnv *  env,
_In_ const ORTCHAR_T model_path,
_In_ const OrtSessionOptions *  options,
_Outptr_ OrtSession **  out 
)

Create an OrtSession from a model file.

Parameters
[in]env
[in]model_path
[in]options
[out]outReturned newly created OrtSession. Must be freed with OrtApi::ReleaseSession

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( CreateSessionFromArray  ,
_In_ const OrtEnv *  env,
_In_ const void model_data,
size_t  model_data_length,
_In_ const OrtSessionOptions *  options,
_Outptr_ OrtSession **  out 
)

Create an OrtSession from memory.

Parameters
[in]env
[in]model_data
[in]model_data_length
[in]options
[out]outReturned newly created OrtSession. Must be freed with OrtApi::ReleaseSession

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( Run  ,
_Inout_ OrtSession *  session,
_In_opt_ const OrtRunOptions run_options,
_In_reads_(input_len) const char *const input_names,
_In_reads_(input_len) const OrtValue *const inputs,
size_t  input_len,
_In_reads_(output_names_len) const char *const output_names,
size_t  output_names_len,
_Inout_updates_all_(output_names_len) OrtValue **  outputs 
)

Run the model in an ::OrtSession.

Will not return until the model run has completed. Multiple threads might be used to run the model based on the options in the ::OrtSession and settings used when creating the ::OrtEnv

Parameters
[in]session
[in]run_optionsIf nullptr, will use a default OrtRunOptions
[in]input_namesArray of null terminated UTF8 encoded strings of the input names
[in]inputsArray of OrtValues of the input values
[in]input_lenNumber of elements in the input_names and inputs arrays
[in]output_namesArray of null terminated UTF8 encoded strings of the output names
[in]output_names_lenNumber of elements in the output_names and outputs array
[out]outputsArray of OrtValues that the outputs are stored in. This can also be an array of nullptr values, in this case OrtValue objects will be allocated and pointers to them will be set into the outputs array.

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( CreateSessionOptions  ,
_Outptr_ OrtSessionOptions **  options 
)

Create an ::OrtSessionOptions object.

To use additional providers, you must build ORT with the extra providers enabled. Then call one of these functions to enable them in the session:
OrtSessionOptionsAppendExecutionProvider_CPU
OrtSessionOptionsAppendExecutionProvider_CUDA
OrtSessionOptionsAppendExecutionProvider_(remaining providers...)
The order they are called indicates the preference order as well. In other words call this method on your most preferred execution provider first followed by the less preferred ones. If none are called Ort will use its internal CPU execution provider.

Parameters
[out]optionsThe newly created OrtSessionOptions. Must be freed with OrtApi::ReleaseSessionOptions

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( SetOptimizedModelFilePath  ,
_Inout_ OrtSessionOptions *  options,
_In_ const ORTCHAR_T optimized_model_filepath 
)

Set filepath to save optimized model after graph level transformations.

Parameters
[in]options
[in]optimized_model_filepathdoc} snippets.dox OrtStatus Return Value
OrtApi::ORT_API2_STATUS ( CloneSessionOptions  ,
_In_ const OrtSessionOptions *  in_options,
_Outptr_ OrtSessionOptions **  out_options 
)

Create a copy of an existing ::OrtSessionOptions.

Parameters
[in]in_optionsOrtSessionOptions to copy
[out]out_optionsReturned newly created ::OrtSessionOptions. Must be freed with OrtApi::ReleaseSessionOptions

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( SetSessionExecutionMode  ,
_Inout_ OrtSessionOptions *  options,
ExecutionMode  execution_mode 
)

Set execution mode.

Controls whether you want to execute operators in your graph sequentially or in parallel. Usually when the model has many branches, setting this option to ExecutionMode.ORT_PARALLEL will give you better performance. See [docs/ONNX_Runtime_Perf_Tuning.md] for more details.

Parameters
[in]options
[in]execution_modedoc} snippets.dox OrtStatus Return Value
OrtApi::ORT_API2_STATUS ( EnableProfiling  ,
_Inout_ OrtSessionOptions *  options,
_In_ const ORTCHAR_T profile_file_prefix 
)

Enable profiling for a session.

Parameters
[in]options
[in]profile_file_prefixdoc} snippets.dox OrtStatus Return Value
OrtApi::ORT_API2_STATUS ( DisableProfiling  ,
_Inout_ OrtSessionOptions *  options 
)

Disable profiling for a session.

Parameters
[in]optionsdoc} snippets.dox OrtStatus Return Value
OrtApi::ORT_API2_STATUS ( EnableMemPattern  ,
_Inout_ OrtSessionOptions *  options 
)

Enable the memory pattern optimization.

The idea is if the input shapes are the same, we could trace the internal memory allocation and generate a memory pattern for future request. So next time we could just do one allocation with a big chunk for all the internal memory allocation.

Note
Memory pattern optimization is only available when Sequential Execution mode is enabled (see OrtApi::SetSessionExecutionMode)
See Also
OrtApi::DisableMemPattern
Parameters
[in]optionsdoc} snippets.dox OrtStatus Return Value
OrtApi::ORT_API2_STATUS ( DisableMemPattern  ,
_Inout_ OrtSessionOptions *  options 
)

Disable the memory pattern optimization.

See Also
OrtApi::EnableMemPattern
Parameters
[in]optionsdoc} snippets.dox OrtStatus Return Value
OrtApi::ORT_API2_STATUS ( EnableCpuMemArena  ,
_Inout_ OrtSessionOptions *  options 
)

Enable the memory arena on CPU.

Arena may pre-allocate memory for future usage.

Parameters
[in]optionsdoc} snippets.dox OrtStatus Return Value
OrtApi::ORT_API2_STATUS ( DisableCpuMemArena  ,
_Inout_ OrtSessionOptions *  options 
)

Disable the memory arena on CPU.

Parameters
[in]optionsdoc} snippets.dox OrtStatus Return Value
OrtApi::ORT_API2_STATUS ( SetSessionLogId  ,
_Inout_ OrtSessionOptions *  options,
const char *  logid 
)

Set session log id.

Parameters
[in]options
[in]logidThe log identifier.

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( SetSessionLogVerbosityLevel  ,
_Inout_ OrtSessionOptions *  options,
int  session_log_verbosity_level 
)

Set session log verbosity level.

Applies to session load, initialization, etc

Parameters
[in]options
[in]session_log_verbosity_leveldoc} snippets.dox Log Verbosity Level

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( SetSessionLogSeverityLevel  ,
_Inout_ OrtSessionOptions *  options,
int  session_log_severity_level 
)

Set session log severity level.

Parameters
[in]options
[in]session_log_severity_levelThe log severity level (refer to OrtLoggingLevel for possible values).

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( SetSessionGraphOptimizationLevel  ,
_Inout_ OrtSessionOptions *  options,
GraphOptimizationLevel  graph_optimization_level 
)

Set the optimization level to apply when loading a graph.

Please see https://www.onnxruntime.ai/docs/resources/graph-optimizations.html for an in-depth explanation

Parameters
[in,out]optionsThe session options object
[in]graph_optimization_levelThe optimization level

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( SetIntraOpNumThreads  ,
_Inout_ OrtSessionOptions *  options,
int  intra_op_num_threads 
)

Sets the number of threads used to parallelize the execution within nodes.

When running a single node operation, ex. add, this sets the maximum number of threads to use.

Note
If built with OpenMP, this has no effect on the number of threads used. In this case use the OpenMP env variables to configure the number of intra op num threads.
Parameters
[in]options
[in]intra_op_num_threadsNumber of threads to use
A value of 0 will use the default number of threads

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( SetInterOpNumThreads  ,
_Inout_ OrtSessionOptions *  options,
int  inter_op_num_threads 
)

Sets the number of threads used to parallelize the execution of the graph.

If nodes can be run in parallel, this sets the maximum number of threads to use to run them in parallel.

Note
If sequential execution is enabled this value is ignored, it acts as if it was set to 1.
Parameters
[in]options
[in]inter_op_num_threadsNumber of threads to use
A value of 0 will use the default number of threads

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( CreateCustomOpDomain  ,
_In_ const char *  domain,
_Outptr_ OrtCustomOpDomain **  out 
)

Create a custom op domain.

Parameters
[in]domain
[out]outNewly created domain. Must be freed with OrtApi::ReleaseCustomOpDomain

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( CustomOpDomain_Add  ,
_Inout_ OrtCustomOpDomain *  custom_op_domain,
_In_ const OrtCustomOp op 
)

Add a custom op to a custom op domain.

Note
The OrtCustomOp* pointer must remain valid until the ::OrtCustomOpDomain using it is released
Parameters
[in]custom_op_domain
[in]opdoc} snippets.dox OrtStatus Return Value
OrtApi::ORT_API2_STATUS ( AddCustomOpDomain  ,
_Inout_ OrtSessionOptions *  options,
_In_ OrtCustomOpDomain *  custom_op_domain 
)

Add custom op domain to a session options.

Note
The OrtCustomOpDomain* must not be deleted until all sessions using it are released
Parameters
[in]options
[in]custom_op_domaindoc} snippets.dox OrtStatus Return Value
OrtApi::ORT_API2_STATUS ( RegisterCustomOpsLibrary  ,
_Inout_ OrtSessionOptions *  options,
_In_ const char *  library_path,
_Outptr_ void **  library_handle 
)
Deprecated:
Use OrtApi::RegisterCustomOpsLibrary_V2.

Registers custom ops from a shared library.

Loads a shared library (dll on windows, so on linux, etc) named 'library_path' and looks for this entry point: OrtStatus* RegisterCustomOps(OrtSessionOptions * options, const OrtApiBase* api); It then passes in the provided session options to this function along with the api base. The handle to the loaded library is returned in library_handle. It can be freed by the caller after all sessions using the passed in session options are destroyed, or if an error occurs and it is non null.

Parameters
[in]options
[in]library_path
[out]library_handleOS specific handle to the loaded library (Use FreeLibrary on Windows, dlclose on Linux, etc.. to unload)

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( SessionGetInputCount  ,
_In_ const OrtSession *  session,
_Out_ size_t *  out 
)

Get input count for a session.

This number must also match the number of inputs passed to OrtApi::Run

See Also
OrtApi::SessionGetInputTypeInfo, OrtApi::SessionGetInputName, OrtApi::Session
Parameters
[in]session
[out]outNumber of inputs

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( SessionGetOutputCount  ,
_In_ const OrtSession *  session,
_Out_ size_t *  out 
)

Get output count for a session.

This number must also match the number of outputs returned by OrtApi::Run

See Also
OrtApi::SessionGetOutputTypeInfo, OrtApi::SessionGetOutputName, OrtApi::Session
Parameters
[in]session
[out]outNumber of outputs

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( SessionGetOverridableInitializerCount  ,
_In_ const OrtSession *  session,
_Out_ size_t *  out 
)

Get overridable initializer count.

See Also
OrtApi::SessionGetOverridableInitializerTypeInfo, OrtApi::SessionGetOverridableInitializerName
Parameters
[in]session
[in]outdoc} snippets.dox OrtStatus Return Value
OrtApi::ORT_API2_STATUS ( SessionGetInputTypeInfo  ,
_In_ const OrtSession *  session,
size_t  index,
_Outptr_ OrtTypeInfo **  type_info 
)

Get input type information.

Parameters
[in]session
[in]indexMust be between 0 (inclusive) and what OrtApi::SessionGetInputCount returns (exclusive)
[out]type_infoMust be freed with OrtApi::ReleaseTypeInfo

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( SessionGetOutputTypeInfo  ,
_In_ const OrtSession *  session,
size_t  index,
_Outptr_ OrtTypeInfo **  type_info 
)

Get output type information.

Parameters
[in]session
[in]indexMust be between 0 (inclusive) and what OrtApi::SessionGetOutputCount returns (exclusive)
[out]type_infoMust be freed with OrtApi::ReleaseTypeInfo

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( SessionGetOverridableInitializerTypeInfo  ,
_In_ const OrtSession *  session,
size_t  index,
_Outptr_ OrtTypeInfo **  type_info 
)

Get overridable initializer type information.

Parameters
[in]session
[in]indexMust be between 0 (inclusive) and what OrtApi::SessionGetOverridableInitializerCount returns (exclusive)
[out]type_infoMust be freed with OrtApi::ReleaseTypeInfo

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( SessionGetInputName  ,
_In_ const OrtSession *  session,
size_t  index,
_Inout_ OrtAllocator allocator,
_Outptr_ char **  value 
)

Get input name.

Parameters
[in]session
[in]indexMust be between 0 (inclusive) and what OrtApi::SessionGetInputCount returns (exclusive)
[in]allocator
[out]valueSet to a null terminated UTF-8 encoded string allocated using allocator. Must be freed using allocator.

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( SessionGetOutputName  ,
_In_ const OrtSession *  session,
size_t  index,
_Inout_ OrtAllocator allocator,
_Outptr_ char **  value 
)

Get output name.

Parameters
[in]session
[in]indexMust be between 0 (inclusive) and what OrtApi::SessionGetOutputCount returns (exclusive)
[in]allocator
[out]valueSet to a null terminated UTF-8 encoded string allocated using allocator. Must be freed using allocator.

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( SessionGetOverridableInitializerName  ,
_In_ const OrtSession *  session,
size_t  index,
_Inout_ OrtAllocator allocator,
_Outptr_ char **  value 
)

Get overridable initializer name.

Parameters
[in]session
[in]indexMust be between 0 (inclusive) and what OrtApi::SessionGetOverridableInitializerCount returns (exclusive)
[in]allocator
[out]valueSet to a null terminated UTF-8 encoded string allocated using allocator. Must be freed using allocator.

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( CreateRunOptions  ,
_Outptr_ OrtRunOptions **  out 
)

Create an OrtRunOptions.

Parameters
[out]outReturned newly created OrtRunOptions. Must be freed with OrtApi::ReleaseRunOptions

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( RunOptionsSetRunLogVerbosityLevel  ,
_Inout_ OrtRunOptions options,
int  log_verbosity_level 
)

Set per-run log verbosity level.

See Also
OrtApi::RunOptionsGetRunLogVerbosityLevel
Parameters
[in]options
[in]log_verbosity_leveldoc} snippets.dox Log Verbosity Level

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( RunOptionsSetRunLogSeverityLevel  ,
_Inout_ OrtRunOptions options,
int  log_severity_level 
)

Set per-run log severity level.

See Also
OrtApi::RunOptionsGetRunLogSeverityLevel
Parameters
[in]options
[in]log_severity_levelThe log severity level (refer to OrtLoggingLevel for possible values).
OrtApi::ORT_API2_STATUS ( RunOptionsSetRunTag  ,
_Inout_ OrtRunOptions options,
_In_ const char *  run_tag 
)

Set per-run tag.

This is used in a per-run log identifier.

See Also
OrtApi::RunOptionsGetRunTag
Parameters
[in]options
[in]run_tagThe run tag.
OrtApi::ORT_API2_STATUS ( RunOptionsGetRunLogVerbosityLevel  ,
_In_ const OrtRunOptions options,
_Out_ int log_verbosity_level 
)

Get per-run log verbosity level.

See Also
OrtApi::RunOptionsSetRunLogVerbosityLevel
Parameters
[in]options
[out]log_verbosity_leveldoc} snippets.dox Log Verbosity Level

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( RunOptionsGetRunLogSeverityLevel  ,
_In_ const OrtRunOptions options,
_Out_ int log_severity_level 
)

Get per-run log severity level.

See Also
OrtApi::RunOptionsSetRunLogSeverityLevel
Parameters
[in]options
[out]log_severity_levelThe log severity level (refer to OrtLoggingLevel for possible values).
OrtApi::ORT_API2_STATUS ( RunOptionsGetRunTag  ,
_In_ const OrtRunOptions options,
_Out_ const char **  run_tag 
)

Get per-run tag.

This is used in a per-run log identifier.

See Also
OrtApi::RunOptionsSetRunTag
Parameters
[in]options
[out]run_tagThe run tag. Do not free this value, it is owned by options. It will be invalidated if the run tag changes (i.e., with OrtApi::RunOptionsSetRunTag) or options is freed.
OrtApi::ORT_API2_STATUS ( RunOptionsSetTerminate  ,
_Inout_ OrtRunOptions options 
)

Set terminate flag.

If a currently executing session needs to be force terminated, this can be called from another thread to force it to fail with an error.

Parameters
[in]optionsdoc} snippets.dox OrtStatus Return Value
OrtApi::ORT_API2_STATUS ( RunOptionsUnsetTerminate  ,
_Inout_ OrtRunOptions options 
)

Clears the terminate flag.

Used so the OrtRunOptions instance can be used in a new OrtApi::Run call without it instantly terminating

Parameters
[in]optionsdoc} snippets.dox OrtStatus Return Value
OrtApi::ORT_API2_STATUS ( CreateTensorAsOrtValue  ,
_Inout_ OrtAllocator allocator,
_In_ const int64_t *  shape,
size_t  shape_len,
ONNXTensorElementDataType  type,
_Outptr_ OrtValue **  out 
)

Create a tensor.

Create a tensor using a supplied OrtAllocator

Parameters
[in]allocator
[in]shapePointer to the tensor shape dimensions.
[in]shape_lenThe number of tensor shape dimensions.
[in]type
[out]outReturns newly created OrtValue. Must be freed with OrtApi::ReleaseValue

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( CreateTensorWithDataAsOrtValue  ,
_In_ const OrtMemoryInfo info,
_Inout_ void p_data,
size_t  p_data_len,
_In_ const int64_t *  shape,
size_t  shape_len,
ONNXTensorElementDataType  type,
_Outptr_ OrtValue **  out 
)

Create a tensor backed by a user supplied buffer.

Create a tensor with user's buffer. You can fill the buffer either before calling this function or after. p_data is owned by caller. ReleaseValue won't release p_data.

Parameters
[in]infoMemory description of where the p_data buffer resides (CPU vs GPU etc).
[in]p_dataPointer to the data buffer.
[in]p_data_lenThe number of bytes in the data buffer.
[in]shapePointer to the tensor shape dimensions.
[in]shape_lenThe number of tensor shape dimensions.
[in]typeThe data type.
[out]outReturns newly created OrtValue. Must be freed with OrtApi::ReleaseValue

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( IsTensor  ,
_In_ const OrtValue value,
_Out_ int out 
)

Return if an OrtValue is a tensor type.

Parameters
[in]valueA tensor type (string tensors are not supported)
[out]outSet to 1 iff OrtValue is a tensor, 0 otherwise

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( GetTensorMutableData  ,
_In_ OrtValue value,
_Outptr_ void **  out 
)

Get a pointer to the raw data inside a tensor.

Used to read/write/modify the internal tensor data directly.

Note
The returned pointer is valid until the value is destroyed.
Parameters
[in]valueA tensor type (string tensors are not supported)
[out]outFilled in with a pointer to the internal storage

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( FillStringTensor  ,
_Inout_ OrtValue value,
_In_ const char *const s,
size_t  s_len 
)

Set all strings at once in a string tensor.

Parameters
[in,out]valueA tensor of type ONNX_TENSOR_ELEMENT_DATA_TYPE_STRING
[in]sAn array of strings. Each string in this array must be null terminated.
[in]s_lenCount of strings in s (Must match the size of value's tensor shape)

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( GetStringTensorDataLength  ,
_In_ const OrtValue value,
_Out_ size_t *  len 
)

Get total byte length for all strings in a string tensor.

Typically used with OrtApi::GetStringTensorContent

Parameters
[in]valueA tensor of type ONNX_TENSOR_ELEMENT_DATA_TYPE_STRING
[out]lenTotal byte length of all strings (does not include trailing nulls)

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( GetStringTensorContent  ,
_In_ const OrtValue value,
_Out_writes_bytes_all_(s_len) void s,
size_t  s_len,
_Out_writes_all_(offsets_len) size_t *  offsets,
size_t  offsets_len 
)

Get all strings from a string tensor.

An example of the results:
Given value is a string tensor with the strings { "This" "is" "a" "test" }
s must have a size of 11 bytes
offsets must have 4 elements
After the call, these values will be filled in:
s will contain "Thisisatest"
offsets will contain { 0, 4, 6, 7 }
The length of the last string is just s_len - offsets[last]

Parameters
[in]valueA tensor of type ONNX_TENSOR_ELEMENT_DATA_TYPE_STRING
[in]sBuffer to sequentially write all tensor strings to. Each string is NOT null-terminated.
[in]s_lenNumber of bytes of buffer pointed to by s (Get it from OrtApi::GetStringTensorDataLength)
[out]offsetsArray of start offsets into the strings written to s
[in]offsets_lenNumber of elements in offsets

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( CastTypeInfoToTensorInfo  ,
_In_ const OrtTypeInfo *  type_info,
_Outptr_result_maybenull_ const OrtTensorTypeAndShapeInfo **  out 
)

Get ::OrtTensorTypeAndShapeInfo from an ::OrtTypeInfo.

Parameters
[in]type_info
[out]outDo not free this value, it will be valid until type_info is freed.

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( GetOnnxTypeFromTypeInfo  ,
_In_ const OrtTypeInfo *  type_info,
_Out_ enum ONNXType out 
)

Get ONNXType from ::OrtTypeInfo.

Parameters
[in]type_info
[out]outdoc} snippets.dox OrtStatus Return Value
OrtApi::ORT_API2_STATUS ( CreateTensorTypeAndShapeInfo  ,
_Outptr_ OrtTensorTypeAndShapeInfo **  out 
)

Create an ::OrtTensorTypeAndShapeInfo object.

Parameters
[out]outReturns newly created ::OrtTensorTypeAndShapeInfo. Must be freed with OrtApi::ReleaseTensorTypeAndShapeInfo

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( SetTensorElementType  ,
_Inout_ OrtTensorTypeAndShapeInfo *  info,
enum ONNXTensorElementDataType  type 
)

Set element type in ::OrtTensorTypeAndShapeInfo.

Parameters
[in]info
[in]typedoc} snippets.dox OrtStatus Return Value
OrtApi::ORT_API2_STATUS ( SetDimensions  ,
OrtTensorTypeAndShapeInfo *  info,
_In_ const int64_t *  dim_values,
size_t  dim_count 
)

Set shape information in ::OrtTensorTypeAndShapeInfo.

Parameters
[in]info
[in]dim_valuesArray with dim_count elements. Can contain negative values.
[in]dim_countNumber of elements in dim_values

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( GetTensorElementType  ,
_In_ const OrtTensorTypeAndShapeInfo *  info,
_Out_ enum ONNXTensorElementDataType out 
)

Get element type in ::OrtTensorTypeAndShapeInfo.

See Also
OrtApi::SetTensorElementType
Parameters
[in]info
[out]outdoc} snippets.dox OrtStatus Return Value
OrtApi::ORT_API2_STATUS ( GetDimensionsCount  ,
_In_ const OrtTensorTypeAndShapeInfo *  info,
_Out_ size_t *  out 
)

Get dimension count in ::OrtTensorTypeAndShapeInfo.

See Also
OrtApi::GetDimensions
Parameters
[in]info
[out]outdoc} snippets.dox OrtStatus Return Value
OrtApi::ORT_API2_STATUS ( GetDimensions  ,
_In_ const OrtTensorTypeAndShapeInfo *  info,
_Out_ int64_t *  dim_values,
size_t  dim_values_length 
)

Get dimensions in ::OrtTensorTypeAndShapeInfo.

Parameters
[in]info
[out]dim_valuesArray with dim_values_length elements. On return, filled with the dimensions stored in the ::OrtTensorTypeAndShapeInfo
[in]dim_values_lengthNumber of elements in dim_values. Use OrtApi::GetDimensionsCount to get this value

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( GetSymbolicDimensions  ,
_In_ const OrtTensorTypeAndShapeInfo *  info,
_Out_writes_all_(dim_params_length) const char *  dim_params[],
size_t  dim_params_length 
)

Get symbolic dimension names in ::OrtTensorTypeAndShapeInfo.

Parameters
[in]info
[in]dim_paramsArray with dim_params_length elements. On return filled with pointers to null terminated strings of the dimension names
[in]dim_params_lengthNumber of elements in dim_params. Use OrtApi::GetDimensionsCount to get this value

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( GetTensorShapeElementCount  ,
_In_ const OrtTensorTypeAndShapeInfo *  info,
_Out_ size_t *  out 
)

Get total number of elements in a tensor shape from an ::OrtTensorTypeAndShapeInfo.

Return the number of elements specified by the tensor shape (all dimensions multiplied by each other). For 0 dimensions, 1 is returned. If any dimension is less than 0, the result is always -1.

Examples:
[] = 1
[1,3,4] = 12
[2,0,4] = 0
[-1,3,4] = -1

Parameters
[in]info
[out]outNumber of elements

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( GetTensorTypeAndShape  ,
_In_ const OrtValue value,
_Outptr_ OrtTensorTypeAndShapeInfo **  out 
)

Get type and shape information from a tensor OrtValue.

Parameters
[in]valueMust be a tensor (not a map/sequence/etc) or will return failure
[out]outNewly created ::OrtTensorTypeAndShapeInfo. Must be freed with OrtApi::ReleaseTensorTypeAndShapeInfo

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( GetTypeInfo  ,
_In_ const OrtValue value,
_Outptr_result_maybenull_ OrtTypeInfo **  out 
)

Get type information of an OrtValue.

Parameters
[in]value
[out]outNewly created ::OrtTypeInfo. Must be freed with OrtApi::ReleaseTypeInfo

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( GetValueType  ,
_In_ const OrtValue value,
_Out_ enum ONNXType out 
)

Get ONNXType of an OrtValue.

Parameters
[in]value
[out]outdoc} snippets.dox OrtStatus Return Value
OrtApi::ORT_API2_STATUS ( CreateMemoryInfo  ,
_In_ const char *  name,
enum OrtAllocatorType  type,
int  id,
enum OrtMemType  mem_type,
_Outptr_ OrtMemoryInfo **  out 
)

Create an OrtMemoryInfo.

Parameters
[in]name
[in]type
[in]id
[in]mem_type
[out]outNewly created OrtMemoryInfo. Must be freed with OrtAPi::ReleaseMemoryInfo

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( CreateCpuMemoryInfo  ,
enum OrtAllocatorType  type,
enum OrtMemType  mem_type,
_Outptr_ OrtMemoryInfo **  out 
)

Create an OrtMemoryInfo for CPU memory.

Special case version of OrtApi::CreateMemoryInfo for CPU based memory. Same as using OrtApi::CreateMemoryInfo with name = "Cpu" and id = 0.

Parameters
[in]type
[in]mem_type
[out]outdoc} snippets.dox OrtStatus Return Value
OrtApi::ORT_API2_STATUS ( CompareMemoryInfo  ,
_In_ const OrtMemoryInfo info1,
_In_ const OrtMemoryInfo info2,
_Out_ int out 
)

Compare OrtMemoryInfo objects for equality.

Compares all settings of each OrtMemoryInfo for equality

Parameters
[in]info1
[in]info2
[out]outSet to 0 if equal, -1 if not equal

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( MemoryInfoGetName  ,
_In_ const OrtMemoryInfo ptr,
_Out_ const char **  out 
)

Get name from OrtMemoryInfo.

Parameters
[in]ptr
[out]outWrites null terminated string to this pointer. Do NOT free the returned pointer. It is valid for the lifetime of the OrtMemoryInfo

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( MemoryInfoGetId  ,
_In_ const OrtMemoryInfo ptr,
_Out_ int out 
)

Get the id from OrtMemoryInfo.

OrtApi::ORT_API2_STATUS ( MemoryInfoGetMemType  ,
_In_ const OrtMemoryInfo ptr,
_Out_ OrtMemType out 
)

Get the OrtMemType from OrtMemoryInfo.

OrtApi::ORT_API2_STATUS ( MemoryInfoGetType  ,
_In_ const OrtMemoryInfo ptr,
_Out_ OrtAllocatorType out 
)
OrtApi::ORT_API2_STATUS ( AllocatorAlloc  ,
_Inout_ OrtAllocator ort_allocator,
size_t  size,
_Outptr_ void **  out 
)

Calls OrtAllocator::Alloc function.

OrtApi::ORT_API2_STATUS ( AllocatorFree  ,
_Inout_ OrtAllocator ort_allocator,
void p 
)

Calls OrtAllocator::Free function.

OrtApi::ORT_API2_STATUS ( AllocatorGetInfo  ,
_In_ const OrtAllocator ort_allocator,
_Outptr_ const struct OrtMemoryInfo **  out 
)

Calls OrtAllocator::Info function.

OrtApi::ORT_API2_STATUS ( GetAllocatorWithDefaultOptions  ,
_Outptr_ OrtAllocator **  out 
)

Get the default allocator.

The default allocator is a CPU based, non-arena. Always returns the same pointer to the same default allocator.

Parameters
[out]outReturned value should NOT be freed

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( AddFreeDimensionOverride  ,
_Inout_ OrtSessionOptions *  options,
_In_ const char *  dim_denotation,
_In_ int64_t  dim_value 
)

Override session symbolic dimensions.

Override symbolic dimensions (by specific denotation strings) with actual values if known at session initialization time to enable optimizations that can take advantage of fixed values (such as memory planning, etc)

Parameters
[in]options
[in]dim_denotation
[in]dim_valuedoc} snippets.dox OrtStatus Return Value
OrtApi::ORT_API2_STATUS ( GetValue  ,
_In_ const OrtValue value,
int  index,
_Inout_ OrtAllocator allocator,
_Outptr_ OrtValue **  out 
)

Get non tensor data from an OrtValue.

If value is of type ONNX_TYPE_MAP, you need to retrieve the keys and values separately. Use index=0 to retrieve keys and index=1 to retrieve values. If value is of type ONNX_TYPE_SEQUENCE, use index to retrieve the index'th element of the sequence.

Parameters
[in]value
[in]indexSee above for usage based on value type
[in]allocatorAllocator used to allocate OrtValue
[out]outCreated OrtValue that holds the element requested. Must be freed with OrtApi::ReleaseValue

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( GetValueCount  ,
_In_ const OrtValue value,
_Out_ size_t *  out 
)

Get non tensor value count from an OrtValue.

If value is of type ONNX_TYPE_MAP 2 will always be returned. For ONNX_TYPE_SEQUENCE the number of elements in the sequence will be returned

Parameters
[in]value
[out]outdoc} snippets.dox OrtStatus Return Value
OrtApi::ORT_API2_STATUS ( CreateValue  ,
_In_reads_(num_values) const OrtValue *const in,
size_t  num_values,
enum ONNXType  value_type,
_Outptr_ OrtValue **  out 
)

Create a map or sequence OrtValue.

To construct a map (ONNX_TYPE_MAP), use num_values = 2 and in should be an array of 2 OrtValues representing keys and values.

To construct a sequence (ONNX_TYPE_SEQUENCE), use num_values = N where N is the number of the elements in the sequence. 'in' should be an array of N OrtValues.

Parameters
[in]inSee above for details
[in]num_values
[in]value_typeMust be either ONNX_TYPE_MAP or ONNX_TYPE_SEQUENCE
[out]outNewly created OrtValue. Must be freed with OrtApi::ReleaseValue

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( CreateOpaqueValue  ,
_In_z_ const char *  domain_name,
_In_z_ const char *  type_name,
_In_ const void data_container,
size_t  data_container_size,
_Outptr_ OrtValue **  out 
)

Create an opaque (custom user defined type) OrtValue.

Constructs an OrtValue that contains a value of non-standard type created for experiments or while awaiting standardization. OrtValue in this case would contain an internal representation of the Opaque type. Opaque types are distinguished from each other by two strings 1) domain and 2) type name. The combination of the two must be unique, so the type representation is properly identified internally. The combination must be properly registered from within ORT at both compile/run time or by another API.

To construct the OrtValue pass domain and type names, also a pointer to a data container the type of which must be known to both ORT and the client program. That data container may or may not match the internal representation of the Opaque type. The sizeof(data_container) is passed for verification purposes.

Parameters
[in]domain_nameNull terminated string of the domain name
[in]type_nameNull terminated string of the type name
[in]data_containerUser pointer Data to populate OrtValue
[in]data_container_sizeSize in bytes of what data_container points to
[out]outNewly created OrtValue. Must be freed with OrtApi::ReleaseValue

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( GetOpaqueValue  ,
_In_ const char *  domain_name,
_In_ const char *  type_name,
_In_ const OrtValue in,
_Out_ void data_container,
size_t  data_container_size 
)

Get internal data from an opaque (custom user defined type) OrtValue.

Copies internal data from an opaque value into a user provided buffer

See Also
OrtApi::CreateOpaqueValue
Parameters
[in]domain_nameNull terminated string of the domain name
[in]type_nameNull terminated string of the type name
[in]inThe opaque OrtValue
[out]data_containerBuffer to copy data into
[out]data_container_sizeSize in bytes of the buffer pointed to by data_container. Must match the size of the internal buffer.

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( KernelInfoGetAttribute_float  ,
_In_ const OrtKernelInfo info,
_In_ const char *  name,
_Out_ float out 
)

Get a float stored as an attribute in the graph node.

Parameters
[in]infoOrtKernelInfo instance
[in]nameNull terminated string of the name of the attribute
[out]outPointer to memory where the attribute will be stored

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( KernelInfoGetAttribute_int64  ,
_In_ const OrtKernelInfo info,
_In_ const char *  name,
_Out_ int64_t *  out 
)

Fetch a 64-bit int stored as an attribute in the graph node.

Parameters
[in]infoOrtKernelInfo instance
[in]nameNull terminated string of the name of the attribute
[out]outPointer to memory where the attribute will be stored

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( KernelInfoGetAttribute_string  ,
_In_ const OrtKernelInfo info,
_In_ const char *  name,
_Out_ char *  out,
_Inout_ size_t *  size 
)

Fetch a string stored as an attribute in the graph node.

If out is nullptr, the value of size is set to the true size of the string attribute, and a success status is returned.

If the size parameter is greater than or equal to the actual string attribute's size, the value of size is set to the true size of the string attribute, the provided memory is filled with the attribute's contents, and a success status is returned.

If the size parameter is less than the actual string attribute's size and out is not nullptr, the value of size is set to the true size of the string attribute and a failure status is returned.)

Parameters
[in]infoOrtKernelInfo instance
[in]nameNull terminated string of the name of the attribute
[out]outPointer to memory where the attribute will be stored
[in,out]sizeSee above comments for details

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( KernelContext_GetInputCount  ,
_In_ const OrtKernelContext context,
_Out_ size_t *  out 
)

Used for custom operators, get the input count of a kernel.

See Also
OrtCustomOp
OrtApi::ORT_API2_STATUS ( KernelContext_GetOutputCount  ,
_In_ const OrtKernelContext context,
_Out_ size_t *  out 
)

Used for custom operators, get the output count of a kernel.

See Also
OrtCustomOp
OrtApi::ORT_API2_STATUS ( KernelContext_GetInput  ,
_In_ const OrtKernelContext context,
_In_ size_t  index,
_Out_ const OrtValue **  out 
)

Used for custom operators, get an input of a kernel.

See Also
OrtCustomOp
OrtApi::ORT_API2_STATUS ( KernelContext_GetOutput  ,
_Inout_ OrtKernelContext context,
_In_ size_t  index,
_In_ const int64_t *  dim_values,
size_t  dim_count,
_Outptr_ OrtValue **  out 
)

Used for custom operators, get an output of a kernel.

See Also
OrtCustomOp
OrtApi::ORT_API2_STATUS ( GetDenotationFromTypeInfo  ,
_In_ const OrtTypeInfo *  type_info,
_Out_ const char **const  denotation,
_Out_ size_t *  len 
)

Get denotation from type information.

Augments ::OrtTypeInfo to return denotations on the type.

This is used by WinML to determine if an input/output is intended to be an Image or a Tensor.

Parameters
[in]type_info
[out]denotationPointer to the null terminated denotation string is written to this pointer. This pointer is valid until the object is destroyed or the name is changed, do not free.
[out]lenLength in bytes of the string returned in denotation

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( CastTypeInfoToMapTypeInfo  ,
_In_ const OrtTypeInfo *  type_info,
_Outptr_result_maybenull_ const OrtMapTypeInfo **  out 
)

Get detailed map information from an ::OrtTypeInfo.

This augments ::OrtTypeInfo to return an ::OrtMapTypeInfo when the type is a map. The OrtMapTypeInfo has additional information about the map's key type and value type.

This is used by WinML to support model reflection APIs.

Parameters
[out]type_info
[out]outA pointer to the ::OrtMapTypeInfo. Do not free this value

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( CastTypeInfoToSequenceTypeInfo  ,
_In_ const OrtTypeInfo *  type_info,
_Outptr_result_maybenull_ const OrtSequenceTypeInfo **  out 
)

Cast ::OrtTypeInfo to an ::OrtSequenceTypeInfo.

This api augments ::OrtTypeInfo to return an ::OrtSequenceTypeInfo when the type is a sequence. The ::OrtSequenceTypeInfo has additional information about the sequence's element type.

This is used by WinML to support model reflection APIs.

Parameters
[in]type_info
[out]outA pointer to the OrtSequenceTypeInfo. Do not free this value

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( GetMapKeyType  ,
_In_ const OrtMapTypeInfo *  map_type_info,
_Out_ enum ONNXTensorElementDataType out 
)

Get key type from an ::OrtMapTypeInfo.

Key types are restricted to being scalar types.

This is used by WinML to support model reflection APIs.

Parameters
[in]map_type_info
[out]outdoc} snippets.dox OrtStatus Return Value
OrtApi::ORT_API2_STATUS ( GetMapValueType  ,
_In_ const OrtMapTypeInfo *  map_type_info,
_Outptr_ OrtTypeInfo **  type_info 
)

Get the value type from an ::OrtMapTypeInfo.

Parameters
[in]map_type_info
[out]type_infodoc} snippets.dox OrtStatus Return Value
OrtApi::ORT_API2_STATUS ( GetSequenceElementType  ,
_In_ const OrtSequenceTypeInfo *  sequence_type_info,
_Outptr_ OrtTypeInfo **  type_info 
)

Get element type from an ::OrtSequenceTypeInfo.

This is used by WinML to support model reflection APIs.

Parameters
[in]sequence_type_info
[out]type_infodoc} snippets.dox OrtStatus Return Value
OrtApi::ORT_API2_STATUS ( SessionEndProfiling  ,
_In_ OrtSession *  session,
_Inout_ OrtAllocator allocator,
_Outptr_ char **  out 
)

End profiling and return filename of the profile data.

Profiling is turned on through OrtApi::EnableProfiling

Parameters
[in]session
[in]allocator
[out]outNull terminated string of the filename, allocated using allocator. Must be freed using allocator

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( SessionGetModelMetadata  ,
_In_ const OrtSession *  session,
_Outptr_ OrtModelMetadata **  out 
)

Get ::OrtModelMetadata from an ::OrtSession.

Parameters
[in]session
[out]outNewly created ::OrtModelMetadata. Must be freed using OrtApi::ReleaseModelMetadata

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( ModelMetadataGetProducerName  ,
_In_ const OrtModelMetadata *  model_metadata,
_Inout_ OrtAllocator allocator,
_Outptr_ char **  value 
)

Get producer name from an ::OrtModelMetadata.

Parameters
[in]model_metadata
[in]allocator
[out]valueSet to a null terminated string allocated using allocator. Must be freed using allocator

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( ModelMetadataGetGraphName  ,
_In_ const OrtModelMetadata *  model_metadata,
_Inout_ OrtAllocator allocator,
_Outptr_ char **  value 
)

Get graph name from an ::OrtModelMetadata.

Parameters
[in]model_metadata
[in]allocator
[out]valueSet to a null terminated string allocated using allocator. Must be freed using allocator

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( ModelMetadataGetDomain  ,
_In_ const OrtModelMetadata *  model_metadata,
_Inout_ OrtAllocator allocator,
_Outptr_ char **  value 
)

Get domain from an ::OrtModelMetadata.

Parameters
[in]model_metadata
[in]allocator
[out]valueSet to a null terminated string allocated using allocator. Must be freed using allocator

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( ModelMetadataGetDescription  ,
_In_ const OrtModelMetadata *  model_metadata,
_Inout_ OrtAllocator allocator,
_Outptr_ char **  value 
)

Get description from an ::OrtModelMetadata.

Parameters
[in]model_metadata
[in]allocator
[out]valueSet to a null terminated string allocated using allocator. Must be freed using allocator

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( ModelMetadataLookupCustomMetadataMap  ,
_In_ const OrtModelMetadata *  model_metadata,
_Inout_ OrtAllocator allocator,
_In_ const char *  key,
_Outptr_result_maybenull_ char **  value 
)

Return data for a key in the custom metadata map in an ::OrtModelMetadata.

Parameters
[in]model_metadata
[in]allocator
[in]keyNull terminated string
[out]valueSet to a null terminated string allocated using allocator. Must be freed using allocator value will be set to nullptr if the given key is not found in the custom metadata map.

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( ModelMetadataGetVersion  ,
_In_ const OrtModelMetadata *  model_metadata,
_Out_ int64_t *  value 
)

Get version number from an ::OrtModelMetadata.

Parameters
[in]model_metadata
[out]valueSet to the version number

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( CreateEnvWithGlobalThreadPools  ,
OrtLoggingLevel  log_severity_level,
_In_ const char *  logid,
_In_ const OrtThreadingOptions *  tp_options,
_Outptr_ OrtEnv **  out 
)

Create an OrtEnv.

Create an environment with global threadpools that will be shared across sessions. Use this in conjunction with OrtApi::DisablePerSessionThreads or else the session will use its own thread pools.

Parameters
[in]log_severity_levelThe log severity level.
[in]logidThe log identifier.
[in]tp_options
[out]outReturned newly created OrtEnv. Must be freed with OrtApi::ReleaseEnv

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( DisablePerSessionThreads  ,
_Inout_ OrtSessionOptions *  options 
)

Use global thread pool on a session.

Disable using per session thread pool and use the shared global threadpool. This should be used in conjunction with OrtApi::CreateEnvWithGlobalThreadPools.

Parameters
[in]optionsdoc} snippets.dox OrtStatus Return Value
OrtApi::ORT_API2_STATUS ( CreateThreadingOptions  ,
_Outptr_ OrtThreadingOptions **  out 
)

Create an ::OrtThreadingOptions.

Parameters
[out]outNewly created ::OrtThreadingOptions. Must be freed with OrtApi::ReleaseThreadingOptions doc} snippets.dox OrtStatus Return Value
OrtApi::ORT_API2_STATUS ( ModelMetadataGetCustomMetadataMapKeys  ,
_In_ const OrtModelMetadata *  model_metadata,
_Inout_ OrtAllocator allocator,
_Outptr_result_buffer_maybenull_ *num_keys char ***  keys,
_Out_ int64_t *  num_keys 
)
Parameters
[in]model_metadata
[in]allocator
[out]keysArray of null terminated strings (array count = num_keys) allocated using allocator. The strings and the pointer array must be freed using allocator keys will be set to nullptr if the custom metadata map is empty.
[out]num_keysSet to the number of elements in the keys array

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( AddFreeDimensionOverrideByName  ,
_Inout_ OrtSessionOptions *  options,
_In_ const char *  dim_name,
_In_ int64_t  dim_value 
)

Override symbolic dimensions (by specific name strings) with actual values if known at session initialization time to enable optimizations that can take advantage of fixed values (such as memory planning, etc)

OrtApi::ORT_API2_STATUS ( GetAvailableProviders  ,
_Outptr_ char ***  out_ptr,
_Out_ int provider_length 
)

Get the names of all available providers.

Note
The providers in the list are not guaranteed to be usable. They may fail to load due to missing system dependencies. For example, if the CUDA/cuDNN libraries are not installed, the CUDA provider will report an error when it is added to the session options.
Parameters
[out]out_ptrSet to a pointer to an array of null terminated strings of the available providers. The entries and the array itself must be freed using OrtApi::ReleaseAvailableProviders
[out]provider_lengthSet to the number of entries in the out_ptr array

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( ReleaseAvailableProviders  ,
_In_ char **  ptr,
_In_ int  providers_length 
)

Release data from OrtApi::GetAvailableProviders.

Parameters
[in]ptrThe out_ptr result from OrtApi::GetAvailableProviders.
[in]providers_lengthThe provider_length result from OrtApi::GetAvailableProviders

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( GetStringTensorElementLength  ,
_In_ const OrtValue value,
size_t  index,
_Out_ size_t *  out 
)

Get the length of a single string in a string tensor.

Parameters
[in]valueA string tensor
[in]indexIndex of the string in the tensor
[out]outSet to number of bytes of the string element

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( GetStringTensorElement  ,
_In_ const OrtValue value,
size_t  s_len,
size_t  index,
_Out_writes_bytes_all_(s_len) void s 
)

Get a single string from a string tensor.

Parameters
[in]valueA string tensor
[in]s_lenNumber of bytes in the s buffer. Must match the value returned by OrtApi::GetStringTensorElementLength.
[in]indexIndex of the string in the tensor
[out]sThe string element contents in UTF-8 encoding. The string is NOT null-terminated.

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( FillStringTensorElement  ,
_Inout_ OrtValue value,
_In_ const char *  s,
size_t  index 
)

Set a single string in a string tensor.

Parameters
[in]valueA string tensor
[in]sA null terminated UTF-8 encoded string
[in]indexIndex of the string in the tensor to set

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( AddSessionConfigEntry  ,
_Inout_ OrtSessionOptions *  options,
_In_z_ const char *  config_key,
_In_z_ const char *  config_value 
)

Set a session configuration entry as a pair of strings.

If a configuration with same key exists, this will overwrite the configuration with the given config_value.

The config_key and the format of config_value are defined in onnxruntime_session_options_config_keys.h

Parameters
[in]options
[in]config_keyA null terminated string representation of the config key
[in]config_valueA null terminated string representation of the config value

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( CreateAllocator  ,
_In_ const OrtSession *  session,
_In_ const OrtMemoryInfo mem_info,
_Outptr_ OrtAllocator **  out 
)

Create an allocator for an ::OrtSession following an OrtMemoryInfo.

Parameters
[in]session
[in]mem_infovalid OrtMemoryInfo instance
[out]outNewly created OrtAllocator. Must be freed with OrtApi::ReleaseAllocator

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( RunWithBinding  ,
_Inout_ OrtSession *  session,
_In_ const OrtRunOptions run_options,
_In_ const OrtIoBinding *  binding_ptr 
)

Run a model using Io Bindings for the inputs & outputs.

See Also
OrtApi::Run
Parameters
[in]session
[in]run_options
[in]binding_ptrdoc} snippets.dox OrtStatus Return Value
OrtApi::ORT_API2_STATUS ( CreateIoBinding  ,
_Inout_ OrtSession *  session,
_Outptr_ OrtIoBinding **  out 
)

Create an ::OrtIoBinding instance.

An IoBinding object allows one to bind pre-allocated OrtValues to input names. Thus if you want to use a raw on device buffer as input or output you can avoid extra copy during runtime.

Parameters
[in]session
[out]outNewly created ::OrtIoBinding. Must be freed with OrtApi::ReleaseIoBinding

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( BindInput  ,
_Inout_ OrtIoBinding *  binding_ptr,
_In_ const char *  name,
_In_ const OrtValue val_ptr 
)

Bind an OrtValue to an ::OrtIoBinding input.

When using OrtApi::RunWithBinding this value is used for the named input

Parameters
[in]binding_ptr
[in]nameName for the model input
[in]val_ptrOrtValue of Tensor type.

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( BindOutput  ,
_Inout_ OrtIoBinding *  binding_ptr,
_In_ const char *  name,
_In_ const OrtValue val_ptr 
)

Bind an OrtValue to an ::OrtIoBinding output.

When using OrtApi::RunWithBinding this value is used for the named output

Parameters
[in]binding_ptr
[in]nameNull terminated string of the model output name
[in]val_ptrOrtValue of Tensor type.

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( BindOutputToDevice  ,
_Inout_ OrtIoBinding *  binding_ptr,
_In_ const char *  name,
_In_ const OrtMemoryInfo mem_info_ptr 
)

Bind an ::OrtIoBinding output to a device.

Binds the OrtValue to a device which is specified by OrtMemoryInfo. You can either create an instance of OrtMemoryInfo with a device id or obtain one from the allocator that you have created/are using This is useful when one or more outputs have dynamic shapes and, it is hard to pre-allocate and bind a chunk of memory within OrtValue ahead of time.

See Also
OrtApi::RunWithBinding
Parameters
[in]binding_ptr
[in]nameNull terminated string of the device name
[in]mem_info_ptrdoc} snippets.dox OrtStatus Return Value
OrtApi::ORT_API2_STATUS ( GetBoundOutputNames  ,
_In_ const OrtIoBinding *  binding_ptr,
_In_ OrtAllocator allocator,
_Out_ char **  buffer,
_Out_writes_all_(count) size_t **  lengths,
_Out_ size_t *  count 
)

Get the names of an ::OrtIoBinding's outputs.

Returns the names of the outputs in the order they were bound. This is useful after running the model with bound outputs because the returned names are in order in which output OrtValue are returned. This is useful if the order of outputs and their names is not known.

Parameters
[in]binding_ptr
[in]allocatorAllocator used to allocate continuous buffers for output strings and lengths.
[out]bufferReturns an array of non-null terminated UTF-8 strings. The number of strings stored is returned in the count parameter. This buffer is allocated using allocator and must be freed using it.
[out]lengthsReturns an array of count lengths of the strings returned in buffer This buffer is allocated using allocator and must be freed using it.
[out]countNumber of strings returned. If binding_ptr has no bound outputs, zero is returned, no memory allocation is performed and buffer and lengths are set to nullptr.

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( GetBoundOutputValues  ,
_In_ const OrtIoBinding *  binding_ptr,
_In_ OrtAllocator allocator,
_Out_writes_all_(output_count) OrtValue ***  output,
_Out_ size_t *  output_count 
)

Get the output OrtValue objects from an ::OrtIoBinding.

Returns an array of pointers to individually allocated OrtValues that contain results of a model execution with OrtApi::RunWithBinding The array contains the same number of OrtValues and they are in the same order as they were bound with OrtApi::BindOutput or OrtApi::BindOutputToDevice.

The returned OrtValues must be released using OrtApi::ReleaseValue after they are no longer needed. The array is allocated using the specified instance of the allocator and must be freed using the same allocator after all the OrtValues contained therein are individually released.

Parameters
[in]binding_ptr
[in]allocatorAllocator used to allocate output array
[out]outputSet to the allocated array of allocated OrtValue outputs. Set to nullptr if there are 0 outputs.
[out]output_countSet to number of OrtValues returned

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( TensorAt  ,
_Inout_ OrtValue value,
const int64_t *  location_values,
size_t  location_values_count,
_Outptr_ void **  out 
)

Direct memory access to a specified tensor element.

For example, given a tensor with shape of [3,224,224], a pointer to the element at location [2,150,128] can be retrieved

This function only works for numeric type tensors (No strings, etc). This is a no-copy method whose returned pointer is valid until the passed in OrtValue is free'd.

Parameters
[in]value
[in]location_valuesPointer to an array of index values that specify an element's location relative to its shape
[in]location_values_countNumber of elements in location_values. Must match the number of elements in the tensor's shape.
[out]outSet to a pointer to the element specified

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( CreateAndRegisterAllocator  ,
_Inout_ OrtEnv *  env,
_In_ const OrtMemoryInfo mem_info,
_In_ const OrtArenaCfg arena_cfg 
)

Create an allocator and register it with the ::OrtEnv.

Enables sharing the allocator between multiple sessions that use the same env instance. Lifetime of the created allocator will be valid for the duration of the environment. Returns an error if an allocator with the same OrtMemoryInfo is already registered.

See https://onnxruntime.ai/docs/reference/api/c-api.html for details.

Parameters
[in]env::OrtEnv instance
[in]mem_info
[in]arena_cfgPass nullptr for defaults

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( SetLanguageProjection  ,
_In_ const OrtEnv *  ort_env,
_In_ OrtLanguageProjection  projection 
)

Set language projection.

Set the language projection for collecting telemetry data when Env is created.

The default is ORT_PROJECTION_C, which means it will classify the language not in the list to C also.

Parameters
[in]ort_env
[in]projectiondoc} snippets.dox OrtStatus Return Value
OrtApi::ORT_API2_STATUS ( SessionGetProfilingStartTimeNs  ,
_In_ const OrtSession *  session,
_Outptr_ uint64_t *  out 
)

Return the time that profiling was started.

Note
The timer precision varies per platform. On Windows and MacOS, the precision will be ~100ns
Parameters
[in]session
[out]outnanoseconds of profiling's start time

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( SetGlobalIntraOpNumThreads  ,
_Inout_ OrtThreadingOptions *  tp_options,
int  intra_op_num_threads 
)

Set global intra-op thread count.

This configures the global thread pool options to be used in the call to OrtApi::CreateEnvWithGlobalThreadPools

Parameters
[in]tp_options
[in]intra_op_num_threadsNumber of threads, special values:
0 = Use default thread count
1 = The invoking thread will be used; no threads will be created in the thread pool.

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( SetGlobalInterOpNumThreads  ,
_Inout_ OrtThreadingOptions *  tp_options,
int  inter_op_num_threads 
)

Set global inter-op thread count.

This configures the global thread pool options to be used in the call to OrtApi::CreateEnvWithGlobalThreadPools

Parameters
[in]tp_options
[in]inter_op_num_threadsNumber of threads, special values:
0 = Use default thread count
1 = The invoking thread will be used; no threads will be created in the thread pool.

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( SetGlobalSpinControl  ,
_Inout_ OrtThreadingOptions *  tp_options,
int  allow_spinning 
)

Set global spin control options.

This will configure the global thread pool options to be used in the call to OrtApi::CreateEnvWithGlobalThreadPools. Allow spinning of thread pools when their queues are empty. This will set the value for both inter_op and intra_op threadpools.

Parameters
[in]tp_options
[in]allow_spinningValid values are 0 or 1.
0 = It won't spin (recommended if CPU usage is high)
1 = Threadpool will spin to wait for queue to become non-empty

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( AddInitializer  ,
_Inout_ OrtSessionOptions *  options,
_In_z_ const char *  name,
_In_ const OrtValue val 
)

Add a pre-allocated initializer to a session.

If a model contains an initializer with a name that is same as the name passed to this call, ORT will use this initializer instance instead of deserializing one from the model file. This is useful when you want to share the same initializer across sessions.

Parameters
[in]options
[in]nameNull terminated string of the initializer name
[in]valOrtValue containing the initializer. Its lifetime and the underlying initializer buffer must be managed by the user (created using the OrtApi::CreateTensorWithDataAsOrtValue) and it must outlive the session object to which it is added.

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( CreateEnvWithCustomLoggerAndGlobalThreadPools  ,
OrtLoggingFunction  logging_function,
_In_opt_ void logger_param,
OrtLoggingLevel  log_severity_level,
_In_ const char *  logid,
_In_ const struct OrtThreadingOptions *  tp_options,
_Outptr_ OrtEnv **  out 
)

Create a custom environment with global threadpools and logger that will be shared across sessions. Use this in conjunction with OrtApi::DisablePerSessionThreads or else the session will use its own thread pools.

Parameters
[in]logging_functionA pointer to a logging function.
[in]logger_paramA pointer to arbitrary data passed as the OrtLoggingFunction param parameter to logging_function.
[in]log_severity_levelThe log severity level.
[in]logidThe log identifier.
[in]tp_options
[out]outNewly created OrtEnv. Must be freed with OrtApi::ReleaseEnv

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( SessionOptionsAppendExecutionProvider_CUDA  ,
_In_ OrtSessionOptions *  options,
_In_ const OrtCUDAProviderOptions cuda_options 
)

Append CUDA provider to session options.

If CUDA is not available (due to a non CUDA enabled build, or if CUDA is not installed on the system), this function will return failure.

Parameters
[in]options
[in]cuda_optionsdoc} snippets.dox OrtStatus Return Value
OrtApi::ORT_API2_STATUS ( SessionOptionsAppendExecutionProvider_ROCM  ,
_In_ OrtSessionOptions *  options,
_In_ const OrtROCMProviderOptions rocm_options 
)

Append ROCM execution provider to the session options.

If ROCM is not available (due to a non ROCM enabled build, or if ROCM is not installed on the system), this function will return failure.

Parameters
[in]options
[in]rocm_optionsdoc} snippets.dox OrtStatus Return Value
OrtApi::ORT_API2_STATUS ( SessionOptionsAppendExecutionProvider_OpenVINO  ,
_In_ OrtSessionOptions *  options,
_In_ const OrtOpenVINOProviderOptions provider_options 
)

Append OpenVINO execution provider to the session options.

If OpenVINO is not available (due to a non OpenVINO enabled build, or if OpenVINO is not installed on the system), this function will fail.

Parameters
[in]options
[in]provider_optionsdoc} snippets.dox OrtStatus Return Value
OrtApi::ORT_API2_STATUS ( SetGlobalDenormalAsZero  ,
_Inout_ OrtThreadingOptions *  tp_options 
)

Set threading flush-to-zero and denormal-as-zero.

Sets global thread pool options to be used in the call to OrtApi::CreateEnvWithGlobalThreadPools. Flush-to-zero and denormal-as-zero are applied to threads in both intra and inter global thread pool.

Note
This option is not needed if the models used have no denormals. Having no denormals is recommended as this option may hurt model accuracy.
Parameters
[in]tp_optionsdoc} snippets.dox OrtStatus Return Value
OrtApi::ORT_API2_STATUS ( CreateArenaCfg  ,
_In_ size_t  max_mem,
int  arena_extend_strategy,
int  initial_chunk_size_bytes,
int  max_dead_bytes_per_chunk,
_Outptr_ OrtArenaCfg **  out 
)
Deprecated:
Use OrtApi::CreateArenaCfgV2

This will create the configuration of an arena that can eventually be used to define an arena based allocator's behavior

Parameters
[in]max_memUse 0 to allow ORT to choose the default
[in]arena_extend_strategyUse -1 to allow ORT to choose the default, 0 = kNextPowerOfTwo, 1 = kSameAsRequested
[in]initial_chunk_size_bytesUse -1 to allow ORT to choose the default
[in]max_dead_bytes_per_chunkUse -1 to allow ORT to choose the default
[in]outA pointer to an OrtArenaCfg instance

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( ModelMetadataGetGraphDescription  ,
_In_ const OrtModelMetadata *  model_metadata,
_Inout_ OrtAllocator allocator,
_Outptr_ char **  value 
)

Use this to obtain the description of the graph present in the model (doc_string field of the GraphProto message within the ModelProto message). If it doesn't exist, an empty string will be returned.

Parameters
[in]model_metadataAn instance of ::OrtModelMetadata
[in]allocatorAllocator used to allocate the string that will be returned back
[out]valueSet to a null terminated string allocated using allocator. The caller is responsible for freeing it using allocator

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( SessionOptionsAppendExecutionProvider_TensorRT  ,
_In_ OrtSessionOptions *  options,
_In_ const OrtTensorRTProviderOptions tensorrt_options 
)

Append TensorRT provider to session options.

If TensorRT is not available (due to a non TensorRT enabled build, or if TensorRT is not installed on the system), this function will return failure.

Parameters
[in]options
[in]tensorrt_optionsdoc} snippets.dox OrtStatus Return Value
OrtApi::ORT_API2_STATUS ( SetCurrentGpuDeviceId  ,
_In_ int  device_id 
)

Set current GPU device ID.

Set the current device id of the GPU execution provider (CUDA/tensorrt/rocm). The device id should be less than the total number of devices available. This is only useful when multiple-GPUs are installed and it is required to restrict execution to a single GPU.

Parameters
[in]device_iddoc} snippets.dox OrtStatus Return Value
OrtApi::ORT_API2_STATUS ( GetCurrentGpuDeviceId  ,
_In_ int device_id 
)

Get current GPU device ID.

Get the current device id of the GPU execution provider (CUDA/tensorrt/rocm).

See Also
OrtApi::SetCurrentGpuDeviceId
Parameters
[out]device_iddoc} snippets.dox OrtStatus Return Value
OrtApi::ORT_API2_STATUS ( KernelInfoGetAttributeArray_float  ,
_In_ const OrtKernelInfo info,
_In_ const char *  name,
_Out_ float out,
_Inout_ size_t *  size 
)

Fetch an array of int64_t values stored as an attribute in the graph node.

If out is nullptr, the value of size is set to the true size of the attribute array's size, and a success status is returned.

If the size parameter is greater than or equal to the actual attribute array's size, the value of size is set to the true size of the attribute array's size, the provided memory is filled with the attribute's contents, and a success status is returned.

If the size parameter is less than the actual attribute array's size and out is not nullptr, the value of size is set to the true size of the attribute array's size and a failure status is returned.)

Parameters
[in]infoinstance
[in]namename of the attribute to be parsed
[out]outpointer to memory where the attribute's contents are to be stored
[in,out]sizeactual size of attribute array

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( KernelInfoGetAttributeArray_int64  ,
_In_ const OrtKernelInfo info,
_In_ const char *  name,
_Out_ int64_t *  out,
_Inout_ size_t *  size 
)

Fetch an array of int64_t values stored as an attribute in the graph node.

If out is nullptr, the value of size is set to the true size of the attribute array's size, and a success status is returned.

If the size parameter is greater than or equal to the actual attribute array's size, the value of size is set to the true size of the attribute array's size, the provided memory is filled with the attribute's contents, and a success status is returned.

If the size parameter is less than the actual attribute array's size and out is not nullptr, the value of size is set to the true size of the attribute array's size and a failure status is returned.)

Parameters
[in]infoinstance
[in]namename of the attribute to be parsed
[out]outpointer to memory where the attribute's contents are to be stored
[in,out]sizeactual size of attribute array

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( CreateArenaCfgV2  ,
_In_reads_(num_keys) const char *const arena_config_keys,
_In_reads_(num_keys) const size_t *  arena_config_values,
_In_ size_t  num_keys,
_Outptr_ OrtArenaCfg **  out 
)

Create an OrtArenaCfg.

Create the configuration of an arena that can eventually be used to define an arena based allocator's behavior.

Supported keys are (See https://onnxruntime.ai/docs/reference/api/c-api.html for details on what the following parameters mean and how to choose these values.): "max_mem": Maximum memory that can be allocated by the arena based allocator. Use 0 for ORT to pick the best value. Default is 0. "arena_extend_strategy": 0 = kNextPowerOfTwo, 1 = kSameAsRequested. Use -1 to allow ORT to choose the default. "initial_chunk_size_bytes": (Possible) Size of the first allocation in the arena. Only relevant if arena strategy is kNextPowerOfTwo. Use -1 to allow ORT to choose the default. Ultimately, the first allocation size is determined by the allocation memory request. "max_dead_bytes_per_chunk": Threshold of unused memory in an allocated chunk of arena memory after crossing which the current chunk is chunked into 2. "initial_growth_chunk_size_bytes": (Possible) Size of the second allocation in the arena. Only relevant if arena strategy is kNextPowerOfTwo. Use -1 to allow ORT to choose the default. Ultimately, the allocation size is determined by the allocation memory request. Further allocation sizes are governed by the arena extend strategy.

Parameters
[in]arena_config_keysKeys to configure the arena
[in]arena_config_valuesValues to configure the arena
[in]num_keysNumber of keys in arena_config_keys and arena_config_values
[out]outNewly created OrtArenaCfg. Must be freed with OrtApi::ReleaseArenaCfg

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( AddRunConfigEntry  ,
_Inout_ OrtRunOptions options,
_In_z_ const char *  config_key,
_In_z_ const char *  config_value 
)

Set a single run configuration entry as a pair of strings.

If a configuration with same key exists, this will overwrite the configuration with the given config_value

The config_key and the format of config_value are defined in onnxruntime_run_options_config_keys.h

Parameters
[in]options
[in]config_keyA null terminated string representation of the config key
[in]config_valueA null terminated string representation of the config value

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( CreatePrepackedWeightsContainer  ,
_Outptr_ OrtPrepackedWeightsContainer **  out 
)

Create an ::OrtPrepackedWeightsContainer.

This container will hold pre-packed buffers of shared initializers for sharing between sessions (i.e.) if there are shared initializers that can be shared between sessions, the pre-packed buffers of these (if any) may possibly be shared to provide memory footprint savings. Pass this container to sessions that you would like to share pre-packed buffers of shared initializers at session creation time.

Parameters
[out]outNewly created ::OrtPrepackedWeightsContainer. Must be freed with OrtApi::ReleasePrepackedWeightsContainer

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( CreateSessionWithPrepackedWeightsContainer  ,
_In_ const OrtEnv *  env,
_In_ const ORTCHAR_T model_path,
_In_ const OrtSessionOptions *  options,
_Inout_ OrtPrepackedWeightsContainer *  prepacked_weights_container,
_Outptr_ OrtSession **  out 
)

Create session with prepacked weights container.

Same functionality offered by OrtApi::CreateSession except that a container that contains pre-packed weights' buffers is written into/read from by the created session. This is useful when used in conjunction with OrtApi::AddInitializer which injects shared initializer info into sessions. Wherever possible, the pre-packed versions of these shared initializers are cached in this container so that multiple sessions can just re-use these instead of duplicating these in memory.

Parameters
[in]envOrtEnv instance instance
[in]model_pathNull terminated string of the path (wchar on Windows, char otherwise)
[in]options
[in]prepacked_weights_container
[out]outNewly created ::OrtSession. Must be freed with OrtApi::ReleaseSession

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( CreateSessionFromArrayWithPrepackedWeightsContainer  ,
_In_ const OrtEnv *  env,
_In_ const void model_data,
size_t  model_data_length,
_In_ const OrtSessionOptions *  options,
_Inout_ OrtPrepackedWeightsContainer *  prepacked_weights_container,
_Outptr_ OrtSession **  out 
)

Create session from memory with prepacked weights container.

Same functionality offered by OrtApi::CreateSessionFromArray except that a container that contains pre-packed weights' buffers is written into/read from by the created session. This is useful when used in conjunction with OrtApi::AddInitializer which injects shared initializer info into sessions. Wherever possible, the pre-packed versions of these shared initializers are cached in this container so that multiple sessions can just re-use these instead of duplicating these in memory.

Parameters
[in]env
[in]model_dataArray of bytes holding the model
[in]model_data_lengthNumber of bytes in model_data_model
[in]options
[in]prepacked_weights_container
[out]outNewly created ::OrtSession. Must be freed with OrtApi::ReleaseSession

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( SessionOptionsAppendExecutionProvider_TensorRT_V2  ,
_In_ OrtSessionOptions *  options,
_In_ const OrtTensorRTProviderOptionsV2 tensorrt_options 
)

Append TensorRT execution provider to the session options.

If TensorRT is not available (due to a non TensorRT enabled build), this function will return failure.

This is slightly different from OrtApi::SessionOptionsAppendExecutionProvider_TensorRT, it takes an OrtTensorRTProviderOptions which is publicly defined. This takes an opaque OrtTensorRTProviderOptionsV2 which must be created with OrtApi::CreateTensorRTProviderOptions.

For OrtApi::SessionOptionsAppendExecutionProvider_TensorRT, the user needs to instantiate OrtTensorRTProviderOptions as well as allocate/release buffers for some members of OrtTensorRTProviderOptions. Here, OrtApi::CreateTensorRTProviderOptions and Ortapi::ReleaseTensorRTProviderOptions will do the memory management for you.

Parameters
[in]options
[in]tensorrt_optionsdoc} snippets.dox OrtStatus Return Value
OrtApi::ORT_API2_STATUS ( CreateTensorRTProviderOptions  ,
_Outptr_ OrtTensorRTProviderOptionsV2 **  out 
)

Create an OrtTensorRTProviderOptionsV2.

Parameters
[out]outNewly created OrtTensorRTProviderOptionsV2. Must be released with OrtApi::ReleaseTensorRTProviderOptions

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( UpdateTensorRTProviderOptions  ,
_Inout_ OrtTensorRTProviderOptionsV2 tensorrt_options,
_In_reads_(num_keys) const char *const provider_options_keys,
_In_reads_(num_keys) const char *const provider_options_values,
_In_ size_t  num_keys 
)

Set options in a TensorRT Execution Provider.

Please refer to https://www.onnxruntime.ai/docs/reference/execution-providers/TensorRT-ExecutionProvider.html#c-api-example to know the available keys and values. Key should be in null terminated string format of the member of OrtTensorRTProviderOptionsV2 and value should be its related range.

For example, key="trt_max_workspace_size" and value="2147483648"

Parameters
[in]tensorrt_options
[in]provider_options_keysArray of UTF-8 null-terminated string for provider options keys
[in]provider_options_valuesArray of UTF-8 null-terminated string for provider options values
[in]num_keysNumber of elements in the provider_option_keys and provider_options_values arrays

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( GetTensorRTProviderOptionsAsString  ,
_In_ const OrtTensorRTProviderOptionsV2 tensorrt_options,
_Inout_ OrtAllocator allocator,
_Outptr_ char **  ptr 
)

Get serialized TensorRT provider options string.

For example, "trt_max_workspace_size=2147483648;trt_max_partition_iterations=10;trt_int8_enable=1;......"

Parameters
tensorrt_options- OrTensorRTProviderOptionsV2 instance
allocator- a ptr to an instance of OrtAllocator obtained with OrtApi::CreateAllocator or OrtApi::GetAllocatorWithDefaultOptions the specified allocator will be used to allocate continuous buffers for output strings and lengths.
ptr- is a UTF-8 null terminated string allocated using 'allocator'. The caller is responsible for using the same allocator to free it.

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( EnableOrtCustomOps  ,
_Inout_ OrtSessionOptions *  options 
)

Enable custom operators.

See onnxruntime-extensions: https://github.com/microsoft/onnxruntime-extensions.git

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( RegisterAllocator  ,
_Inout_ OrtEnv *  env,
_In_ OrtAllocator allocator 
)

Register a custom allocator.

Enables sharing between multiple sessions that use the same env instance. Returns an error if an allocator with the same OrtMemoryInfo is already registered.

The behavior of this is exactly the same as OrtApi::CreateAndRegisterAllocator except instead of ORT creating an allocator based on provided info, in this case ORT uses the user-provided custom allocator. See https://onnxruntime.ai/docs/reference/api/c-api.html for details.

Parameters
[in]env
[in]allocatorUser provided allocator

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( UnregisterAllocator  ,
_Inout_ OrtEnv *  env,
_In_ const OrtMemoryInfo mem_info 
)

Unregister a custom allocator.

It is an error if you provide an OrtMemoryInfo not corresponding to any registered allocators for sharing.

Parameters
[in]env
[in]mem_infodoc} snippets.dox OrtStatus Return Value
OrtApi::ORT_API2_STATUS ( IsSparseTensor  ,
_In_ const OrtValue value,
_Out_ int out 
)

Sets *out to 1 iff an OrtValue is a SparseTensor, and 0 otherwise.

Parameters
[in]valueexisting OrtValue
[out]outunless an error occurs, contains 1 iff the value contains an instance of sparse tensor or 0 otherwise.

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( CreateSparseTensorAsOrtValue  ,
_Inout_ OrtAllocator allocator,
_In_ const int64_t *  dense_shape,
size_t  dense_shape_len,
ONNXTensorElementDataType  type,
_Outptr_ OrtValue **  out 
)

Create an OrtValue with a sparse tensor that is empty.

Use FillSparseTensor<Format>() functions to populate sparse tensor with non-zero values and format specific indices data. Use ReleaseValue to destroy the sparse tensor, this will also release the buffer inside the output value if any was allocated.

Parameters
[in,out]allocatorallocator to use when performing an allocation. Allocation will be performed by FillSparseTensor<Format>() APIs. The lifespan of the allocator instance must eclipse the lifespan this sparse tensor instance as the same allocator will be used to free memory.
[in]dense_shapeshape of the original dense tensor
[in]dense_shape_lennumber of shape dimensions being passed
[in]typemust be one of TENSOR_ELEMENT_DATA_TYPE_xxxx
[out]outShould be freed by calling ReleaseValue

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( FillSparseTensorCoo  ,
_Inout_ OrtValue ort_value,
_In_ const OrtMemoryInfo data_mem_info,
_In_ const int64_t *  values_shape,
size_t  values_shape_len,
_In_ const void values,
_In_ const int64_t *  indices_data,
size_t  indices_num 
)

This fills populates an empty tensor that was created using OrtApi::CreateSparseTensorAsOrtValue. This will allocate required memory and copy the supplied NNZ values and COO indices into that memory allocation. Memory allocation is performed using the allocator that was specified with OrtApi::CreateSparseTensorAsOrtValue.

Parameters
[in,out]ort_valueOrtValue to populate with data
[in]data_mem_infoserves to identify the location of the data to be copied. If the allocator specified at the creation time has memory info that is not the same as mem_info argument to this function a X-device copy will be performed. String data is assumed to be on CPU and will only be copied into a CPU allocated buffer.
[in]values_shapepointer to values shape array
[in]values_shape_lenlength of the values_shape
[in]valuespointer to an array of values. For strings, pass const char**.
[in]indices_datapointer to a location of COO indices
[in]indices_numnumber of COO indices

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( FillSparseTensorCsr  ,
_Inout_ OrtValue ort_value,
_In_ const OrtMemoryInfo data_mem_info,
_In_ const int64_t *  values_shape,
size_t  values_shape_len,
_In_ const void values,
_In_ const int64_t *  inner_indices_data,
size_t  inner_indices_num,
_In_ const int64_t *  outer_indices_data,
size_t  outer_indices_num 
)

This fills populates an empty tensor that was created using OrtApi::CreateSparseTensorAsOrtValue. This will allocate required memory and copy the supplied NNZ values and CSR indices into that memory allocation. Memory allocation is performed using the allocator that was specified with OrtApi::CreateSparseTensorAsOrtValue.

Parameters
[in,out]ort_valueOrtValue to populate with data
[in]data_mem_infoserves to identify the location of the data to be copied. If the allocator specified at the creation time has memory info that is not the same as mem_info argument to this function a X-device copy will be performed. String data is assumed to be on CPU and will only be copied into a CPU allocated buffer.
[in]values_shapepointer to values shape array
[in]values_shape_lenlength of the values_shape
[in]values- pointer to an array of values. For strings, pass const char**.
[in]inner_indices_datapointer to a location of CSR inner indices
[in]inner_indices_numnumber of CSR inner indices
[in]outer_indices_datapointer to a location of CSR outer indices
[in]outer_indices_numnumber of CSR outer indices

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( FillSparseTensorBlockSparse  ,
_Inout_ OrtValue ort_value,
_In_ const OrtMemoryInfo data_mem_info,
_In_ const int64_t *  values_shape,
size_t  values_shape_len,
_In_ const void values,
_In_ const int64_t *  indices_shape_data,
size_t  indices_shape_len,
_In_ const int32_t *  indices_data 
)

This fills populates an empty tensor that was created using OrtApi::CreateSparseTensorAsOrtValue. This will allocate required memory and copy the supplied NNZ values and BlockSparse indices into that memory allocation. Memory allocation is performed using the allocator that was specified with OrtApi::CreateSparseTensorAsOrtValue.

Parameters
[in,out]ort_valueOrtValue to populate with data
[in]data_mem_infoserves to identify the location of the data to be copied. If the allocator specified at the creation time has memory info that is not the same as mem_info argument to this function a X-device copy will be performed. String data is assumed to be on CPU and will only be copied into a CPU allocated buffer.
[in]values_shape
[in]values_shape_len
[in]valuesstructure with values information
[in]indices_shape_datapointer to a location of indices shape
[in]indices_shape_lenlength of the block sparse indices shape
[in]indices_datapointer to a location of indices data. Shape will determine the length of the indices data.

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( CreateSparseTensorWithValuesAsOrtValue  ,
_In_ const OrtMemoryInfo info,
_Inout_ void p_data,
_In_ const int64_t *  dense_shape,
size_t  dense_shape_len,
_In_ const int64_t *  values_shape,
size_t  values_shape_len,
ONNXTensorElementDataType  type,
_Outptr_ OrtValue **  out 
)

Create an OrtValue with a sparse tensor. This is the first step. Next, use Use<Format>Indices() functions to supply sparse tensor with format specific indices data and set its sparse format to a specific enum value. This will not perform memory allocations. It will use supplied user buffer which should outlive the created sparse tensor. Use OrtApi::ReleaseValue to destroy the sparse tensor. It would not release the supplied values buffer. This function can not be used to map strings from the user allocated memory. Strings must always be copied and have UTF-8 encoding. Therefore, use OrtApi::CreateSparseTensorAsOrtValue above and then fill it with data using appropriate Make*() function.

Parameters
[in]infomemory info where sparse values reside.
[in,out]p_datapointer to a user allocated buffer with values. To create a full sparse tensor with no non-zero values, pass nullptr
[in]dense_shapeshape of the original dense tensor
[in]dense_shape_lennumber of shape dimensions being passed
[in]values_shapeshape of the values data. To create a fully sparse tensor with no non-zero values, pass {0} shape.
[in]values_shape_lennumber of values shape dimensions
[in]typemust be one of TENSOR_ELEMENT_DATA_TYPE_xxxx
[out]outShould be freed by calling ReleaseValue

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( UseCooIndices  ,
_Inout_ OrtValue ort_value,
_Inout_ int64_t *  indices_data,
size_t  indices_num 
)

This assigns Coo format indices to the SparseTensor that was created by OrtApi::CreateSparseTensorWithValuesAsOrtValue above. It also sets OrtSparseFormat to ORT_SPARSE_COO. This will not allocate any additional memory for data. The life span of indices_data buffer should eclipse the life span of this OrtValue.

Parameters
[in,out]ort_valueOrtValue instance constructed with OrtApi::CreateSparseTensorWithValuesAsOrtValue
[in,out]indices_datapointer to a user pre-allocated buffer or nullptr for fully sparse tensors.
[in]indices_numnumber of COO indices. Should either be 0 for fully sparse tensors, be equal to the number of nnz values specified to OrtApi::CreateSparseTensorWithValuesAsOrtValue for 1-D {nnz} indices or be twice as number of nnz values for a 2-D indices {nnz, 2}

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( UseCsrIndices  ,
_Inout_ OrtValue ort_value,
_Inout_ int64_t *  inner_data,
size_t  inner_num,
_Inout_ int64_t *  outer_data,
size_t  outer_num 
)

The assigns CSR format indices to the SparseTensor that was created by OrtApi::CreateSparseTensorWithValuesAsOrtValue above. It also sets OrtSparseFormat to ORT_SPARSE_CSRC. This will not allocate any additional memory for data. The life spans of inner_data and outer_data buffers should eclipse the life span of this OrtValue.

Parameters
[in,out]ort_valueOrtValue instance constructed with OrtApi::CreateSparseTensorWithValuesAsOrtValue
[in,out]inner_datapointer to a user pre-allocated buffer or nullptr for fully sparse tensors.
[in]inner_numnumber of inner CSR indices. Should either be 0 for fully sparse tensors or be equal to the number of nnz values specified to OrtApi::CreateSparseTensorWithValuesAsOrtValue.
[in,out]outer_datapointer to user pre-allocated buffer or nullptr for fully sparse tensors.
[in]outer_numnumber of CSR outer indices. Should either be 0 for fully sparse tensors or equal to rows + 1 of the dense shape.

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( UseBlockSparseIndices  ,
_Inout_ OrtValue ort_value,
const int64_t *  indices_shape,
size_t  indices_shape_len,
_Inout_ int32_t *  indices_data 
)

The assigns BlockSparse format indices to the SparseTensor that was created by OrtApi::CreateSparseTensorWithValuesAsOrtValue above. It also sets OrtSparseFormat to ORT_SPARSE_BLOCK_SPARSE. This will not allocate any additional memory for data. The life span of indices_data buffer must eclipse the lifespan of this OrtValue.

Parameters
[in,out]ort_valueOrtValue instance constructed with OrtApi::CreateSparseTensorWithValuesAsOrtValue
[in]indices_shapepointer to indices shape. Use {0} for fully sparse tensors
[in]indices_shape_lenlength of the indices shape
[in,out]indices_datapointer to user pre-allocated buffer or nullptr for fully sparse tensors.

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( GetSparseTensorFormat  ,
_In_ const OrtValue ort_value,
_Out_ enum OrtSparseFormat out 
)

Returns sparse tensor format enum iff a given ort value contains an instance of sparse tensor.

Parameters
[in]ort_valueOrtValue that contains an instance of sparse tensor
[out]outpointer to out parameter

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( GetSparseTensorValuesTypeAndShape  ,
_In_ const OrtValue ort_value,
_Outptr_ OrtTensorTypeAndShapeInfo **  out 
)

Returns data type and shape of sparse tensor values (nnz) iff OrtValue contains a SparseTensor.

Parameters
[in]ort_valueAn OrtValue that contains a fully constructed sparse tensor
[out]outMust be freed by OrtApi::ReleaseTensorTypeAndShapeInfo

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( GetSparseTensorValues  ,
_In_ const OrtValue ort_value,
_Outptr_ const void **  out 
)

Returns numeric data for sparse tensor values (nnz). For string values use GetStringTensor*().

Parameters
[in]ort_valuean instance of OrtValue containing sparse tensor
[out]outreturns a pointer to values data. Do not attempt to free this ptr.

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( GetSparseTensorIndicesTypeShape  ,
_In_ const OrtValue ort_value,
enum OrtSparseIndicesFormat  indices_format,
_Outptr_ OrtTensorTypeAndShapeInfo **  out 
)

Returns data type, shape for the type of indices specified by indices_format.

Parameters
[in]ort_valueOrtValue containing sparse tensor.
[in]indices_formatOne of the indices formats. It is an error to request a format that the sparse tensor does not contain.
[out]outan instance of ::OrtTensorTypeAndShapeInfo. Must be freed by OrtApi::ReleaseTensorTypeAndShapeInfo

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( GetSparseTensorIndices  ,
_In_ const OrtValue ort_value,
enum OrtSparseIndicesFormat  indices_format,
_Out_ size_t *  num_indices,
_Outptr_ const void **  indices 
)

Returns indices data for the type of the indices specified by indices_format.

Parameters
[in]ort_valueOrtValue containing sparse tensor.
[in]indices_formatOne of the indices formats. It is an error to request a format that the sparse tensor does not contain.
[out]num_indicesPointer to where the number of indices entries is returned
[out]indicesReturned pointer to the indices data. Do not free the returned pointer as it refers to internal data owned by the OrtValue

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( HasValue  ,
_In_ const OrtValue value,
_Out_ int out 
)

Sets out to 1 iff an optional type OrtValue has an element, 0 otherwise (OrtValue is None) Use this API to find if the optional type OrtValue is None or not. If the optional type OrtValue is not None, use the OrtValue just like any other OrtValue. For example, if you get an OrtValue that corresponds to Optional(tensor) and if HasValue() returns true, use it as tensor and so on.

Parameters
[in]valueInput OrtValue.
[out]outindicating if the input OrtValue contains data (1) or if it is a None (0)

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( KernelContext_GetGPUComputeStream  ,
_In_ const OrtKernelContext context,
_Outptr_ void **  out 
)

Used for custom operators, gets the GPU compute stream to use to launch the custom a GPU kernel.

See Also
OrtCustomOp
Parameters
[in]contextOrtKernelContext instance
[out]outReturns pointer to a GPU compute stream that can be used to launch the custom GPU kernel. If retrieving the GPU compute stream is not relevant (GPU not enabled in the build, kernel partitioned to some other EP), then a nullptr is returned as the output param. Do not free or mutate the returned pointer as it refers to internal data owned by the underlying session. Only use it for custom kernel launching.

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( GetTensorMemoryInfo  ,
_In_ const OrtValue value,
_Out_ const OrtMemoryInfo **  mem_info 
)

Returns a pointer to the OrtMemoryInfo of a Tensor.

Parameters
[in]valueOrtValue containing tensor.
[out]mem_infoOrtMemoryInfo of the tensor. Do NOT free the returned pointer. It is valid for the lifetime of the OrtValue

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( GetExecutionProviderApi  ,
_In_ const char *  provider_name,
_In_ uint32_t  version,
_Outptr_ const void **  provider_api 
)

Get a pointer to the requested version of the Execution Provider specific API extensions to the OrtApi.

Parameters
[in]provider_nameThe name of the execution provider name. Currently only the following values are supported: "DML".
[in]versionMust be ORT_API_VERSION.
[out]provider_apiA void pointer containing a reference to the execution provider versioned api structure. For example, the provider_api pointer can be cast to the OrtDmlApi* when the provider_name is "DML".

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( SessionOptionsSetCustomCreateThreadFn  ,
_Inout_ OrtSessionOptions *  options,
_In_ OrtCustomCreateThreadFn  ort_custom_create_thread_fn 
)

Set custom thread creation function.

Parameters
[in]optionsSession options
[in]ort_custom_create_thread_fnCustom thread creation function

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( SessionOptionsSetCustomThreadCreationOptions  ,
_Inout_ OrtSessionOptions *  options,
_In_ void ort_custom_thread_creation_options 
)

Set creation options for custom thread.

Parameters
[in]optionsSession options
[in]ort_custom_thread_creation_optionsCustom thread creation options (can be nullptr)

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( SessionOptionsSetCustomJoinThreadFn  ,
_Inout_ OrtSessionOptions *  options,
_In_ OrtCustomJoinThreadFn  ort_custom_join_thread_fn 
)

Set custom thread join function.

Parameters
[in]optionsSession options
[in]ort_custom_join_thread_fnCustom join thread function, must not be nullptr when ort_custom_create_thread_fn is set

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( SetGlobalCustomCreateThreadFn  ,
_Inout_ OrtThreadingOptions *  tp_options,
_In_ OrtCustomCreateThreadFn  ort_custom_create_thread_fn 
)

Set custom thread creation function for global thread pools.

Parameters
[in,out]tp_options
[in]ort_custom_create_thread_fnCustom thread creation function

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( SetGlobalCustomThreadCreationOptions  ,
_Inout_ OrtThreadingOptions *  tp_options,
_In_ void ort_custom_thread_creation_options 
)

Set custom thread creation options for global thread pools.

Parameters
[in,out]tp_options
[in]ort_custom_thread_creation_optionsCustom thread creation options (can be nullptr)

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( SetGlobalCustomJoinThreadFn  ,
_Inout_ OrtThreadingOptions *  tp_options,
_In_ OrtCustomJoinThreadFn  ort_custom_join_thread_fn 
)

Set custom thread join function for global thread pools.

Parameters
[in,out]tp_options
[in]ort_custom_join_thread_fnCustom thread join function, must not be nullptr when global ort_custom_create_thread_fn is set

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( SynchronizeBoundInputs  ,
_Inout_ OrtIoBinding *  binding_ptr 
)

Synchronize bound inputs. The call may be necessary for some providers, such as cuda, in case the system that allocated bound memory operated on a different stream. However, the operation is provider specific and could be a no-op.

Parameters
[in,out]binding_ptrdoc} snippets.dox OrtStatus Return Value
OrtApi::ORT_API2_STATUS ( SynchronizeBoundOutputs  ,
_Inout_ OrtIoBinding *  binding_ptr 
)

Synchronize bound outputs. The call may be necessary for some providers, such as cuda, in case the system that allocated bound memory operated on a different stream. However, the operation is provider specific and could be a no-op.

Parameters
[in,out]binding_ptrdoc} snippets.dox OrtStatus Return Value
OrtApi::ORT_API2_STATUS ( SessionOptionsAppendExecutionProvider_CUDA_V2  ,
_In_ OrtSessionOptions *  options,
_In_ const OrtCUDAProviderOptionsV2 cuda_options 
)

Append CUDA execution provider to the session options.

If CUDA is not available (due to a non CUDA enabled build), this function will return failure.

This is slightly different from OrtApi::SessionOptionsAppendExecutionProvider_CUDA, it takes an OrtCUDAProviderOptions which is publicly defined. This takes an opaque OrtCUDAProviderOptionsV2 which must be created with OrtApi::CreateCUDAProviderOptions.

For OrtApi::SessionOptionsAppendExecutionProvider_CUDA, the user needs to instantiate OrtCUDAProviderOptions as well as allocate/release buffers for some members of OrtCUDAProviderOptions. Here, OrtApi::CreateCUDAProviderOptions and Ortapi::ReleaseCUDAProviderOptions will do the memory management for you.

Parameters
[in]options
[in]cuda_optionsdoc} snippets.dox OrtStatus Return Value
Since
Version 1.11.
OrtApi::ORT_API2_STATUS ( CreateCUDAProviderOptions  ,
_Outptr_ OrtCUDAProviderOptionsV2 **  out 
)

Create an OrtCUDAProviderOptionsV2.

Parameters
[out]outNewly created OrtCUDAProviderOptionsV2. Must be released with OrtApi::ReleaseCudaProviderOptions

doc} snippets.dox OrtStatus Return Value

Since
Version 1.11.
OrtApi::ORT_API2_STATUS ( UpdateCUDAProviderOptions  ,
_Inout_ OrtCUDAProviderOptionsV2 cuda_options,
_In_reads_(num_keys) const char *const provider_options_keys,
_In_reads_(num_keys) const char *const provider_options_values,
_In_ size_t  num_keys 
)

Set options in a CUDA Execution Provider.

Please refer to https://onnxruntime.ai/docs/execution-providers/CUDA-ExecutionProvider.html#configuration-options to know the available keys and values. Key should be in null terminated string format of the member of OrtCUDAProviderOptionsV2 and value should be its related range.

For example, key="device_id" and value="0"

Parameters
[in]cuda_options
[in]provider_options_keysArray of UTF-8 null-terminated string for provider options keys
[in]provider_options_valuesArray of UTF-8 null-terminated string for provider options values
[in]num_keysNumber of elements in the provider_option_keys and provider_options_values arrays

doc} snippets.dox OrtStatus Return Value

Since
Version 1.11.
OrtApi::ORT_API2_STATUS ( GetCUDAProviderOptionsAsString  ,
_In_ const OrtCUDAProviderOptionsV2 cuda_options,
_Inout_ OrtAllocator allocator,
_Outptr_ char **  ptr 
)

Get serialized CUDA provider options string.

For example, "device_id=0;arena_extend_strategy=0;......"

Parameters
cuda_options- OrtCUDAProviderOptionsV2 instance
allocator- a ptr to an instance of OrtAllocator obtained with CreateAllocator() or GetAllocatorWithDefaultOptions() the specified allocator will be used to allocate continuous buffers for output strings and lengths.
ptr- is a UTF-8 null terminated string allocated using 'allocator'. The caller is responsible for using the same allocator to free it.

doc} snippets.dox OrtStatus Return Value

Since
Version 1.11.
OrtApi::ORT_API2_STATUS ( SessionOptionsAppendExecutionProvider_MIGraphX  ,
_In_ OrtSessionOptions *  options,
_In_ const OrtMIGraphXProviderOptions migraphx_options 
)

Append MIGraphX provider to session options.

If MIGraphX is not available (due to a non MIGraphX enabled build, or if MIGraphX is not installed on the system), this function will return failure.

Parameters
[in]options
[in]migraphx_optionsdoc} snippets.dox OrtStatus Return Value
Since
Version 1.11.
OrtApi::ORT_API2_STATUS ( AddExternalInitializers  ,
_In_ OrtSessionOptions *  options,
_In_reads_(input_len) const char *const initializer_names,
_In_reads_(input_len) const OrtValue *const initializers,
size_t  initializers_num 
)

Replace initialized Tensors with external data with the data provided in initializers.

The function will find the initialized TensorProtos with external data in the graph with the provided names and replace them with the provided tensors. The API verifies that the TensorProto being replaced has an external data reference and has the same name, dimensions and data type as its replacement. The replacement will occur before any of the optimizations take place. The data will be copied into the graph since TensorProto can't refer to the user provided buffers.

Once the model has been loaded, the OrtValue(s) added to SessionOptions instance will be removed from the internal SessionOptions copy to save memory, the user provided buffers can then be deallocated and the SessionOptions instance that refers to them can be destroyed.

Parameters
[in]options
[in]initializer_namesArray of null terminated UTF-8 encoded strings of the initializers names.
[in]initializersArray of OrtValue type
[in]initializers_numNumber of elements in the initializer_names and initializers

doc} snippets.dox OrtStatus Return Value

Since
Version 1.12.
OrtApi::ORT_API2_STATUS ( CreateOpAttr  ,
_In_ const char *  name,
_In_ const void data,
_In_ int  len,
_In_ OrtOpAttrType  type,
_Outptr_ OrtOpAttr **  op_attr 
)

: Create attribute of onnxruntime operator

Parameters
[in]nameName of the attribute
[in]dataData content of the attribute
[in]lenNumber of bytes stored in data
[in]typeData type
[out]op_attrAttribute that has been created, which must be released by OrtApi::ReleaseOpAttr
Since
Version 1.12.
OrtApi::ORT_API2_STATUS ( CreateOp  ,
_In_ const OrtKernelInfo info,
_In_ const char *  op_name,
_In_ const char *  domain,
_In_ int  version,
_In_opt_ const char **  type_constraint_names,
_In_opt_ const ONNXTensorElementDataType type_constraint_values,
_In_opt_ int  type_constraint_count,
_In_opt_ const OrtOpAttr *const attr_values,
_In_opt_ int  attr_count,
_In_ int  input_count,
_In_ int  output_count,
_Outptr_ OrtOp **  ort_op 
)

: Create onnxruntime native operator

Parameters
[in]infoKernel info
[in]op_nameOperator name
[in]domainOperator domain
[in]versionOperator opset version
[in]type_constraint_namesName of the type contraints, such as "T" or "T1"
[in]type_constraint_valuesType of each contraints
[in]type_constraint_countNumber of contraints
[in]attr_valuesAttributes used to initialize the operator
[in]attr_countNumber of the attributes
[in]input_countNumber of inputs
[in]output_countNumber of outputs
[out]ort_opOperator that has been created
Since
Version 1.12.
OrtApi::ORT_API2_STATUS ( InvokeOp  ,
_In_ const OrtKernelContext context,
_In_ const OrtOp *  ort_op,
_In_ const OrtValue *const input_values,
_In_ int  input_count,
_Inout_ OrtValue *const output_values,
_In_ int  output_count 
)

: Invoke the operator created by OrtApi::CreateOp The inputs must follow the order as specified in onnx specification

Parameters
[in]contextKernel context
[in]ort_opOperator that has been created
[in]input_valuesArray of inputs
[in]input_countNumber of inputs
[in]output_valuesArray of outputs
[in]output_countNumber of outputs
Since
Version 1.12.
OrtApi::ORT_API2_STATUS ( SessionOptionsAppendExecutionProvider  ,
_In_ OrtSessionOptions *  options,
_In_ const char *  provider_name,
_In_reads_(num_keys) const char *const provider_options_keys,
_In_reads_(num_keys) const char *const provider_options_values,
_In_ size_t  num_keys 
)

: Append execution provider to the session options.

Parameters
[in]options
[in]provider_name- provider to add.
[in]provider_options_keys- keys to configure the provider options
[in]provider_options_values- values to configure the provider options
[in]num_keys- number of keys passed in

Currently supported providers: SNPE XNNPACK

Note: If an execution provider has a dedicated SessionOptionsAppendExecutionProvider_<provider name> function that should be used to add it.

SNPE supported keys: "runtime": SNPE runtime engine, options: "CPU", "CPU_FLOAT32", "GPU", "GPU_FLOAT32_16_HYBRID", "GPU_FLOAT16", "DSP", "DSP_FIXED8_TF", "AIP_FIXED_TF", "AIP_FIXED8_TF". Mapping to SNPE Runtime_t definition: CPU, CPU_FLOAT32 => zdl::DlSystem::Runtime_t::CPU; GPU, GPU_FLOAT32_16_HYBRID => zdl::DlSystem::Runtime_t::GPU; GPU_FLOAT16 => zdl::DlSystem::Runtime_t::GPU_FLOAT16; DSP, DSP_FIXED8_TF => zdl::DlSystem::Runtime_t::DSP. AIP_FIXED_TF, AIP_FIXED8_TF => zdl::DlSystem::Runtime_t::AIP_FIXED_TF. "priority": execution priority, options: "low", "normal". "buffer_type": ITensor or user buffers, options: "ITENSOR", user buffer with different types - "TF8", "TF16", "UINT8", "FLOAT". "ITENSOR" – default, ITensor which is float only. "TF8" – quantized model required, "FLOAT" – for both quantized or non-quantized model If SNPE is not available (due to a non Snpe enabled build or its dependencies not being installed), this function will fail.

XNNPACK supported keys: "intra_op_num_threads": number of thread-pool size to use for XNNPACK execution provider. default value is 0, which means to use the session thread-pool size.

Since
Version 1.12.
OrtApi::ORT_API2_STATUS ( CopyKernelInfo  ,
_In_ const OrtKernelInfo info,
_Outptr_ OrtKernelInfo **  info_copy 
)
OrtApi::ORT_API2_STATUS ( SessionOptionsAppendExecutionProvider_CANN  ,
_In_ OrtSessionOptions *  options,
_In_ const OrtCANNProviderOptions cann_options 
)

Append CANN provider to session options.

If CANN is not available (due to a non CANN enabled build, or if CANN is not installed on the system), this function will return failure.

Parameters
[in]options
[in]cann_optionsdoc} snippets.dox OrtStatus Return Value
Since
Version 1.13.
OrtApi::ORT_API2_STATUS ( CreateCANNProviderOptions  ,
_Outptr_ OrtCANNProviderOptions **  out 
)

Create an OrtCANNProviderOptions.

Parameters
[out]outcreated OrtCANNProviderOptions. Must be released with OrtApi::ReleaseCANNProviderOptions

doc} snippets.dox OrtStatus Return Value

Since
Version 1.13.
OrtApi::ORT_API2_STATUS ( UpdateCANNProviderOptions  ,
_Inout_ OrtCANNProviderOptions cann_options,
_In_reads_(num_keys) const char *const provider_options_keys,
_In_reads_(num_keys) const char *const provider_options_values,
_In_ size_t  num_keys 
)

Set options in a CANN Execution Provider.

Parameters
[in]cann_options
[in]provider_options_keysArray of UTF-8 null-terminated string for provider options keys
[in]provider_options_valuesArray of UTF-8 null-terminated string for provider options values
[in]num_keysNumber of elements in the provider_option_keys and provider_options_values arrays

doc} snippets.dox OrtStatus Return Value

Since
Version 1.13.
OrtApi::ORT_API2_STATUS ( GetCANNProviderOptionsAsString  ,
_In_ const OrtCANNProviderOptions cann_options,
_Inout_ OrtAllocator allocator,
_Outptr_ char **  ptr 
)

Get serialized CANN provider options string.

Parameters
[in]cann_optionsOrtCANNProviderOptions instance
[in]allocatora ptr to an instance of OrtAllocator obtained with CreateAllocator() or GetAllocatorWithDefaultOptions(), the specified allocator will be used to allocate continuous buffers for output strings and lengths.
[out]ptris a UTF-8 null terminated string allocated using 'allocator'. The caller is responsible for using the same allocator to free it.

doc} snippets.dox OrtStatus Return Value

Since
Version 1.13.
OrtApi::ORT_API2_STATUS ( UpdateEnvWithCustomLogLevel  ,
_In_ OrtEnv *  ort_env,
OrtLoggingLevel  log_severity_level 
)
OrtApi::ORT_API2_STATUS ( SetGlobalIntraOpThreadAffinity  ,
_Inout_ OrtThreadingOptions *  tp_options,
const char *  affinity_string 
)
OrtApi::ORT_API2_STATUS ( RegisterCustomOpsLibrary_V2  ,
_Inout_ OrtSessionOptions *  options,
_In_ const ORTCHAR_T library_name 
)

Register custom ops from a shared library.

Loads a shared library (.dll on windows, .so on linux, etc) named 'library_name' and looks for this entry point: OrtStatus* RegisterCustomOps(OrtSessionOptions * options, const OrtApiBase* api); It then passes in the provided session options to this function along with the api base.

The handle to the loaded library is automatically released by ORT when the last OrtSession that references the library handle is released. If no OrtSession is created, then the library handle is released when the provided OrtSessionOptions is released.

Parameters
[in]optionsThe session options.
[in]library_nameThe name of the shared library to load and register. Refer to OS-specific dynamic library loading utilities (e.g., LoadLibraryEx on Windows or dlopen on Linux/MacOS) for information on the format of library names and search paths.

doc} snippets.dox OrtStatus Return Value

Since
Version 1.14
OrtApi::ORT_API2_STATUS ( RegisterCustomOpsUsingFunction  ,
_Inout_ OrtSessionOptions *  options,
_In_ const char *  registration_func_name 
)

Register custom ops by calling a RegisterCustomOpsFn function.

Searches for registration_func_name and if found calls it.

The library containing the function must either be linked against or previously loaded by the executable.

If you want ONNX Runtime to load the library and manage its lifetime, use RegisterCustomOpsLibrary_V2.

RegisterCustomOpsUsingFunction can be used in scenarios where it may not be possible for ONNX Runtime to load the library from a path. e.g. mobile platforms where the library must be linked into the app.

The registration function must have the signature of RegisterCustomOpsFn: OrtStatus* (fn)(OrtSessionOptions options, const OrtApiBase* api);

See https://onnxruntime.ai/docs/reference/operators/add-custom-op.html for details on how the registration function should be implemented.

Parameters
[in]optionsOrtSessionOptions that is passed through as the first argument in the call to the registration function.
[in]registration_func_nameName of registration function to use.

doc} snippets.dox OrtStatus Return Value

Since
Version 1.14
OrtApi::ORT_API2_STATUS ( KernelInfo_GetInputCount  ,
_In_ const OrtKernelInfo info,
_Out_ size_t *  out 
)

Get the number of inputs from OrtKernelInfo.

Used in the CreateKernel callback of an OrtCustomOp to query the number of inputs during kernel/session creation.

Parameters
[in]infoInstance of OrtKernelInfo.
[out]outPointer to variable assigned with the result on success.

doc} snippets.dox OrtStatus Return Value

Since
Version 1.14
OrtApi::ORT_API2_STATUS ( KernelInfo_GetOutputCount  ,
_In_ const OrtKernelInfo info,
_Out_ size_t *  out 
)

Get the number of outputs from OrtKernelInfo.

Used in the CreateKernel callback of an OrtCustomOp to query the number of outputs during kernel/session creation.

Parameters
[in]infoInstance of OrtKernelInfo.
[out]outPointer to variable assigned with the result on success.

doc} snippets.dox OrtStatus Return Value

Since
Version 1.14
OrtApi::ORT_API2_STATUS ( KernelInfo_GetInputName  ,
_In_ const OrtKernelInfo info,
size_t  index,
_Out_ char *  out,
_Inout_ size_t *  size 
)

Get the name of a OrtKernelInfo's input.

Used in the CreateKernel callback of an OrtCustomOp to query an input's name during kernel/session creation.

If out is nullptr, the value of size is set to the size of the name string (including null-terminator), and a success status is returned.

If the size parameter is greater than or equal to the name string's size, the value of size is set to the true size of the string (including null-terminator), the provided memory is filled with the string's contents, and a success status is returned.

If the size parameter is less than the actual string's size and out is not nullptr, the value of size is set to the true size of the string and a failure status is returned.

Parameters
[in]infoAn instance of OrtKernelInfo.
[in]indexThe index of the input name to get. Returns a failure status if out-of-bounds.
[out]outMemory location into which to write the UTF-8 null-terminated string representing the input's name.
[in,out]sizePointer to the size of the out buffer. See above comments for details.

doc} snippets.dox OrtStatus Return Value

Since
Version 1.14
OrtApi::ORT_API2_STATUS ( KernelInfo_GetOutputName  ,
_In_ const OrtKernelInfo info,
size_t  index,
_Out_ char *  out,
_Inout_ size_t *  size 
)

Get the name of a OrtKernelInfo's output.

Used in the CreateKernel callback of an OrtCustomOp to query an output's name during kernel/session creation.

If out is nullptr, the value of size is set to the size of the name string (including null-terminator), and a success status is returned.

If the size parameter is greater than or equal to the name string's size, the value of size is set to the true size of the string (including null-terminator), the provided memory is filled with the string's contents, and a success status is returned.

If the size parameter is less than the actual string's size and out is not nullptr, the value of size is set to the true size of the string and a failure status is returned.

Parameters
[in]infoAn instance of OrtKernelInfo.
[in]indexThe index of the output name to get. Returns a failure status if out-of-bounds.
[out]outMemory location into which to write the UTF-8 null-terminated string representing the output's name.
[in,out]sizePointer to the size of the out buffer. See above comments for details.

doc} snippets.dox OrtStatus Return Value

Since
Version 1.14
OrtApi::ORT_API2_STATUS ( KernelInfo_GetInputTypeInfo  ,
_In_ const OrtKernelInfo info,
size_t  index,
_Outptr_ OrtTypeInfo **  type_info 
)

Get the type information for a OrtKernelInfo's input.

Used in the CreateKernel callback of an OrtCustomOp to query the shape and type information of an input during kernel/session creation.

Parameters
[in]infoAn instance of OrtKernelInfo.
[out]type_infoPointer set to the resulting ::OrtTypeInfo. Must be freed with OrtApi::ReleaseTypeInfo.

doc} snippets.dox OrtStatus Return Value

Since
Version 1.14
OrtApi::ORT_API2_STATUS ( KernelInfo_GetOutputTypeInfo  ,
_In_ const OrtKernelInfo info,
size_t  index,
_Outptr_ OrtTypeInfo **  type_info 
)

Get the type information for a OrtKernelInfo's output.

Used in the CreateKernel callback of an OrtCustomOp to query the shape and type information of an output during kernel/session creation.

Parameters
[in]infoAn instance of OrtKernelInfo.
[out]type_infoPointer set to the resulting ::OrtTypeInfo. Must be freed with OrtApi::ReleaseTypeInfo.

doc} snippets.dox OrtStatus Return Value

Since
Version 1.14
OrtApi::ORT_API2_STATUS ( KernelInfoGetAttribute_tensor  ,
_In_ const OrtKernelInfo info,
_In_z_ const char *  name,
_Inout_ OrtAllocator allocator,
_Outptr_ OrtValue **  out 
)

Get a OrtValue tensor stored as an attribute in the graph node.

Used in the CreateKernel callback of an OrtCustomOp to get a tensor attribute.

Parameters
[in]infoOrtKernelInfo instance.
[in]nameUTF-8 null-terminated string representing the attribute's name.
[in]allocatorAllocator used to allocate the internal tensor state.
[out]outReturns newly created OrtValue. Must be freed with OrtApi::ReleaseValue, which will also free internal tensor state allocated with the provided allocator.

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_API2_STATUS ( HasSessionConfigEntry  ,
_In_ const OrtSessionOptions *  options,
_In_z_ const char *  config_key,
_Out_ int out 
)

Checks if the given session configuration entry exists.

The config_key formats are defined in onnxruntime_session_options_config_keys.h

Can be used in a custom operator library to check for session configuration entries that target one or more custom operators in the library. Example: The config entry custom_op.myop.some_key targets a custom op named "myop".

Parameters
[in]optionsThe ::OrtSessionOptions instance.
[in]config_keyA null-terminated UTF-8 string representation of the configuration key.
[out]outPointer set to 1 if the entry exists and 0 otherwise.

doc} snippets.dox OrtStatus Return Value

Since
Version 1.14
OrtApi::ORT_API2_STATUS ( GetSessionConfigEntry  ,
_In_ const OrtSessionOptions *  options,
_In_z_ const char *  config_key,
_Out_ char *  config_value,
_Inout_ size_t *  size 
)

Get a session configuration value.

Returns a failure status if the configuration key does not exist. The config_key and the format of config_value are defined in onnxruntime_session_options_config_keys.h

If config_value is nullptr, the value of size is set to the true size of the string value (including null-terminator), and a success status is returned.

If the size parameter is greater than or equal to the actual string value's size, the value of size is set to the true size of the string value, the provided memory is filled with the value's contents, and a success status is returned.

If the size parameter is less than the actual string value's size and config_value is not nullptr, the value of size is set to the true size of the string value and a failure status is returned.

Can be used in a custom operator library to get session configuration entries that target one or more custom operators in the library. Example: The config entry custom_op.myop.some_key targets a custom op named "myop".

Parameters
[in]optionsThe session options.
[in]config_keyA null-terminated UTF-8 string representation of the config key.
[in]config_valuePointer to memory where the null-terminated UTF-8 string value will be stored.
[in,out]sizePointer to the size of the config_value buffer. See above comments for details.

doc} snippets.dox OrtStatus Return Value

Since
Version 1.14
OrtApi::ORT_CLASS_RELEASE ( Env  )

Create an OrtEnv.

Parameters
[in]log_severity_levelThe log severity level.
[in]logidThe log identifier.
[out]outReturned newly created OrtEnv. Must be freed with OrtApi::ReleaseEnv

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_CLASS_RELEASE ( Status  )

Create an OrtStatus from a null terminated string.

Parameters
[in]code
[in]msgA null-terminated string. Its contents will be copied.
Returns
A new OrtStatus object, must be destroyed with OrtApi::ReleaseStatus
OrtApi::ORT_CLASS_RELEASE ( MemoryInfo  )

Create an OrtMemoryInfo.

Parameters
[in]name
[in]type
[in]id
[in]mem_type
[out]outNewly created OrtMemoryInfo. Must be freed with OrtAPi::ReleaseMemoryInfo

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_CLASS_RELEASE ( Session  )

Create an OrtSession from a model file.

Parameters
[in]env
[in]model_path
[in]options
[out]outReturned newly created OrtSession. Must be freed with OrtApi::ReleaseSession

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_CLASS_RELEASE ( Value  )

Create a tensor.

Create a tensor using a supplied OrtAllocator

Parameters
[in]allocator
[in]shapePointer to the tensor shape dimensions.
[in]shape_lenThe number of tensor shape dimensions.
[in]type
[out]outReturns newly created OrtValue. Must be freed with OrtApi::ReleaseValue

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_CLASS_RELEASE ( RunOptions  )

Create an OrtRunOptions.

Parameters
[out]outReturned newly created OrtRunOptions. Must be freed with OrtApi::ReleaseRunOptions

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_CLASS_RELEASE ( TypeInfo  )

Get ::OrtTensorTypeAndShapeInfo from an ::OrtTypeInfo.

Parameters
[in]type_info
[out]outDo not free this value, it will be valid until type_info is freed.

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_CLASS_RELEASE ( TensorTypeAndShapeInfo  )

Create an ::OrtTensorTypeAndShapeInfo object.

Parameters
[out]outReturns newly created ::OrtTensorTypeAndShapeInfo. Must be freed with OrtApi::ReleaseTensorTypeAndShapeInfo

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_CLASS_RELEASE ( SessionOptions  )

Create an ::OrtSessionOptions object.

To use additional providers, you must build ORT with the extra providers enabled. Then call one of these functions to enable them in the session:
OrtSessionOptionsAppendExecutionProvider_CPU
OrtSessionOptionsAppendExecutionProvider_CUDA
OrtSessionOptionsAppendExecutionProvider_(remaining providers...)
The order they are called indicates the preference order as well. In other words call this method on your most preferred execution provider first followed by the less preferred ones. If none are called Ort will use its internal CPU execution provider.

Parameters
[out]optionsThe newly created OrtSessionOptions. Must be freed with OrtApi::ReleaseSessionOptions

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_CLASS_RELEASE ( CustomOpDomain  )

Create a custom op domain.

Parameters
[in]domain
[out]outNewly created domain. Must be freed with OrtApi::ReleaseCustomOpDomain

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_CLASS_RELEASE ( MapTypeInfo  )

Get key type from an ::OrtMapTypeInfo.

Key types are restricted to being scalar types.

This is used by WinML to support model reflection APIs.

Parameters
[in]map_type_info
[out]outdoc} snippets.dox OrtStatus Return Value
OrtApi::ORT_CLASS_RELEASE ( SequenceTypeInfo  )

Get element type from an ::OrtSequenceTypeInfo.

This is used by WinML to support model reflection APIs.

Parameters
[in]sequence_type_info
[out]type_infodoc} snippets.dox OrtStatus Return Value
OrtApi::ORT_CLASS_RELEASE ( ModelMetadata  )

Get producer name from an ::OrtModelMetadata.

Parameters
[in]model_metadata
[in]allocator
[out]valueSet to a null terminated string allocated using allocator. Must be freed using allocator

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_CLASS_RELEASE ( ThreadingOptions  )

Create an ::OrtThreadingOptions.

Parameters
[out]outNewly created ::OrtThreadingOptions. Must be freed with OrtApi::ReleaseThreadingOptions doc} snippets.dox OrtStatus Return Value
OrtApi::ORT_CLASS_RELEASE ( Allocator  )

Release an OrtAllocator obtained from OrtApi::CreateAllocator.

OrtApi::ORT_CLASS_RELEASE ( IoBinding  )

Release an ::OrtIoBinding obtained from OrtApi::CreateIoBinding.

OrtApi::ORT_CLASS_RELEASE ( ArenaCfg  )
Deprecated:
Use OrtApi::CreateArenaCfgV2

This will create the configuration of an arena that can eventually be used to define an arena based allocator's behavior

Parameters
[in]max_memUse 0 to allow ORT to choose the default
[in]arena_extend_strategyUse -1 to allow ORT to choose the default, 0 = kNextPowerOfTwo, 1 = kSameAsRequested
[in]initial_chunk_size_bytesUse -1 to allow ORT to choose the default
[in]max_dead_bytes_per_chunkUse -1 to allow ORT to choose the default
[in]outA pointer to an OrtArenaCfg instance

doc} snippets.dox OrtStatus Return Value

OrtApi::ORT_CLASS_RELEASE ( PrepackedWeightsContainer  )

Release OrtPrepackedWeightsContainer instance.

Note
instance must not be released until the sessions using it are released
OrtApi::ORT_CLASS_RELEASE ( OpAttr  )
OrtApi::ORT_CLASS_RELEASE ( Op  )
OrtApi::ORT_CLASS_RELEASE ( KernelInfo  )
OrtApi::OrtErrorCode ( ORT_API_CALL GetErrorCode) const

Get OrtErrorCode from OrtStatus.

Parameters
[in]status
Returns
OrtErrorCode that status was created with
OrtApi::void ( ORT_API_CALL ClearBoundInputs)

Clears any previously set Inputs for an ::OrtIoBinding.

OrtApi::void ( ORT_API_CALL ClearBoundOutputs)

Clears any previously set Outputs for an ::OrtIoBinding.

OrtApi::void ( ORT_API_CALL ReleaseTensorRTProviderOptions)

Release an OrtTensorRTProviderOptionsV2.

Note
This is an exception in the naming convention of other Release* functions, as the name of the method does not have the V2 suffix, but the type does
OrtApi::void ( ORT_API_CALL ReleaseCUDAProviderOptions)

Release an OrtCUDAProviderOptionsV2.

Note
This is an exception in the naming convention of other Release* functions, as the name of the method does not have the V2 suffix, but the type does
Since
Version 1.11.
OrtApi::void ( ORT_API_CALL ReleaseCANNProviderOptions)

Release an OrtCANNProviderOptions.

Parameters
[in]thepointer of OrtCANNProviderOptions which will been deleted
Since
Version 1.13.
OrtApi::void ( ORT_API_CALL MemoryInfoGetDeviceType) const

Member Data Documentation

Definition at line 3618 of file onnxruntime_c_api.h.


The documentation for this struct was generated from the following file: