ONNX Runtime
Loading...
Searching...
No Matches
onnxruntime_c_api.h
1// Copyright (c) Microsoft Corporation. All rights reserved.
2// Licensed under the MIT License.
3
4// See docs\c_cxx\README.md on generating the Doxygen documentation from this file
5
31#pragma once
32#include <stdbool.h>
33#include <stdint.h>
34#include <stdlib.h>
35#include <string.h>
36
41#define ORT_API_VERSION 23
42
43#ifdef __cplusplus
44extern "C" {
45#endif
46
48// SAL2 Definitions
49#ifndef _MSC_VER
50#define _In_
51#define _In_z_
52#define _In_opt_
53#define _In_opt_z_
54#define _Out_
55#define _Outptr_
56#define _Out_opt_
57#define _Inout_
58#define _Inout_opt_
59#define _Frees_ptr_opt_
60#define _Ret_maybenull_
61#define _Ret_notnull_
62#define _Check_return_
63#define _Outptr_result_maybenull_
64#define _In_reads_(X)
65#define _Inout_updates_(X)
66#define _Out_writes_(X)
67#define _Inout_updates_all_(X)
68#define _Out_writes_bytes_all_(X)
69#define _Out_writes_all_(X)
70#define _Success_(X)
71#define _Outptr_result_buffer_maybenull_(X)
72#define ORT_ALL_ARGS_NONNULL __attribute__((nonnull))
73#else
74#include <specstrings.h>
75#define ORT_ALL_ARGS_NONNULL
76#endif
77
78#ifdef _WIN32
79// Define ORT_DLL_IMPORT if your program is dynamically linked to Ort.
80// dllexport is not used, we use a .def file.
81#ifdef ORT_DLL_IMPORT
82#define ORT_EXPORT __declspec(dllimport)
83#else
84#define ORT_EXPORT
85#endif
86#define ORT_API_CALL _stdcall
87#define ORT_MUST_USE_RESULT
88#define ORTCHAR_T wchar_t
89#else
90// To make symbols visible on macOS/iOS
91#ifdef __APPLE__
92#define ORT_EXPORT __attribute__((visibility("default")))
93#else
94#define ORT_EXPORT
95#endif
96#define ORT_API_CALL
97#define ORT_MUST_USE_RESULT __attribute__((warn_unused_result))
98#define ORTCHAR_T char
99#endif
100
103#ifndef ORT_TSTR
104#ifdef _WIN32
105#define ORT_TSTR(X) L##X
106// When X is a macro, L##X is not defined. In this case, we need to use ORT_TSTR_ON_MACRO.
107#define ORT_TSTR_ON_MACRO(X) L"" X
108#else
109#define ORT_TSTR(X) X
110#define ORT_TSTR_ON_MACRO(X) X
111#endif
112#endif
113
114// On Windows, ORT_FILE is a wchar_t version of the __FILE__ macro.
115// Otherwise, ORT_FILE is equivalent to __FILE__.
116#ifndef ORT_FILE
117#define ORT_FILE_INTERNAL(x) ORT_TSTR(x)
118#define ORT_FILE ORT_FILE_INTERNAL(__FILE__)
119#endif
120
121// Any pointer marked with _In_ or _Out_, cannot be NULL.
122
123// Windows users should use unicode paths when possible to bypass the MAX_PATH limitation
124// Every pointer marked with _In_ or _Out_, cannot be NULL. Caller should ensure that.
125// for ReleaseXXX(...) functions, they can accept NULL pointer.
126
127#ifdef __cplusplus
128// For any compiler with C++11 support, MSVC 2015 and greater, or Clang version supporting noexcept.
129// Such complex condition is needed because compilers set __cplusplus value differently.
130#ifndef __has_feature
131#define __has_feature(x) 0
132#endif
133#if ((__cplusplus >= 201103L) || (_MSC_VER >= 1900) || (defined(__has_feature) && __has_feature(cxx_noexcept)))
134#define NO_EXCEPTION noexcept
135#else
136#define NO_EXCEPTION throw()
137#endif
138#else
139#define NO_EXCEPTION
140#endif
141
142// __VA_ARGS__ on Windows and Linux are different
143#define ORT_API(RETURN_TYPE, NAME, ...) RETURN_TYPE ORT_API_CALL NAME(__VA_ARGS__) NO_EXCEPTION
144
145#define ORT_API_STATUS(NAME, ...) \
146 _Success_(return == 0) _Check_return_ _Ret_maybenull_ OrtStatusPtr ORT_API_CALL NAME(__VA_ARGS__) \
147 NO_EXCEPTION ORT_MUST_USE_RESULT
148
149// XXX: Unfortunately, SAL annotations are known to not work with function pointers
150#define ORT_API2_STATUS(NAME, ...) \
151 _Check_return_ _Ret_maybenull_ OrtStatusPtr(ORT_API_CALL* NAME)(__VA_ARGS__) NO_EXCEPTION ORT_MUST_USE_RESULT
152
153// Used in *.cc files. Almost as same as ORT_API_STATUS, except without ORT_MUST_USE_RESULT and ORT_EXPORT
154#define ORT_API_STATUS_IMPL(NAME, ...) \
155 _Success_(return == 0) _Check_return_ _Ret_maybenull_ OrtStatusPtr ORT_API_CALL NAME(__VA_ARGS__) NO_EXCEPTION
156
157#define ORT_CLASS_RELEASE(X) void(ORT_API_CALL * Release##X)(_Frees_ptr_opt_ Ort##X * input)
158
159#ifdef __DOXYGEN__
160#undef ORT_API_STATUS
161#define ORT_API_STATUS(NAME, ...) OrtStatus* NAME(__VA_ARGS__)
162#undef ORT_API2_STATUS
163#define ORT_API2_STATUS(NAME, ...) OrtStatus* NAME(__VA_ARGS__)
164#undef ORT_CLASS_RELEASE
165#define ORT_CLASS_RELEASE(X) void Release##X(Ort##X* input)
166#undef NO_EXCEPTION
167#define NO_EXCEPTION
168#endif
179 ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT, // maps to c type float
180 ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT8, // maps to c type uint8_t
181 ONNX_TENSOR_ELEMENT_DATA_TYPE_INT8, // maps to c type int8_t
182 ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT16, // maps to c type uint16_t
183 ONNX_TENSOR_ELEMENT_DATA_TYPE_INT16, // maps to c type int16_t
184 ONNX_TENSOR_ELEMENT_DATA_TYPE_INT32, // maps to c type int32_t
185 ONNX_TENSOR_ELEMENT_DATA_TYPE_INT64, // maps to c type int64_t
186 ONNX_TENSOR_ELEMENT_DATA_TYPE_STRING, // maps to c++ type std::string
189 ONNX_TENSOR_ELEMENT_DATA_TYPE_DOUBLE, // maps to c type double
190 ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT32, // maps to c type uint32_t
191 ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT64, // maps to c type uint64_t
192 ONNX_TENSOR_ELEMENT_DATA_TYPE_COMPLEX64, // complex with float32 real and imaginary components
193 ONNX_TENSOR_ELEMENT_DATA_TYPE_COMPLEX128, // complex with float64 real and imaginary components
194 ONNX_TENSOR_ELEMENT_DATA_TYPE_BFLOAT16, // Non-IEEE floating-point format based on IEEE754 single-precision
195 // float 8 types were introduced in onnx 1.14, see https://onnx.ai/onnx/technical/float8.html
196 ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT8E4M3FN, // Non-IEEE floating-point format based on IEEE754 single-precision
197 ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT8E4M3FNUZ, // Non-IEEE floating-point format based on IEEE754 single-precision
198 ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT8E5M2, // Non-IEEE floating-point format based on IEEE754 single-precision
199 ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT8E5M2FNUZ, // Non-IEEE floating-point format based on IEEE754 single-precision
200 // Int4 types were introduced in ONNX 1.16. See https://onnx.ai/onnx/technical/int4.html
201 ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT4, // maps to a pair of packed uint4 values (size == 1 byte)
202 ONNX_TENSOR_ELEMENT_DATA_TYPE_INT4 // maps to a pair of packed int4 values (size == 1 byte)
204
205// Synced with onnx TypeProto oneof
215
216// These types are synced with internal
217// SparseFormatFlags
224
225// Enum allows to query sparse tensor indices
232
244
261
271
273#define ORT_RUNTIME_CLASS(X) \
274 struct Ort##X; \
275 typedef struct Ort##X Ort##X
276
281// The actual types defined have an Ort prefix
282ORT_RUNTIME_CLASS(Env);
283ORT_RUNTIME_CLASS(Status); // nullptr for Status* indicates success
284ORT_RUNTIME_CLASS(MemoryInfo);
285ORT_RUNTIME_CLASS(IoBinding);
286ORT_RUNTIME_CLASS(Session); // Don't call ReleaseSession from Dllmain (because session owns a thread pool)
287ORT_RUNTIME_CLASS(Value);
288ORT_RUNTIME_CLASS(RunOptions);
289ORT_RUNTIME_CLASS(TypeInfo);
290ORT_RUNTIME_CLASS(TensorTypeAndShapeInfo);
291ORT_RUNTIME_CLASS(MapTypeInfo);
292ORT_RUNTIME_CLASS(SequenceTypeInfo);
293ORT_RUNTIME_CLASS(OptionalTypeInfo);
294ORT_RUNTIME_CLASS(SessionOptions);
295ORT_RUNTIME_CLASS(CustomOpDomain);
296ORT_RUNTIME_CLASS(ModelMetadata);
297ORT_RUNTIME_CLASS(ThreadPoolParams);
298ORT_RUNTIME_CLASS(ThreadingOptions);
299ORT_RUNTIME_CLASS(ArenaCfg);
300ORT_RUNTIME_CLASS(PrepackedWeightsContainer);
301ORT_RUNTIME_CLASS(TensorRTProviderOptionsV2);
302ORT_RUNTIME_CLASS(NvTensorRtRtxProviderOptions);
303ORT_RUNTIME_CLASS(CUDAProviderOptionsV2);
304ORT_RUNTIME_CLASS(CANNProviderOptions);
305ORT_RUNTIME_CLASS(DnnlProviderOptions);
306ORT_RUNTIME_CLASS(Op);
307ORT_RUNTIME_CLASS(OpAttr);
308ORT_RUNTIME_CLASS(Logger);
309ORT_RUNTIME_CLASS(ShapeInferContext);
310ORT_RUNTIME_CLASS(LoraAdapter);
311ORT_RUNTIME_CLASS(ValueInfo);
312ORT_RUNTIME_CLASS(Node);
313ORT_RUNTIME_CLASS(Graph);
314ORT_RUNTIME_CLASS(Model);
315ORT_RUNTIME_CLASS(ModelCompilationOptions);
316ORT_RUNTIME_CLASS(HardwareDevice);
317ORT_RUNTIME_CLASS(EpDevice);
318ORT_RUNTIME_CLASS(KeyValuePairs);
319
320#ifdef _MSC_VER
321typedef _Return_type_success_(return == 0) OrtStatus* OrtStatusPtr;
322#else
324#endif
325
332typedef struct OrtAllocator {
333 uint32_t version;
334 void*(ORT_API_CALL* Alloc)(struct OrtAllocator* this_, size_t size);
335 void(ORT_API_CALL* Free)(struct OrtAllocator* this_, void* p);
336 const struct OrtMemoryInfo*(ORT_API_CALL* Info)(const struct OrtAllocator* this_);
342 void*(ORT_API_CALL* Reserve)(struct OrtAllocator* this_, size_t size);
343
362 ORT_API2_STATUS(GetStats, _In_ const struct OrtAllocator* this_, _Outptr_ OrtKeyValuePairs** out);
364
365typedef void(ORT_API_CALL* OrtLoggingFunction)(
366 void* param, OrtLoggingLevel severity, const char* category, const char* logid, const char* code_location,
367 const char* message);
368
381
386
399
400struct OrtKernelInfo;
402struct OrtKernelContext;
404struct OrtCustomOp;
406
412
415// Whenever this struct is updated, please also update the MakeKey function in onnxruntime / core / framework / execution_provider.cc
422
430
436
448
468typedef OrtStatus*(ORT_API_CALL* EpSelectionDelegate)(_In_ const OrtEpDevice** ep_devices,
469 _In_ size_t num_devices,
470 _In_ const OrtKeyValuePairs* model_metadata,
471 _In_opt_ const OrtKeyValuePairs* runtime_metadata,
472 _Inout_ const OrtEpDevice** selected,
473 _In_ size_t max_selected,
474 _Out_ size_t* num_selected,
475 _In_ void* state);
476
480 OrtCudnnConvAlgoSearchExhaustive, // expensive exhaustive benchmarking using cudnnFindConvolutionForwardAlgorithmEx
481 OrtCudnnConvAlgoSearchHeuristic, // lightweight heuristic based search using cudnnGetConvolutionForwardAlgorithm_v7
482 OrtCudnnConvAlgoSearchDefault, // default algorithm using CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_PRECOMP_GEMM
484
571
660
667 int has_user_compute_stream; // indicator of user specified CUDA compute stream.
668 void* user_compute_stream; // user specified CUDA compute stream.
669 int trt_max_partition_iterations; // maximum iterations for TensorRT parser to get capability
670 int trt_min_subgraph_size; // minimum size of TensorRT subgraphs
671 size_t trt_max_workspace_size; // maximum workspace size for TensorRT.
672 int trt_fp16_enable; // enable TensorRT FP16 precision. Default 0 = false, nonzero = true
673 int trt_int8_enable; // enable TensorRT INT8 precision. Default 0 = false, nonzero = true
674 const char* trt_int8_calibration_table_name; // TensorRT INT8 calibration table name.
675 int trt_int8_use_native_calibration_table; // use native TensorRT generated calibration table. Default 0 = false, nonzero = true
676 int trt_dla_enable; // enable DLA. Default 0 = false, nonzero = true
677 int trt_dla_core; // DLA core number. Default 0
678 int trt_dump_subgraphs; // dump TRT subgraph. Default 0 = false, nonzero = true
679 int trt_engine_cache_enable; // enable engine caching. Default 0 = false, nonzero = true
680 const char* trt_engine_cache_path; // specify engine cache path
681 int trt_engine_decryption_enable; // enable engine decryption. Default 0 = false, nonzero = true
682 const char* trt_engine_decryption_lib_path; // specify engine decryption library path
683 int trt_force_sequential_engine_build; // force building TensorRT engine sequentially. Default 0 = false, nonzero = true
684 // This is the legacy struct and don't add new fields here.
685 // For new field that can be represented by string, please add it in include/onnxruntime/core/providers/tensorrt/tensorrt_provider_options.h
686 // For non-string field, need to create a new separate api to handle it.
688
694 int device_id; // hip device id.
695 int migraphx_fp16_enable; // MIGraphX FP16 precision. Default 0 = false, nonzero = true
696 int migraphx_fp8_enable; // MIGraphX FP8 precision. Default 0 = false, nonzero = true
697 int migraphx_int8_enable; // MIGraphX INT8 precision. Default 0 = false, nonzero = true
698 int migraphx_use_native_calibration_table; // MIGraphx INT8 cal table. Default 0 = false, noznero = true
699 const char* migraphx_int8_calibration_table_name; // MIGraphx INT8 calibration table name
700 int migraphx_save_compiled_model; // migraphx save compiled model. Default 0 = false, noznero = true
701 const char* migraphx_save_model_path; // migraphx model path name
702 int migraphx_load_compiled_model; // migraphx int8 cal table. Default 0 = false, noznero = true
703 const char* migraphx_load_model_path; // migraphx model path name
704 bool migraphx_exhaustive_tune; // migraphx tuned compile Default = false
705
711
719
721
732#ifdef __cplusplus
741#endif
746 const char* device_type;
748 const char* device_id;
750 const char* cache_dir; // path is set to empty by default
751 void* context;
753 unsigned char enable_dynamic_shapes;
755
756struct OrtApi;
757typedef struct OrtApi OrtApi;
758
759struct OrtTrainingApi;
761
762struct OrtModelEditorApi;
764
765struct OrtCompileApi;
767
768struct OrtEpApi;
769typedef struct OrtEpApi OrtEpApi;
770
785 const OrtApi*(ORT_API_CALL* GetApi)(uint32_t version)NO_EXCEPTION;
786
791 const char*(ORT_API_CALL* GetVersionString)(void)NO_EXCEPTION;
792};
793
794typedef struct OrtApiBase OrtApiBase;
795
800ORT_EXPORT const OrtApiBase* ORT_API_CALL OrtGetApiBase(void) NO_EXCEPTION;
801
807typedef void (*OrtThreadWorkerFn)(void* ort_worker_fn_param);
808
812
818typedef OrtCustomThreadHandle (*OrtCustomCreateThreadFn)(void* ort_custom_thread_creation_options, OrtThreadWorkerFn ort_thread_worker_fn, void* ort_worker_fn_param);
819
825typedef void (*OrtCustomJoinThreadFn)(OrtCustomThreadHandle ort_custom_thread_handle);
826
827typedef OrtStatus*(ORT_API_CALL* RegisterCustomOpsFn)(OrtSessionOptions* options, const OrtApiBase* api);
828
836typedef void (*RunAsyncCallbackFn)(void* user_data, OrtValue** outputs, size_t num_outputs, OrtStatusPtr status);
837
845struct OrtApi {
848
856 OrtStatus*(ORT_API_CALL* CreateStatus)(OrtErrorCode code, _In_ const char* msg)NO_EXCEPTION ORT_ALL_ARGS_NONNULL;
857
863 OrtErrorCode(ORT_API_CALL* GetErrorCode)(_In_ const OrtStatus* status) NO_EXCEPTION ORT_ALL_ARGS_NONNULL;
864
870 const char*(ORT_API_CALL* GetErrorMessage)(_In_ const OrtStatus* status)NO_EXCEPTION ORT_ALL_ARGS_NONNULL;
871
875
886 ORT_API2_STATUS(CreateEnv, OrtLoggingLevel log_severity_level, _In_ const char* logid, _Outptr_ OrtEnv** out);
887
902 ORT_API2_STATUS(CreateEnvWithCustomLogger, _In_ OrtLoggingFunction logging_function, _In_opt_ void* logger_param,
903 _In_ OrtLoggingLevel log_severity_level, _In_ const char* logid, _Outptr_ OrtEnv** out);
904
912 ORT_API2_STATUS(EnableTelemetryEvents, _In_ const OrtEnv* env);
920 ORT_API2_STATUS(DisableTelemetryEvents, _In_ const OrtEnv* env);
921
925
935 // TODO: document the path separator convention? '/' vs '\'
936 // TODO: should specify the access characteristics of model_path. Is this read only during the
937 // execution of CreateSession, or does the OrtSession retain a handle to the file/directory
938 // and continue to access throughout the OrtSession lifetime?
939 // What sort of access is needed to model_path : read or read/write?
940 ORT_API2_STATUS(CreateSession, _In_ const OrtEnv* env, _In_ const ORTCHAR_T* model_path,
941 _In_ const OrtSessionOptions* options, _Outptr_ OrtSession** out);
942
953 ORT_API2_STATUS(CreateSessionFromArray, _In_ const OrtEnv* env,
954 _In_ const void* model_data, size_t model_data_length,
955 _In_ const OrtSessionOptions* options, _Outptr_ OrtSession** out);
956
975 ORT_API2_STATUS(Run, _Inout_ OrtSession* session, _In_opt_ const OrtRunOptions* run_options,
976 _In_reads_(input_len) const char* const* input_names,
977 _In_reads_(input_len) const OrtValue* const* inputs, size_t input_len,
978 _In_reads_(output_names_len) const char* const* output_names, size_t output_names_len,
979 _Inout_updates_all_(output_names_len) OrtValue** outputs);
980
984
1000 ORT_API2_STATUS(CreateSessionOptions, _Outptr_ OrtSessionOptions** options);
1001
1009 ORT_API2_STATUS(SetOptimizedModelFilePath, _Inout_ OrtSessionOptions* options,
1010 _In_ const ORTCHAR_T* optimized_model_filepath);
1011
1019 ORT_API2_STATUS(CloneSessionOptions, _In_ const OrtSessionOptions* in_options,
1020 _Outptr_ OrtSessionOptions** out_options);
1021
1033 ORT_API2_STATUS(SetSessionExecutionMode, _Inout_ OrtSessionOptions* options, ExecutionMode execution_mode);
1034
1042 ORT_API2_STATUS(EnableProfiling, _Inout_ OrtSessionOptions* options, _In_ const ORTCHAR_T* profile_file_prefix);
1043
1050 ORT_API2_STATUS(DisableProfiling, _Inout_ OrtSessionOptions* options);
1051
1065 ORT_API2_STATUS(EnableMemPattern, _Inout_ OrtSessionOptions* options);
1066
1075 ORT_API2_STATUS(DisableMemPattern, _Inout_ OrtSessionOptions* options);
1076
1085 ORT_API2_STATUS(EnableCpuMemArena, _Inout_ OrtSessionOptions* options);
1086
1093 ORT_API2_STATUS(DisableCpuMemArena, _Inout_ OrtSessionOptions* options);
1094
1102 ORT_API2_STATUS(SetSessionLogId, _Inout_ OrtSessionOptions* options, const char* logid);
1103
1113 ORT_API2_STATUS(SetSessionLogVerbosityLevel, _Inout_ OrtSessionOptions* options, int session_log_verbosity_level);
1114
1122 ORT_API2_STATUS(SetSessionLogSeverityLevel, _Inout_ OrtSessionOptions* options, int session_log_severity_level);
1123
1132 ORT_API2_STATUS(SetSessionGraphOptimizationLevel, _Inout_ OrtSessionOptions* options,
1133 GraphOptimizationLevel graph_optimization_level);
1134
1148 ORT_API2_STATUS(SetIntraOpNumThreads, _Inout_ OrtSessionOptions* options, int intra_op_num_threads);
1149
1162 ORT_API2_STATUS(SetInterOpNumThreads, _Inout_ OrtSessionOptions* options, int inter_op_num_threads);
1163
1167
1175 ORT_API2_STATUS(CreateCustomOpDomain, _In_ const char* domain, _Outptr_ OrtCustomOpDomain** out);
1176
1186 ORT_API2_STATUS(CustomOpDomain_Add, _Inout_ OrtCustomOpDomain* custom_op_domain, _In_ const OrtCustomOp* op);
1187
1191
1201 ORT_API2_STATUS(AddCustomOpDomain, _Inout_ OrtSessionOptions* options, _In_ OrtCustomOpDomain* custom_op_domain);
1202
1219 ORT_API2_STATUS(RegisterCustomOpsLibrary, _Inout_ OrtSessionOptions* options, _In_ const char* library_path, _Outptr_ void** library_handle);
1220
1224
1236 ORT_API2_STATUS(SessionGetInputCount, _In_ const OrtSession* session, _Out_ size_t* out);
1237
1249 ORT_API2_STATUS(SessionGetOutputCount, _In_ const OrtSession* session, _Out_ size_t* out);
1250
1260 ORT_API2_STATUS(SessionGetOverridableInitializerCount, _In_ const OrtSession* session, _Out_ size_t* out);
1261
1270 ORT_API2_STATUS(SessionGetInputTypeInfo, _In_ const OrtSession* session, size_t index, _Outptr_ OrtTypeInfo** type_info);
1271
1280 ORT_API2_STATUS(SessionGetOutputTypeInfo, _In_ const OrtSession* session, size_t index, _Outptr_ OrtTypeInfo** type_info);
1281
1290 ORT_API2_STATUS(SessionGetOverridableInitializerTypeInfo, _In_ const OrtSession* session, size_t index, _Outptr_ OrtTypeInfo** type_info);
1291
1301 ORT_API2_STATUS(SessionGetInputName, _In_ const OrtSession* session, size_t index, _Inout_ OrtAllocator* allocator, _Outptr_ char** value);
1302
1312 ORT_API2_STATUS(SessionGetOutputName, _In_ const OrtSession* session, size_t index, _Inout_ OrtAllocator* allocator, _Outptr_ char** value);
1313
1323 ORT_API2_STATUS(SessionGetOverridableInitializerName, _In_ const OrtSession* session, size_t index,
1324 _Inout_ OrtAllocator* allocator, _Outptr_ char** value);
1325
1329
1336 ORT_API2_STATUS(CreateRunOptions, _Outptr_ OrtRunOptions** out);
1337
1347 ORT_API2_STATUS(RunOptionsSetRunLogVerbosityLevel, _Inout_ OrtRunOptions* options, int log_verbosity_level);
1348
1356 ORT_API2_STATUS(RunOptionsSetRunLogSeverityLevel, _Inout_ OrtRunOptions* options, int log_severity_level);
1357
1367 ORT_API2_STATUS(RunOptionsSetRunTag, _Inout_ OrtRunOptions* options, _In_ const char* run_tag);
1368
1378 ORT_API2_STATUS(RunOptionsGetRunLogVerbosityLevel, _In_ const OrtRunOptions* options,
1379 _Out_ int* log_verbosity_level);
1380
1388 ORT_API2_STATUS(RunOptionsGetRunLogSeverityLevel, _In_ const OrtRunOptions* options, _Out_ int* log_severity_level);
1389
1401 ORT_API2_STATUS(RunOptionsGetRunTag, _In_ const OrtRunOptions* options, _Out_ const char** run_tag);
1402
1411 ORT_API2_STATUS(RunOptionsSetTerminate, _Inout_ OrtRunOptions* options);
1412
1421 ORT_API2_STATUS(RunOptionsUnsetTerminate, _Inout_ OrtRunOptions* options);
1422
1426
1439 ORT_API2_STATUS(CreateTensorAsOrtValue, _Inout_ OrtAllocator* allocator, _In_ const int64_t* shape, size_t shape_len,
1441
1459 ORT_API2_STATUS(CreateTensorWithDataAsOrtValue, _In_ const OrtMemoryInfo* info, _Inout_ void* p_data,
1460 size_t p_data_len, _In_ const int64_t* shape, size_t shape_len, ONNXTensorElementDataType type,
1461 _Outptr_ OrtValue** out);
1462
1470 ORT_API2_STATUS(IsTensor, _In_ const OrtValue* value, _Out_ int* out);
1471
1482 ORT_API2_STATUS(GetTensorMutableData, _In_ OrtValue* value, _Outptr_ void** out);
1483
1492 ORT_API2_STATUS(FillStringTensor, _Inout_ OrtValue* value, _In_ const char* const* s, size_t s_len);
1493
1503 ORT_API2_STATUS(GetStringTensorDataLength, _In_ const OrtValue* value, _Out_ size_t* len);
1504
1524 ORT_API2_STATUS(GetStringTensorContent, _In_ const OrtValue* value, _Out_writes_bytes_all_(s_len) void* s,
1525 size_t s_len, _Out_writes_all_(offsets_len) size_t* offsets, size_t offsets_len);
1526
1530
1539 ORT_API2_STATUS(CastTypeInfoToTensorInfo, _In_ const OrtTypeInfo* type_info,
1540 _Outptr_result_maybenull_ const OrtTensorTypeAndShapeInfo** out);
1541
1549 ORT_API2_STATUS(GetOnnxTypeFromTypeInfo, _In_ const OrtTypeInfo* type_info, _Out_ enum ONNXType* out);
1550
1554
1562
1571
1580 ORT_API2_STATUS(SetDimensions, OrtTensorTypeAndShapeInfo* info, _In_ const int64_t* dim_values, size_t dim_count);
1581
1591 ORT_API2_STATUS(GetTensorElementType, _In_ const OrtTensorTypeAndShapeInfo* info,
1593
1603 ORT_API2_STATUS(GetDimensionsCount, _In_ const OrtTensorTypeAndShapeInfo* info, _Out_ size_t* out);
1604
1613 ORT_API2_STATUS(GetDimensions, _In_ const OrtTensorTypeAndShapeInfo* info, _Out_ int64_t* dim_values,
1614 size_t dim_values_length);
1615
1624 ORT_API2_STATUS(GetSymbolicDimensions, _In_ const OrtTensorTypeAndShapeInfo* info,
1625 _Out_writes_all_(dim_params_length) const char* dim_params[], size_t dim_params_length);
1626
1643 ORT_API2_STATUS(GetTensorShapeElementCount, _In_ const OrtTensorTypeAndShapeInfo* info, _Out_ size_t* out);
1644
1648
1656 ORT_API2_STATUS(GetTensorTypeAndShape, _In_ const OrtValue* value, _Outptr_ OrtTensorTypeAndShapeInfo** out);
1657
1665 ORT_API2_STATUS(GetTypeInfo, _In_ const OrtValue* value, _Outptr_result_maybenull_ OrtTypeInfo** out);
1666
1674 ORT_API2_STATUS(GetValueType, _In_ const OrtValue* value, _Out_ enum ONNXType* out);
1675
1679
1690 ORT_API2_STATUS(CreateMemoryInfo, _In_ const char* name, enum OrtAllocatorType type, int id,
1691 enum OrtMemType mem_type, _Outptr_ OrtMemoryInfo** out);
1692
1703 ORT_API2_STATUS(CreateCpuMemoryInfo, enum OrtAllocatorType type, enum OrtMemType mem_type,
1704 _Outptr_ OrtMemoryInfo** out);
1705
1716 ORT_API2_STATUS(CompareMemoryInfo, _In_ const OrtMemoryInfo* info1, _In_ const OrtMemoryInfo* info2, _Out_ int* out);
1717
1725 ORT_API2_STATUS(MemoryInfoGetName, _In_ const OrtMemoryInfo* ptr, _Out_ const char** out);
1726
1729 ORT_API2_STATUS(MemoryInfoGetId, _In_ const OrtMemoryInfo* ptr, _Out_ int* out);
1730
1733 ORT_API2_STATUS(MemoryInfoGetMemType, _In_ const OrtMemoryInfo* ptr, _Out_ OrtMemType* out);
1734
1737 ORT_API2_STATUS(MemoryInfoGetType, _In_ const OrtMemoryInfo* ptr, _Out_ OrtAllocatorType* out);
1738
1742
1744 ORT_API2_STATUS(AllocatorAlloc, _Inout_ OrtAllocator* ort_allocator, size_t size, _Outptr_ void** out);
1746 ORT_API2_STATUS(AllocatorFree, _Inout_ OrtAllocator* ort_allocator, void* p);
1748 ORT_API2_STATUS(AllocatorGetInfo, _In_ const OrtAllocator* ort_allocator, _Outptr_ const struct OrtMemoryInfo** out);
1749
1758 ORT_API2_STATUS(GetAllocatorWithDefaultOptions, _Outptr_ OrtAllocator** out);
1759
1763
1775 ORT_API2_STATUS(AddFreeDimensionOverride, _Inout_ OrtSessionOptions* options, _In_ const char* dim_denotation,
1776 _In_ int64_t dim_value);
1777
1781
1782 /* Internal information (not seen in Doxygen)
1783 *
1784 * APIs to support non-tensor types - map and sequence.
1785 * Currently only the following types are supported
1786 * Note: the following types should be kept in sync with data_types.h
1787 * Map types
1788 * =========
1789 * std::map<std::string, std::string>
1790 * std::map<std::string, int64_t>
1791 * std::map<std::string, float>
1792 * std::map<std::string, double>
1793 * std::map<int64_t, std::string>
1794 * std::map<int64_t, int64_t>
1795 * std::map<int64_t, float>
1796 * std::map<int64_t, double>
1797 *
1798 * Sequence types
1799 * ==============
1800 * std::vector<std::string>
1801 * std::vector<int64_t>
1802 * std::vector<float>
1803 * std::vector<double>
1804 * std::vector<std::map<std::string, float>>
1805 * std::vector<std::map<int64_t, float>
1806 */
1807
1822 ORT_API2_STATUS(GetValue, _In_ const OrtValue* value, int index, _Inout_ OrtAllocator* allocator,
1823 _Outptr_ OrtValue** out);
1824
1835 ORT_API2_STATUS(GetValueCount, _In_ const OrtValue* value, _Out_ size_t* out);
1836
1852 ORT_API2_STATUS(CreateValue, _In_reads_(num_values) const OrtValue* const* in, size_t num_values,
1853 enum ONNXType value_type, _Outptr_ OrtValue** out);
1854
1877 ORT_API2_STATUS(CreateOpaqueValue, _In_z_ const char* domain_name, _In_z_ const char* type_name,
1878 _In_ const void* data_container, size_t data_container_size, _Outptr_ OrtValue** out);
1879
1894 ORT_API2_STATUS(GetOpaqueValue, _In_ const char* domain_name, _In_ const char* type_name, _In_ const OrtValue* in,
1895 _Out_ void* data_container, size_t data_container_size);
1896
1901
1910 ORT_API2_STATUS(KernelInfoGetAttribute_float, _In_ const OrtKernelInfo* info, _In_ const char* name,
1911 _Out_ float* out);
1912
1921 ORT_API2_STATUS(KernelInfoGetAttribute_int64, _In_ const OrtKernelInfo* info, _In_ const char* name,
1922 _Out_ int64_t* out);
1923
1944 ORT_API2_STATUS(KernelInfoGetAttribute_string, _In_ const OrtKernelInfo* info, _In_ const char* name, _Out_ char* out,
1945 _Inout_ size_t* size);
1946
1951
1956 ORT_API2_STATUS(KernelContext_GetInputCount, _In_ const OrtKernelContext* context, _Out_ size_t* out);
1957
1962 ORT_API2_STATUS(KernelContext_GetOutputCount, _In_ const OrtKernelContext* context, _Out_ size_t* out);
1963
1975 ORT_API2_STATUS(KernelContext_GetInput, _In_ const OrtKernelContext* context, _In_ size_t index,
1976 _Out_ const OrtValue** out);
1977
1991 ORT_API2_STATUS(KernelContext_GetOutput, _Inout_ OrtKernelContext* context, _In_ size_t index,
1992 _In_ const int64_t* dim_values, size_t dim_count, _Outptr_ OrtValue** out);
1993
1997 ORT_CLASS_RELEASE(Env);
2001 ORT_CLASS_RELEASE(Status);
2005 ORT_CLASS_RELEASE(MemoryInfo);
2009 ORT_CLASS_RELEASE(Session); // Don't call ReleaseSession from Dllmain (because session owns a thread pool)
2013 ORT_CLASS_RELEASE(Value);
2017 ORT_CLASS_RELEASE(RunOptions);
2021 ORT_CLASS_RELEASE(TypeInfo);
2025 ORT_CLASS_RELEASE(TensorTypeAndShapeInfo);
2029 ORT_CLASS_RELEASE(SessionOptions);
2033 ORT_CLASS_RELEASE(CustomOpDomain);
2034
2038
2051 ORT_API2_STATUS(GetDenotationFromTypeInfo, _In_ const OrtTypeInfo* type_info, _Out_ const char** const denotation,
2052 _Out_ size_t* len);
2053
2067 ORT_API2_STATUS(CastTypeInfoToMapTypeInfo, _In_ const OrtTypeInfo* type_info,
2068 _Outptr_result_maybenull_ const OrtMapTypeInfo** out);
2069
2083 ORT_API2_STATUS(CastTypeInfoToSequenceTypeInfo, _In_ const OrtTypeInfo* type_info,
2084 _Outptr_result_maybenull_ const OrtSequenceTypeInfo** out);
2085
2089
2101 ORT_API2_STATUS(GetMapKeyType, _In_ const OrtMapTypeInfo* map_type_info, _Out_ enum ONNXTensorElementDataType* out);
2102
2111 ORT_API2_STATUS(GetMapValueType, _In_ const OrtMapTypeInfo* map_type_info, _Outptr_ OrtTypeInfo** type_info);
2112
2116
2127 ORT_API2_STATUS(GetSequenceElementType, _In_ const OrtSequenceTypeInfo* sequence_type_info,
2128 _Outptr_ OrtTypeInfo** type_info);
2129
2133 ORT_CLASS_RELEASE(MapTypeInfo);
2137 ORT_CLASS_RELEASE(SequenceTypeInfo);
2138
2142
2153 ORT_API2_STATUS(SessionEndProfiling, _In_ OrtSession* session, _Inout_ OrtAllocator* allocator, _Outptr_ char** out);
2154
2162 ORT_API2_STATUS(SessionGetModelMetadata, _In_ const OrtSession* session, _Outptr_ OrtModelMetadata** out);
2163
2167
2176 ORT_API2_STATUS(ModelMetadataGetProducerName, _In_ const OrtModelMetadata* model_metadata,
2177 _Inout_ OrtAllocator* allocator, _Outptr_ char** value);
2178
2187 ORT_API2_STATUS(ModelMetadataGetGraphName, _In_ const OrtModelMetadata* model_metadata,
2188 _Inout_ OrtAllocator* allocator, _Outptr_ char** value);
2189
2198 ORT_API2_STATUS(ModelMetadataGetDomain, _In_ const OrtModelMetadata* model_metadata, _Inout_ OrtAllocator* allocator,
2199 _Outptr_ char** value);
2200
2209 ORT_API2_STATUS(ModelMetadataGetDescription, _In_ const OrtModelMetadata* model_metadata,
2210 _Inout_ OrtAllocator* allocator, _Outptr_ char** value);
2211
2222 ORT_API2_STATUS(ModelMetadataLookupCustomMetadataMap, _In_ const OrtModelMetadata* model_metadata,
2223 _Inout_ OrtAllocator* allocator, _In_ const char* key, _Outptr_result_maybenull_ char** value);
2224
2232 ORT_API2_STATUS(ModelMetadataGetVersion, _In_ const OrtModelMetadata* model_metadata, _Out_ int64_t* value);
2233
2234 ORT_CLASS_RELEASE(ModelMetadata);
2235
2239
2253 ORT_API2_STATUS(CreateEnvWithGlobalThreadPools, OrtLoggingLevel log_severity_level, _In_ const char* logid,
2254 _In_ const OrtThreadingOptions* tp_options, _Outptr_ OrtEnv** out);
2255
2259
2269 ORT_API2_STATUS(DisablePerSessionThreads, _Inout_ OrtSessionOptions* options);
2270
2274
2280 ORT_API2_STATUS(CreateThreadingOptions, _Outptr_ OrtThreadingOptions** out);
2281
2282 ORT_CLASS_RELEASE(ThreadingOptions);
2283
2287
2299 ORT_API2_STATUS(ModelMetadataGetCustomMetadataMapKeys, _In_ const OrtModelMetadata* model_metadata,
2300 _Inout_ OrtAllocator* allocator, _Outptr_result_buffer_maybenull_(*num_keys) char*** keys, _Out_ int64_t* num_keys);
2301
2305
2313 ORT_API2_STATUS(AddFreeDimensionOverrideByName,
2314 _Inout_ OrtSessionOptions* options, _In_ const char* dim_name,
2315 _In_ int64_t dim_value);
2316
2320
2332 ORT_API2_STATUS(GetAvailableProviders, _Outptr_ char*** out_ptr, _Out_ int* provider_length);
2333
2342 ORT_API2_STATUS(ReleaseAvailableProviders, _In_ char** ptr,
2343 _In_ int providers_length);
2344
2348
2357 ORT_API2_STATUS(GetStringTensorElementLength, _In_ const OrtValue* value, size_t index, _Out_ size_t* out);
2358
2368 ORT_API2_STATUS(GetStringTensorElement, _In_ const OrtValue* value, size_t s_len, size_t index, _Out_writes_bytes_all_(s_len) void* s);
2369
2378 ORT_API2_STATUS(FillStringTensorElement, _Inout_ OrtValue* value, _In_ const char* s, size_t index);
2379
2383
2396 ORT_API2_STATUS(AddSessionConfigEntry, _Inout_ OrtSessionOptions* options,
2397 _In_z_ const char* config_key, _In_z_ const char* config_value);
2398
2402
2411 ORT_API2_STATUS(CreateAllocator, _In_ const OrtSession* session, _In_ const OrtMemoryInfo* mem_info,
2412 _Outptr_ OrtAllocator** out);
2413
2416 ORT_CLASS_RELEASE(Allocator);
2417
2421
2432 ORT_API2_STATUS(RunWithBinding, _Inout_ OrtSession* session, _In_ const OrtRunOptions* run_options, _In_ const OrtIoBinding* binding_ptr);
2433
2445 ORT_API2_STATUS(CreateIoBinding, _Inout_ OrtSession* session, _Outptr_ OrtIoBinding** out);
2446
2450
2453 ORT_CLASS_RELEASE(IoBinding);
2454
2465 ORT_API2_STATUS(BindInput, _Inout_ OrtIoBinding* binding_ptr, _In_ const char* name, _In_ const OrtValue* val_ptr);
2466
2477 ORT_API2_STATUS(BindOutput, _Inout_ OrtIoBinding* binding_ptr, _In_ const char* name, _In_ const OrtValue* val_ptr);
2478
2494 ORT_API2_STATUS(BindOutputToDevice, _Inout_ OrtIoBinding* binding_ptr, _In_ const char* name, _In_ const OrtMemoryInfo* mem_info_ptr);
2495
2513 ORT_API2_STATUS(GetBoundOutputNames, _In_ const OrtIoBinding* binding_ptr, _In_ OrtAllocator* allocator,
2514 _Out_ char** buffer, _Out_writes_all_(count) size_t** lengths, _Out_ size_t* count);
2515
2533 ORT_API2_STATUS(GetBoundOutputValues, _In_ const OrtIoBinding* binding_ptr, _In_ OrtAllocator* allocator,
2534 _Out_writes_all_(output_count) OrtValue*** output, _Out_ size_t* output_count);
2535
2538 void(ORT_API_CALL* ClearBoundInputs)(_Inout_ OrtIoBinding* binding_ptr) NO_EXCEPTION ORT_ALL_ARGS_NONNULL;
2539
2542 void(ORT_API_CALL* ClearBoundOutputs)(_Inout_ OrtIoBinding* binding_ptr) NO_EXCEPTION ORT_ALL_ARGS_NONNULL;
2543
2547
2562 ORT_API2_STATUS(TensorAt, _Inout_ OrtValue* value, const int64_t* location_values, size_t location_values_count, _Outptr_ void** out);
2563
2567
2582 ORT_API2_STATUS(CreateAndRegisterAllocator, _Inout_ OrtEnv* env, _In_ const OrtMemoryInfo* mem_info,
2583 _In_ const OrtArenaCfg* arena_cfg);
2584
2596 ORT_API2_STATUS(SetLanguageProjection, _In_ const OrtEnv* ort_env, _In_ OrtLanguageProjection projection);
2597
2601
2611 ORT_API2_STATUS(SessionGetProfilingStartTimeNs, _In_ const OrtSession* session, _Outptr_ uint64_t* out);
2612
2616
2628 ORT_API2_STATUS(SetGlobalIntraOpNumThreads, _Inout_ OrtThreadingOptions* tp_options, int intra_op_num_threads);
2629
2641 ORT_API2_STATUS(SetGlobalInterOpNumThreads, _Inout_ OrtThreadingOptions* tp_options, int inter_op_num_threads);
2642
2656 ORT_API2_STATUS(SetGlobalSpinControl, _Inout_ OrtThreadingOptions* tp_options, int allow_spinning);
2657
2661
2676 ORT_API2_STATUS(AddInitializer, _Inout_ OrtSessionOptions* options, _In_z_ const char* name,
2677 _In_ const OrtValue* val);
2678
2682
2698 ORT_API2_STATUS(CreateEnvWithCustomLoggerAndGlobalThreadPools, OrtLoggingFunction logging_function, _In_opt_ void* logger_param, OrtLoggingLevel log_severity_level,
2699 _In_ const char* logid, _In_ const struct OrtThreadingOptions* tp_options, _Outptr_ OrtEnv** out);
2700
2704
2715 _In_ OrtSessionOptions* options, _In_ const OrtCUDAProviderOptions* cuda_options);
2716
2727 _In_ OrtSessionOptions* options, _In_ const OrtROCMProviderOptions* rocm_options);
2728
2739 _In_ OrtSessionOptions* options, _In_ const OrtOpenVINOProviderOptions* provider_options);
2740
2744
2755 ORT_API2_STATUS(SetGlobalDenormalAsZero, _Inout_ OrtThreadingOptions* tp_options);
2756
2760
2773 ORT_API2_STATUS(CreateArenaCfg, _In_ size_t max_mem, int arena_extend_strategy, int initial_chunk_size_bytes,
2774 int max_dead_bytes_per_chunk, _Outptr_ OrtArenaCfg** out);
2775
2776 ORT_CLASS_RELEASE(ArenaCfg);
2777
2781
2793 ORT_API2_STATUS(ModelMetadataGetGraphDescription, _In_ const OrtModelMetadata* model_metadata,
2794 _Inout_ OrtAllocator* allocator, _Outptr_ char** value);
2795
2799
2810 _In_ OrtSessionOptions* options, _In_ const OrtTensorRTProviderOptions* tensorrt_options);
2811
2815
2826 ORT_API2_STATUS(SetCurrentGpuDeviceId, _In_ int device_id);
2827
2838 ORT_API2_STATUS(GetCurrentGpuDeviceId, _In_ int* device_id);
2839
2844
2867 ORT_API2_STATUS(KernelInfoGetAttributeArray_float, _In_ const OrtKernelInfo* info, _In_ const char* name,
2868 _Out_ float* out, _Inout_ size_t* size);
2869
2891 ORT_API2_STATUS(KernelInfoGetAttributeArray_int64, _In_ const OrtKernelInfo* info, _In_ const char* name,
2892 _Out_ int64_t* out, _Inout_ size_t* size);
2893
2897
2929 ORT_API2_STATUS(CreateArenaCfgV2, _In_reads_(num_keys) const char* const* arena_config_keys,
2930 _In_reads_(num_keys) const size_t* arena_config_values, _In_ size_t num_keys,
2931 _Outptr_ OrtArenaCfg** out);
2932
2936
2949 ORT_API2_STATUS(AddRunConfigEntry, _Inout_ OrtRunOptions* options,
2950 _In_z_ const char* config_key, _In_z_ const char* config_value);
2951
2955
2969
2974 ORT_CLASS_RELEASE(PrepackedWeightsContainer);
2975
2979
2997 ORT_API2_STATUS(CreateSessionWithPrepackedWeightsContainer, _In_ const OrtEnv* env, _In_ const ORTCHAR_T* model_path,
2998 _In_ const OrtSessionOptions* options,
2999 _Inout_ OrtPrepackedWeightsContainer* prepacked_weights_container,
3000 _Outptr_ OrtSession** out);
3001
3020 ORT_API2_STATUS(CreateSessionFromArrayWithPrepackedWeightsContainer, _In_ const OrtEnv* env,
3021 _In_ const void* model_data, size_t model_data_length,
3022 _In_ const OrtSessionOptions* options,
3023 _Inout_ OrtPrepackedWeightsContainer* prepacked_weights_container,
3024 _Outptr_ OrtSession** out);
3025
3029
3048 _In_ OrtSessionOptions* options, _In_ const OrtTensorRTProviderOptionsV2* tensorrt_options);
3049
3053
3061
3077 ORT_API2_STATUS(UpdateTensorRTProviderOptions, _Inout_ OrtTensorRTProviderOptionsV2* tensorrt_options,
3078 _In_reads_(num_keys) const char* const* provider_options_keys,
3079 _In_reads_(num_keys) const char* const* provider_options_values,
3080 _In_ size_t num_keys);
3081
3093 ORT_API2_STATUS(GetTensorRTProviderOptionsAsString, _In_ const OrtTensorRTProviderOptionsV2* tensorrt_options, _Inout_ OrtAllocator* allocator, _Outptr_ char** ptr);
3094
3099 void(ORT_API_CALL* ReleaseTensorRTProviderOptions)(_Frees_ptr_opt_ OrtTensorRTProviderOptionsV2* input);
3100
3104
3111 ORT_API2_STATUS(EnableOrtCustomOps, _Inout_ OrtSessionOptions* options);
3112
3116
3132 ORT_API2_STATUS(RegisterAllocator, _Inout_ OrtEnv* env, _In_ OrtAllocator* allocator);
3133
3144 ORT_API2_STATUS(UnregisterAllocator, _Inout_ OrtEnv* env,
3145 _In_ const OrtMemoryInfo* mem_info);
3146
3150
3159 ORT_API2_STATUS(IsSparseTensor, _In_ const OrtValue* value, _Out_ int* out);
3160
3177 ORT_API2_STATUS(CreateSparseTensorAsOrtValue, _Inout_ OrtAllocator* allocator, _In_ const int64_t* dense_shape,
3178 size_t dense_shape_len, ONNXTensorElementDataType type, _Outptr_ OrtValue** out);
3179
3197 ORT_API2_STATUS(FillSparseTensorCoo, _Inout_ OrtValue* ort_value, _In_ const OrtMemoryInfo* data_mem_info,
3198 _In_ const int64_t* values_shape, size_t values_shape_len, _In_ const void* values,
3199 _In_ const int64_t* indices_data, size_t indices_num);
3200
3220 ORT_API2_STATUS(FillSparseTensorCsr, _Inout_ OrtValue* ort_value, _In_ const OrtMemoryInfo* data_mem_info,
3221 _In_ const int64_t* values_shape, size_t values_shape_len, _In_ const void* values,
3222 _In_ const int64_t* inner_indices_data, size_t inner_indices_num,
3223 _In_ const int64_t* outer_indices_data, size_t outer_indices_num);
3224
3243 ORT_API2_STATUS(FillSparseTensorBlockSparse, _Inout_ OrtValue* ort_value, _In_ const OrtMemoryInfo* data_mem_info,
3244 _In_ const int64_t* values_shape, size_t values_shape_len, _In_ const void* values,
3245 _In_ const int64_t* indices_shape_data, size_t indices_shape_len,
3246 _In_ const int32_t* indices_data);
3247
3272 ORT_API2_STATUS(CreateSparseTensorWithValuesAsOrtValue, _In_ const OrtMemoryInfo* info, _Inout_ void* p_data,
3273 _In_ const int64_t* dense_shape, size_t dense_shape_len,
3274 _In_ const int64_t* values_shape, size_t values_shape_len,
3276
3291 ORT_API2_STATUS(UseCooIndices, _Inout_ OrtValue* ort_value, _Inout_ int64_t* indices_data, size_t indices_num);
3292
3309 ORT_API2_STATUS(UseCsrIndices, _Inout_ OrtValue* ort_value, _Inout_ int64_t* inner_data, size_t inner_num,
3310 _Inout_ int64_t* outer_data, size_t outer_num);
3311
3325 ORT_API2_STATUS(UseBlockSparseIndices, _Inout_ OrtValue* ort_value, const int64_t* indices_shape, size_t indices_shape_len, _Inout_ int32_t* indices_data);
3326
3334 ORT_API2_STATUS(GetSparseTensorFormat, _In_ const OrtValue* ort_value, _Out_ enum OrtSparseFormat* out);
3335
3343 ORT_API2_STATUS(GetSparseTensorValuesTypeAndShape, _In_ const OrtValue* ort_value, _Outptr_ OrtTensorTypeAndShapeInfo** out);
3344
3352 ORT_API2_STATUS(GetSparseTensorValues, _In_ const OrtValue* ort_value, _Outptr_ const void** out);
3353
3363 ORT_API2_STATUS(GetSparseTensorIndicesTypeShape, _In_ const OrtValue* ort_value, enum OrtSparseIndicesFormat indices_format, _Outptr_ OrtTensorTypeAndShapeInfo** out);
3364
3374 ORT_API2_STATUS(GetSparseTensorIndices, _In_ const OrtValue* ort_value, enum OrtSparseIndicesFormat indices_format, _Out_ size_t* num_indices, _Outptr_ const void** indices);
3378
3391 ORT_API2_STATUS(HasValue, _In_ const OrtValue* value, _Out_ int* out);
3392
3397
3409 ORT_API2_STATUS(KernelContext_GetGPUComputeStream, _In_ const OrtKernelContext* context, _Outptr_ void** out);
3410
3414
3420 ORT_API2_STATUS(GetTensorMemoryInfo, _In_ const OrtValue* value, _Out_ const OrtMemoryInfo** mem_info);
3421
3425
3435 ORT_API2_STATUS(GetExecutionProviderApi, _In_ const char* provider_name, _In_ uint32_t version, _Outptr_ const void** provider_api);
3436
3438
3441
3448 ORT_API2_STATUS(SessionOptionsSetCustomCreateThreadFn, _Inout_ OrtSessionOptions* options, _In_ OrtCustomCreateThreadFn ort_custom_create_thread_fn);
3449
3457 ORT_API2_STATUS(SessionOptionsSetCustomThreadCreationOptions, _Inout_ OrtSessionOptions* options, _In_ void* ort_custom_thread_creation_options);
3458
3466 ORT_API2_STATUS(SessionOptionsSetCustomJoinThreadFn, _Inout_ OrtSessionOptions* options, _In_ OrtCustomJoinThreadFn ort_custom_join_thread_fn);
3468
3471
3478 ORT_API2_STATUS(SetGlobalCustomCreateThreadFn, _Inout_ OrtThreadingOptions* tp_options, _In_ OrtCustomCreateThreadFn ort_custom_create_thread_fn);
3479
3487 ORT_API2_STATUS(SetGlobalCustomThreadCreationOptions, _Inout_ OrtThreadingOptions* tp_options, _In_ void* ort_custom_thread_creation_options);
3488
3496 ORT_API2_STATUS(SetGlobalCustomJoinThreadFn, _Inout_ OrtThreadingOptions* tp_options, _In_ OrtCustomJoinThreadFn ort_custom_join_thread_fn);
3498
3507 ORT_API2_STATUS(SynchronizeBoundInputs, _Inout_ OrtIoBinding* binding_ptr);
3508
3517 ORT_API2_STATUS(SynchronizeBoundOutputs, _Inout_ OrtIoBinding* binding_ptr);
3518
3521
3542 _In_ OrtSessionOptions* options, _In_ const OrtCUDAProviderOptionsV2* cuda_options);
3543
3547
3556 ORT_API2_STATUS(CreateCUDAProviderOptions, _Outptr_ OrtCUDAProviderOptionsV2** out);
3557
3575 ORT_API2_STATUS(UpdateCUDAProviderOptions, _Inout_ OrtCUDAProviderOptionsV2* cuda_options,
3576 _In_reads_(num_keys) const char* const* provider_options_keys,
3577 _In_reads_(num_keys) const char* const* provider_options_values,
3578 _In_ size_t num_keys);
3579
3594 ORT_API2_STATUS(GetCUDAProviderOptionsAsString, _In_ const OrtCUDAProviderOptionsV2* cuda_options, _Inout_ OrtAllocator* allocator, _Outptr_ char** ptr);
3595
3602 void(ORT_API_CALL* ReleaseCUDAProviderOptions)(_Frees_ptr_opt_ OrtCUDAProviderOptionsV2* input);
3603
3605
3618 _In_ OrtSessionOptions* options, _In_ const OrtMIGraphXProviderOptions* migraphx_options);
3619
3641 ORT_API2_STATUS(AddExternalInitializers, _In_ OrtSessionOptions* options,
3642 _In_reads_(num_initializers) const char* const* initializer_names,
3643 _In_reads_(num_initializers) const OrtValue* const* initializers, size_t num_initializers);
3644
3655 ORT_API2_STATUS(CreateOpAttr,
3656 _In_ const char* name,
3657 _In_ const void* data,
3658 _In_ int len,
3659 _In_ OrtOpAttrType type,
3660 _Outptr_ OrtOpAttr** op_attr);
3661
3662 /* \brief: Release op attribute
3663 *
3664 * \param[in] opAttr Attribute created by OrtApi::CreateOpAttr
3665 *
3666 * \since Version 1.12.
3667 */
3668 ORT_CLASS_RELEASE(OpAttr);
3669
3687 ORT_API2_STATUS(CreateOp,
3688 _In_ const OrtKernelInfo* info,
3689 _In_z_ const char* op_name,
3690 _In_z_ const char* domain,
3691 int version,
3692 _In_reads_(type_constraint_count) const char** type_constraint_names,
3693 _In_reads_(type_constraint_count) const ONNXTensorElementDataType* type_constraint_values,
3694 int type_constraint_count,
3695 _In_reads_(attr_count) const OrtOpAttr* const* attr_values,
3696 int attr_count,
3697 int input_count,
3698 int output_count,
3699 _Outptr_ OrtOp** ort_op);
3700
3713 ORT_API2_STATUS(InvokeOp,
3714 _In_ const OrtKernelContext* context,
3715 _In_ const OrtOp* ort_op,
3716 _In_ const OrtValue* const* input_values,
3717 _In_ int input_count,
3718 _Inout_ OrtValue* const* output_values,
3719 _In_ int output_count);
3720
3721 /* \brief: Release an onnxruntime operator
3722 *
3723 * \param[in] Op Operator created by OrtApi::CreateOp
3724 *
3725 * \since Version 1.12.
3726 */
3727 ORT_CLASS_RELEASE(Op);
3728
3842 ORT_API2_STATUS(SessionOptionsAppendExecutionProvider, _In_ OrtSessionOptions* options,
3843 _In_ const char* provider_name,
3844 _In_reads_(num_keys) const char* const* provider_options_keys,
3845 _In_reads_(num_keys) const char* const* provider_options_values,
3846 _In_ size_t num_keys);
3847
3848 /* \brief: Get a copy of kernel info
3849 *
3850 * \param[in] info Kernel info
3851 * \param[out] info_copy Copy of kernel info
3852 *
3853 * \since Version 1.12.
3854 */
3855 ORT_API2_STATUS(CopyKernelInfo,
3856 _In_ const OrtKernelInfo* info,
3857 _Outptr_ OrtKernelInfo** info_copy);
3858
3859 /* \brief: Release kernel info
3860 *
3861 * \param[in] KernelInfo A copy of kernel info returned by CopyKernelInfo
3862 *
3863 * \since Version 1.12.
3864 */
3865 ORT_CLASS_RELEASE(KernelInfo);
3866
3869
3883 const OrtTrainingApi*(ORT_API_CALL* GetTrainingApi)(uint32_t version)NO_EXCEPTION;
3884
3886
3899 _In_ OrtSessionOptions* options, _In_ const OrtCANNProviderOptions* cann_options);
3900
3909 ORT_API2_STATUS(CreateCANNProviderOptions, _Outptr_ OrtCANNProviderOptions** out);
3910
3922 ORT_API2_STATUS(UpdateCANNProviderOptions, _Inout_ OrtCANNProviderOptions* cann_options,
3923 _In_reads_(num_keys) const char* const* provider_options_keys,
3924 _In_reads_(num_keys) const char* const* provider_options_values,
3925 _In_ size_t num_keys);
3926
3940 ORT_API2_STATUS(GetCANNProviderOptionsAsString, _In_ const OrtCANNProviderOptions* cann_options,
3941 _Inout_ OrtAllocator* allocator, _Outptr_ char** ptr);
3942
3949 void(ORT_API_CALL* ReleaseCANNProviderOptions)(_Frees_ptr_opt_ OrtCANNProviderOptions* input);
3950
3951 /* \brief Get OrtDevice type from MemoryInfo
3952 *
3953 * \since Version 1.14
3954 */
3955 void(ORT_API_CALL* MemoryInfoGetDeviceType)(_In_ const OrtMemoryInfo* ptr, _Out_ OrtMemoryInfoDeviceType* out);
3956
3957 /* \brief Update the OrtEnv instance with custom log severity level
3958 *
3959 * \param[in] ort_env The OrtEnv instance being used
3960 * \param[in] log_severity_level The log severity level.
3961 *
3962 * \since Version 1.14.
3963 */
3964 ORT_API2_STATUS(UpdateEnvWithCustomLogLevel, _In_ OrtEnv* ort_env, OrtLoggingLevel log_severity_level);
3965
3966 /* \brief Set affinities for intra op threads
3967 *
3968 * Affinity string follows format:
3969 * logical_processor_id,logical_processor_id;logical_processor_id,logical_processor_id
3970 * Semicolon isolates configurations among threads, while comma split processors where ith thread expected to attach to.
3971 * e.g. 1,2,3;4,5
3972 * specifies affinities for two threads, with the 1st thread attach to the 1st, 2nd, and 3rd processor, and 2nd thread to the 4th and 5th.
3973 * To ease the configuration, an "interval" is also allowed:
3974 * e.g. 1-8;8-16;17-24
3975 * orders that the 1st thread runs on first eight processors, 2nd thread runs on next eight processors, and so forth.
3976 * Note:
3977 * 1. Once set, the number of thread affinities must equal to intra_op_num_threads - 1,
3978 * ort does not set affinity on the main thread which is started and managed by the calling app;
3979 * 2. For windows, ort will infer the group id from a logical processor id, for example, assuming there are two groups with each has 64 logical processors,
3980 * an id of 64 will be inferred as the last processor of the 1st group, while 65 will be interpreted as the 1st processor of the second group.
3981 * Hence 64-65 is an invalid configuration, because a windows thread cannot be attached to processors across group boundary.
3982 *
3983 * \since Version 1.14
3984 */
3985 ORT_API2_STATUS(SetGlobalIntraOpThreadAffinity, _Inout_ OrtThreadingOptions* tp_options, const char* affinity_string);
3986
4005 ORT_API2_STATUS(RegisterCustomOpsLibrary_V2, _Inout_ OrtSessionOptions* options, _In_ const ORTCHAR_T* library_name);
4006
4031 ORT_API2_STATUS(RegisterCustomOpsUsingFunction, _Inout_ OrtSessionOptions* options,
4032 _In_ const char* registration_func_name);
4033
4037
4049 ORT_API2_STATUS(KernelInfo_GetInputCount, _In_ const OrtKernelInfo* info, _Out_ size_t* out);
4050
4062 ORT_API2_STATUS(KernelInfo_GetOutputCount, _In_ const OrtKernelInfo* info, _Out_ size_t* out);
4063
4088 ORT_API2_STATUS(KernelInfo_GetInputName, _In_ const OrtKernelInfo* info, size_t index, _Out_ char* out,
4089 _Inout_ size_t* size);
4090
4116 ORT_API2_STATUS(KernelInfo_GetOutputName, _In_ const OrtKernelInfo* info, size_t index, _Out_ char* out,
4117 _Inout_ size_t* size);
4118
4131 ORT_API2_STATUS(KernelInfo_GetInputTypeInfo, _In_ const OrtKernelInfo* info, size_t index,
4132 _Outptr_ OrtTypeInfo** type_info);
4133
4146 ORT_API2_STATUS(KernelInfo_GetOutputTypeInfo, _In_ const OrtKernelInfo* info, size_t index,
4147 _Outptr_ OrtTypeInfo** type_info);
4148
4161 ORT_API2_STATUS(KernelInfoGetAttribute_tensor, _In_ const OrtKernelInfo* info, _In_z_ const char* name,
4162 _Inout_ OrtAllocator* allocator, _Outptr_ OrtValue** out);
4163
4168
4184 ORT_API2_STATUS(HasSessionConfigEntry, _In_ const OrtSessionOptions* options,
4185 _In_z_ const char* config_key, _Out_ int* out);
4186
4215 ORT_API2_STATUS(GetSessionConfigEntry, _In_ const OrtSessionOptions* options,
4216 _In_z_ const char* config_key, _Out_ char* config_value, _Inout_ size_t* size);
4217
4219
4232 _In_ OrtSessionOptions* options, _In_ const OrtDnnlProviderOptions* dnnl_options);
4233
4242 ORT_API2_STATUS(CreateDnnlProviderOptions, _Outptr_ OrtDnnlProviderOptions** out);
4243
4260 ORT_API2_STATUS(UpdateDnnlProviderOptions, _Inout_ OrtDnnlProviderOptions* dnnl_options,
4261 _In_reads_(num_keys) const char* const* provider_options_keys,
4262 _In_reads_(num_keys) const char* const* provider_options_values,
4263 _In_ size_t num_keys);
4264
4279 ORT_API2_STATUS(GetDnnlProviderOptionsAsString, _In_ const OrtDnnlProviderOptions* dnnl_options, _Inout_ OrtAllocator* allocator, _Outptr_ char** ptr);
4280
4285 void(ORT_API_CALL* ReleaseDnnlProviderOptions)(_Frees_ptr_opt_ OrtDnnlProviderOptions* input);
4286
4290
4313 ORT_API2_STATUS(KernelInfo_GetNodeName, _In_ const OrtKernelInfo* info, _Out_ char* out, _Inout_ size_t* size);
4314
4326 ORT_API2_STATUS(KernelInfo_GetLogger, _In_ const OrtKernelInfo* info, _Outptr_ const OrtLogger** logger);
4327
4332
4344 ORT_API2_STATUS(KernelContext_GetLogger, _In_ const OrtKernelContext* context, _Outptr_ const OrtLogger** logger);
4345
4350
4369 ORT_API2_STATUS(Logger_LogMessage, _In_ const OrtLogger* logger, OrtLoggingLevel log_severity_level,
4370 _In_z_ const char* message, _In_z_ const ORTCHAR_T* file_path, int line_number,
4371 _In_z_ const char* func_name);
4372
4384 ORT_API2_STATUS(Logger_GetLoggingSeverityLevel, _In_ const OrtLogger* logger, _Out_ OrtLoggingLevel* out);
4385
4387
4401 ORT_API2_STATUS(KernelInfoGetConstantInput_tensor, _In_ const OrtKernelInfo* info, size_t index, _Out_ int* is_constant, _Outptr_ const OrtValue** out);
4402
4423 ORT_API2_STATUS(CastTypeInfoToOptionalTypeInfo, _In_ const OrtTypeInfo* type_info,
4424 _Outptr_result_maybenull_ const OrtOptionalTypeInfo** out);
4425
4442 ORT_API2_STATUS(GetOptionalContainedTypeInfo, _In_ const OrtOptionalTypeInfo* optional_type_info,
4443 _Outptr_ OrtTypeInfo** out);
4444
4455 ORT_API2_STATUS(GetResizedStringTensorElementBuffer, _Inout_ OrtValue* value, _In_ size_t index, _In_ size_t length_in_bytes, _Inout_ char** buffer);
4456
4467 ORT_API2_STATUS(KernelContext_GetAllocator, _In_ const OrtKernelContext* context, _In_ const OrtMemoryInfo* mem_info, _Outptr_ OrtAllocator** out);
4468
4475 const char*(ORT_API_CALL* GetBuildInfoString)(void);
4476
4479
4488 ORT_API2_STATUS(CreateROCMProviderOptions, _Outptr_ OrtROCMProviderOptions** out);
4489
4507 ORT_API2_STATUS(UpdateROCMProviderOptions, _Inout_ OrtROCMProviderOptions* rocm_options,
4508 _In_reads_(num_keys) const char* const* provider_options_keys,
4509 _In_reads_(num_keys) const char* const* provider_options_values,
4510 _In_ size_t num_keys);
4511
4526 ORT_API2_STATUS(GetROCMProviderOptionsAsString, _In_ const OrtROCMProviderOptions* rocm_options, _Inout_ OrtAllocator* allocator, _Outptr_ char** ptr);
4527
4534 void(ORT_API_CALL* ReleaseROCMProviderOptions)(_Frees_ptr_opt_ OrtROCMProviderOptions* input);
4535
4549 ORT_API2_STATUS(CreateAndRegisterAllocatorV2, _Inout_ OrtEnv* env, _In_ const char* provider_type, _In_ const OrtMemoryInfo* mem_info, _In_ const OrtArenaCfg* arena_cfg,
4550 _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);
4551
4570 ORT_API2_STATUS(RunAsync, _Inout_ OrtSession* session, _In_opt_ const OrtRunOptions* run_options,
4571 _In_reads_(input_len) const char* const* input_names,
4572 _In_reads_(input_len) const OrtValue* const* input, size_t input_len,
4573 _In_reads_(output_names_len) const char* const* output_names, size_t output_names_len,
4574 _Inout_updates_all_(output_names_len) OrtValue** output,
4575 _In_ RunAsyncCallbackFn run_async_callback, _In_opt_ void* user_data);
4576
4589 ORT_API2_STATUS(UpdateTensorRTProviderOptionsWithValue, _Inout_ OrtTensorRTProviderOptionsV2* tensorrt_options, _In_ const char* key, _In_ void* value);
4590
4601 ORT_API2_STATUS(GetTensorRTProviderOptionsByName, _In_ const OrtTensorRTProviderOptionsV2* tensorrt_options, _In_ const char* key, _Outptr_ void** ptr);
4602
4615 ORT_API2_STATUS(UpdateCUDAProviderOptionsWithValue, _Inout_ OrtCUDAProviderOptionsV2* cuda_options, _In_ const char* key, _In_ void* value);
4616
4627 ORT_API2_STATUS(GetCUDAProviderOptionsByName, _In_ const OrtCUDAProviderOptionsV2* cuda_options, _In_ const char* key, _Outptr_ void** ptr);
4628
4640 ORT_API2_STATUS(KernelContext_GetResource, _In_ const OrtKernelContext* context, _In_ int resource_version,
4641 _In_ int resource_id, _Outptr_ void** resource);
4642
4660 ORT_API2_STATUS(SetUserLoggingFunction, _Inout_ OrtSessionOptions* options,
4661 _In_ OrtLoggingFunction user_logging_function, _In_opt_ void* user_logging_param);
4662
4671 ORT_API2_STATUS(ShapeInferContext_GetInputCount, _In_ const OrtShapeInferContext* context, _Out_ size_t* out);
4672
4682 ORT_API2_STATUS(ShapeInferContext_GetInputTypeShape, _In_ const OrtShapeInferContext* context, _In_ size_t index, _Outptr_ OrtTensorTypeAndShapeInfo** info);
4683
4693 ORT_API2_STATUS(ShapeInferContext_GetAttribute, _In_ const OrtShapeInferContext* context, _In_ const char* attr_name, _Outptr_ const OrtOpAttr** attr);
4694
4704 ORT_API2_STATUS(ShapeInferContext_SetOutputTypeShape, _In_ const OrtShapeInferContext* context, _In_ size_t index, _In_ const OrtTensorTypeAndShapeInfo* info);
4705
4715 ORT_API2_STATUS(SetSymbolicDimensions, _In_ OrtTensorTypeAndShapeInfo* info, _In_ const char* dim_params[], _In_ size_t dim_params_length);
4716
4728 ORT_API2_STATUS(ReadOpAttr, _In_ const OrtOpAttr* op_attr, _In_ OrtOpAttrType type, _Inout_ void* data, _In_ size_t len, _Out_ size_t* out);
4729
4740 ORT_API2_STATUS(SetDeterministicCompute, _Inout_ OrtSessionOptions* options, bool value);
4741
4753 ORT_API2_STATUS(KernelContext_ParallelFor, _In_ const OrtKernelContext* context, _In_ void (*fn)(void*, size_t), _In_ size_t total, _In_ size_t num_batch, _In_ void* usr_data);
4754
4769 _In_ OrtSessionOptions* options,
4770 _In_reads_(num_keys) const char* const* provider_options_keys,
4771 _In_reads_(num_keys) const char* const* provider_options_values,
4772 _In_ size_t num_keys);
4773
4788 _In_ OrtSessionOptions* options,
4789 _In_reads_(num_keys) const char* const* provider_options_keys,
4790 _In_reads_(num_keys) const char* const* provider_options_values,
4791 _In_ size_t num_keys);
4792
4804 ORT_API2_STATUS(KernelContext_GetScratchBuffer, _In_ const OrtKernelContext* context, _In_ const OrtMemoryInfo* mem_info, _In_ size_t count_or_bytes, _Outptr_ void** out);
4805
4816 ORT_API2_STATUS(KernelInfoGetAllocator, _In_ const OrtKernelInfo* info, _In_ OrtMemType mem_type, _Outptr_ OrtAllocator** out);
4817
4839 ORT_API2_STATUS(AddExternalInitializersFromFilesInMemory, _In_ OrtSessionOptions* options,
4840 _In_reads_(num_external_initializer_files) const ORTCHAR_T* const* external_initializer_file_names,
4841 _In_reads_(num_external_initializer_files) char* const* external_initializer_file_buffer_array,
4842 _In_reads_(num_external_initializer_files) const size_t* external_initializer_file_lengths,
4843 size_t num_external_initializer_files);
4844
4863 ORT_API2_STATUS(CreateLoraAdapter, const ORTCHAR_T* adapter_file_path, _In_ OrtAllocator* allocator,
4864 _Outptr_ OrtLoraAdapter** out);
4865
4883 ORT_API2_STATUS(CreateLoraAdapterFromArray, _In_ const void* bytes, size_t num_bytes, _In_ OrtAllocator* allocator,
4884 _Outptr_ OrtLoraAdapter** out);
4885
4888 ORT_CLASS_RELEASE(LoraAdapter);
4889
4906 ORT_API2_STATUS(RunOptionsAddActiveLoraAdapter, _Inout_ OrtRunOptions* options, _In_ const OrtLoraAdapter* adapter);
4907
4911
4926 ORT_API2_STATUS(SetEpDynamicOptions, _Inout_ OrtSession* sess, _In_reads_(kv_len) const char* const* keys,
4927 _In_reads_(kv_len) const char* const* values, _In_ size_t kv_len);
4928
4932 ORT_CLASS_RELEASE(ValueInfo);
4933
4937 ORT_CLASS_RELEASE(Node);
4938
4943 ORT_CLASS_RELEASE(Graph);
4944
4949 ORT_CLASS_RELEASE(Model);
4950
4957 ORT_API2_STATUS(GetValueInfoName, _In_ const OrtValueInfo* value_info, _Out_ const char** name);
4958
4965 ORT_API2_STATUS(GetValueInfoTypeInfo, _In_ const OrtValueInfo* value_info, _Outptr_ const OrtTypeInfo** type_info);
4966
4975 const OrtModelEditorApi*(ORT_API_CALL* GetModelEditorApi)();
4976
4995 ORT_API2_STATUS(CreateTensorWithDataAndDeleterAsOrtValue, _In_ OrtAllocator* deleter,
4996 _In_ void* p_data, size_t p_data_len,
4997 _In_ const int64_t* shape, size_t shape_len,
4999 _Outptr_ OrtValue** out);
5000
5017 ORT_API2_STATUS(SessionOptionsSetLoadCancellationFlag, _Inout_ OrtSessionOptions* options,
5018 _In_ bool cancel);
5019
5033 const OrtCompileApi*(ORT_API_CALL* GetCompileApi)();
5034
5035 //
5036 // OrtKeyValuePairs
5037 //
5038
5047 void(ORT_API_CALL* CreateKeyValuePairs)(_Outptr_ OrtKeyValuePairs** out);
5048
5060 void(ORT_API_CALL* AddKeyValuePair)(_In_ OrtKeyValuePairs* kvps, _In_ const char* key, _In_ const char* value);
5061
5071 const char*(ORT_API_CALL* GetKeyValue)(_In_ const OrtKeyValuePairs* kvps, _In_ const char* key);
5072
5082 void(ORT_API_CALL* GetKeyValuePairs)(_In_ const OrtKeyValuePairs* kvps,
5083 _Outptr_ const char* const** keys, _Outptr_ const char* const** values,
5084 _Out_ size_t* num_entries);
5085
5093 void(ORT_API_CALL* RemoveKeyValuePair)(_In_ OrtKeyValuePairs* kvps, _In_ const char* key);
5094
5101 ORT_CLASS_RELEASE(KeyValuePairs);
5102
5116 ORT_API2_STATUS(RegisterExecutionProviderLibrary, _In_ OrtEnv* env, _In_ const char* registration_name,
5117 _In_ const ORTCHAR_T* path);
5118
5133 ORT_API2_STATUS(UnregisterExecutionProviderLibrary, _In_ OrtEnv* env, _In_ const char* registration_name);
5134
5147 ORT_API2_STATUS(GetEpDevices, _In_ const OrtEnv* env,
5148 _Outptr_ const OrtEpDevice* const** ep_devices, _Out_ size_t* num_ep_devices);
5149
5169 ORT_API2_STATUS(SessionOptionsAppendExecutionProvider_V2, _In_ OrtSessionOptions* session_options,
5170 _In_ OrtEnv* env,
5171 _In_reads_(num_ep_devices) const OrtEpDevice* const* ep_devices, _In_ size_t num_ep_devices,
5172 _In_reads_(num_op_options) const char* const* ep_option_keys,
5173 _In_reads_(num_op_options) const char* const* ep_option_vals,
5174 size_t num_ep_options);
5175
5186 ORT_API2_STATUS(SessionOptionsSetEpSelectionPolicy, _In_ OrtSessionOptions* session_options,
5188
5199 ORT_API2_STATUS(SessionOptionsSetEpSelectionPolicyDelegate, _In_ OrtSessionOptions* session_options,
5200 _In_ EpSelectionDelegate delegate,
5201 _In_opt_ void* delegate_state);
5202
5211
5219 uint32_t(ORT_API_CALL* HardwareDevice_VendorId)(_In_ const OrtHardwareDevice* device);
5220
5228 const char*(ORT_API_CALL* HardwareDevice_Vendor)(_In_ const OrtHardwareDevice* device);
5229
5238 uint32_t(ORT_API_CALL* HardwareDevice_DeviceId)(_In_ const OrtHardwareDevice* device);
5239
5248 const OrtKeyValuePairs*(ORT_API_CALL* HardwareDevice_Metadata)(_In_ const OrtHardwareDevice* device);
5249
5257 const char*(ORT_API_CALL* EpDevice_EpName)(_In_ const OrtEpDevice* ep_device);
5258
5266 const char*(ORT_API_CALL* EpDevice_EpVendor)(_In_ const OrtEpDevice* ep_device);
5267
5275 const OrtKeyValuePairs*(ORT_API_CALL* EpDevice_EpMetadata)(_In_ const OrtEpDevice* ep_device);
5276
5284 const OrtKeyValuePairs*(ORT_API_CALL* EpDevice_EpOptions)(_In_ const OrtEpDevice* ep_device);
5285
5293 const OrtHardwareDevice*(ORT_API_CALL* EpDevice_Device)(_In_ const OrtEpDevice* ep_device);
5294
5299 const OrtEpApi*(ORT_API_CALL* GetEpApi)();
5300
5314 ORT_API2_STATUS(GetTensorSizeInBytes, _In_ const OrtValue* ort_value, _Out_ size_t* size);
5315
5330 ORT_API2_STATUS(AllocatorGetStats, _In_ const OrtAllocator* ort_allocator, _Outptr_ OrtKeyValuePairs** out);
5331};
5332
5333/*
5334 * Steps to use a custom op:
5335 * 1 Create an OrtCustomOpDomain with the domain name used by the custom ops
5336 * 2 Create an OrtCustomOp structure for each op and add them to the domain
5337 * 3 Call OrtAddCustomOpDomain to add the custom domain of ops to the session options
5338 */
5339
5340// Specifies some characteristics of inputs/outputs of custom ops:
5341// Specify if the inputs/outputs are one of:
5342// 1) Non-optional (input/output must be present in the node)
5343// 2) Optional (input/output may be absent in the node)
5344// 3) Variadic: A variadic input or output specifies N (i.e., the minimum arity) or more operands.
5345// Only the last input or output of a custom op may be marked as variadic.
5346// The homogeneity of the variadic input or output determines whether all operands must be of the same
5347// tensor element type.
5353
5354/*
5355 * The OrtCustomOp structure defines a custom op's schema and its kernel callbacks. The callbacks are filled in by
5356 * the implementor of the custom op.
5357 */
5359 uint32_t version; // Must be initialized to ORT_API_VERSION
5360
5361 // This callback creates the kernel, which is a user defined
5362 // parameter that is passed to the Kernel* callbacks below. It is
5363 // recommended to use CreateKernelV2 which allows for a safe error
5364 // propagation by returning an OrtStatusPtr.
5365 void*(ORT_API_CALL* CreateKernel)(_In_ const struct OrtCustomOp* op, _In_ const OrtApi* api,
5366 _In_ const OrtKernelInfo* info);
5367
5368 // Returns the name of the op
5369 const char*(ORT_API_CALL* GetName)(_In_ const struct OrtCustomOp* op);
5370
5371 // Returns the type of the execution provider, return nullptr to use CPU execution provider
5372 const char*(ORT_API_CALL* GetExecutionProviderType)(_In_ const struct OrtCustomOp* op);
5373
5374 // Returns the count and types of the input & output tensors
5375 ONNXTensorElementDataType(ORT_API_CALL* GetInputType)(_In_ const struct OrtCustomOp* op, _In_ size_t index);
5376 size_t(ORT_API_CALL* GetInputTypeCount)(_In_ const struct OrtCustomOp* op);
5377 ONNXTensorElementDataType(ORT_API_CALL* GetOutputType)(_In_ const struct OrtCustomOp* op, _In_ size_t index);
5378 size_t(ORT_API_CALL* GetOutputTypeCount)(_In_ const struct OrtCustomOp* op);
5379
5380 // Perform a computation step. It is recommended to use
5381 // KernelComputeV2 which allows for a safe error propagation by
5382 // returning an OrtStatusPtr.
5383 void(ORT_API_CALL* KernelCompute)(_In_ void* op_kernel, _In_ OrtKernelContext* context);
5384 void(ORT_API_CALL* KernelDestroy)(_In_ void* op_kernel);
5385
5386 // Returns the characteristics of the input & output tensors
5387 OrtCustomOpInputOutputCharacteristic(ORT_API_CALL* GetInputCharacteristic)(_In_ const struct OrtCustomOp* op, _In_ size_t index);
5388 OrtCustomOpInputOutputCharacteristic(ORT_API_CALL* GetOutputCharacteristic)(_In_ const struct OrtCustomOp* op, _In_ size_t index);
5389
5390 // Returns the memory type of the input tensors. This API allows the custom op
5391 // to place the inputs on specific devices. By default, it returns
5392 // OrtMemTypeDefault, which means the input is placed on the default device for
5393 // the execution provider. If the inputs need to be with different memory types,
5394 // this function can be overridden to return the specific memory types.
5395 OrtMemType(ORT_API_CALL* GetInputMemoryType)(_In_ const struct OrtCustomOp* op, _In_ size_t index);
5396
5397 // Returns the minimum number of input arguments expected for the variadic input.
5398 // Applicable only for custom ops that have a variadic input.
5399 int(ORT_API_CALL* GetVariadicInputMinArity)(_In_ const struct OrtCustomOp* op);
5400
5401 // Returns true (non-zero) if all arguments of a variadic input have to be of the same type (homogeneous),
5402 // and false (zero) otherwise.
5403 // Applicable only for custom ops that have a variadic input.
5404 int(ORT_API_CALL* GetVariadicInputHomogeneity)(_In_ const struct OrtCustomOp* op);
5405
5406 // Returns the minimum number of output values expected for the variadic output.
5407 // Applicable only for custom ops that have a variadic output.
5408 int(ORT_API_CALL* GetVariadicOutputMinArity)(_In_ const struct OrtCustomOp* op);
5409
5410 // Returns true (non-zero) if all outputs values of a variadic output have to be of the same type (homogeneous),
5411 // and false (zero) otherwise.
5412 // Applicable only for custom ops that have a variadic output.
5413 int(ORT_API_CALL* GetVariadicOutputHomogeneity)(_In_ const struct OrtCustomOp* op);
5414
5415 // Create the kernel state which is passed to each compute call.
5416 OrtStatusPtr(ORT_API_CALL* CreateKernelV2)(_In_ const struct OrtCustomOp* op, _In_ const OrtApi* api,
5417 _In_ const OrtKernelInfo* info,
5418 _Out_ void** kernel);
5419
5420 // Perform the computation step.
5421 OrtStatusPtr(ORT_API_CALL* KernelComputeV2)(_In_ void* op_kernel, _In_ OrtKernelContext* context);
5422
5423 OrtStatusPtr(ORT_API_CALL* InferOutputShapeFn)(_In_ const struct OrtCustomOp* op, _In_ OrtShapeInferContext*);
5424
5425 // Get start range
5426 int(ORT_API_CALL* GetStartVersion)(_In_ const struct OrtCustomOp* op);
5427 int(ORT_API_CALL* GetEndVersion)(_In_ const struct OrtCustomOp* op);
5428
5429 // Get the inplace_map that defines which output can reuse which input
5430 // Callers will provide 2 raw int* and pass in their address, this function will fill these 2 arrays
5431 // when return, output (*output_index)[i] may reuse the input (*input_index[i]).
5432 // The return value is the size of these 2 arrays.
5433 // Callers are responsible to delete these 2 arrays after use by calling OrtCustomOp::ReleaseMayInplace().
5434 size_t(ORT_API_CALL* GetMayInplace)(_Out_ int** input_index, _Out_ int** output_index);
5435
5436 // Release the pointer input_index and output_index allocated from GetMayInplace() function.
5437 // If GetMayInplace() is defined, this function MUST be defined as well.
5438 void(ORT_API_CALL* ReleaseMayInplace)(_Frees_ptr_opt_ int* input_index, _Frees_ptr_opt_ int* output_index);
5439
5440 // Same as GetMayInplace() and ReleaseMayInplace()
5441 size_t(ORT_API_CALL* GetAliasMap)(_Out_ int** input_index, _Out_ int** output_index);
5442 void(ORT_API_CALL* ReleaseAliasMap)(_Frees_ptr_opt_ int* input_index, _Frees_ptr_opt_ int* output_index);
5443};
5444
5457 // Model building/editing requires a full build. We return nullptr from GetModelEditorApi if this is a minimal
5458 // build, so it doesn't matter if there are no function pointers in this struct as a user will never get an
5459 // OrtModelEditorApi instance. We do however need a dummy field to avoid empty struct warning.
5460#if defined(ORT_MINIMAL_BUILD)
5461 const bool not_defined_in_this_build;
5462#else
5476 ORT_API2_STATUS(CreateTensorTypeInfo, _In_ const OrtTensorTypeAndShapeInfo* tensor_info,
5477 _Outptr_ OrtTypeInfo** type_info);
5478
5492 ORT_API2_STATUS(CreateSparseTensorTypeInfo, _In_ const OrtTensorTypeAndShapeInfo* tensor_info,
5493 _Outptr_ OrtTypeInfo** type_info);
5494
5509 ORT_API2_STATUS(CreateMapTypeInfo, ONNXTensorElementDataType map_key_type, _In_ const OrtTypeInfo* map_value_type,
5510 _Outptr_ OrtTypeInfo** type_info);
5511
5525 ORT_API2_STATUS(CreateSequenceTypeInfo, _In_ const OrtTypeInfo* sequence_type, _Outptr_ OrtTypeInfo** type_info);
5526
5540 ORT_API2_STATUS(CreateOptionalTypeInfo, _In_ const OrtTypeInfo* contained_type, _Outptr_ OrtTypeInfo** type_info);
5541
5552 ORT_API2_STATUS(CreateValueInfo, _In_ const char* name, _In_ const OrtTypeInfo* type_info,
5553 _Outptr_ OrtValueInfo** value_info);
5554
5576 ORT_API2_STATUS(CreateNode, _In_ const char* operator_name, _In_ const char* domain_name, _In_ const char* node_name,
5577 _In_reads_(input_names_len) const char* const* input_names, size_t input_names_len,
5578 _In_reads_(output_names_len) const char* const* output_names, size_t output_names_len,
5579 _In_reads_(attribs_len) _In_opt_ OrtOpAttr** attributes, _In_ size_t attribs_len,
5580 _Outptr_ OrtNode** node);
5581
5586 ORT_API2_STATUS(CreateGraph, _Outptr_ OrtGraph** graph);
5587
5601 ORT_API2_STATUS(SetGraphInputs, _Inout_ OrtGraph* graph,
5602 _In_reads_(inputs_len) _In_ OrtValueInfo** inputs, _In_ size_t inputs_len);
5603
5617 ORT_API2_STATUS(SetGraphOutputs, _Inout_ OrtGraph* graph,
5618 _In_reads_(outputs_len) _In_ OrtValueInfo** outputs, _In_ size_t outputs_len);
5619
5658 ORT_API2_STATUS(AddInitializerToGraph, _Inout_ OrtGraph* graph, _In_ const char* name, _In_ OrtValue* tensor,
5659 bool data_is_external);
5660
5672 ORT_API2_STATUS(AddNodeToGraph, _Inout_ OrtGraph* graph, _In_ OrtNode* node);
5673
5692 ORT_API2_STATUS(CreateModel,
5693 _In_reads_(opset_entries_len) const char* const* domain_names,
5694 _In_reads_(opset_entries_len) const int* opset_versions,
5695 size_t opset_entries_len,
5696 _Outptr_ OrtModel** model);
5697
5711 ORT_API2_STATUS(AddGraphToModel, _Inout_ OrtModel* model, _In_ OrtGraph* graph);
5712
5731 ORT_API2_STATUS(CreateSessionFromModel, _In_ const OrtEnv* env, _In_ const OrtModel* model,
5732 _In_ const OrtSessionOptions* options, _Outptr_ OrtSession** out);
5733
5756 ORT_API2_STATUS(CreateModelEditorSession, _In_ const OrtEnv* env, _In_ const ORTCHAR_T* model_path,
5757 _In_ const OrtSessionOptions* options,
5758 _Outptr_ OrtSession** out);
5759
5784 ORT_API2_STATUS(CreateModelEditorSessionFromArray, _In_ const OrtEnv* env,
5785 _In_ const void* model_data, size_t model_data_length,
5786 _In_ const OrtSessionOptions* options,
5787 _Outptr_ OrtSession** out);
5788
5803 ORT_API2_STATUS(SessionGetOpsetForDomain, _In_ const OrtSession* session, _In_ const char* domain, _Out_ int* opset);
5804
5823 ORT_API2_STATUS(ApplyModelToModelEditorSession, _Inout_ OrtSession* session, _In_ OrtModel* model);
5824
5838 ORT_API2_STATUS(FinalizeModelEditorSession, _Inout_ OrtSession* session, _In_ const OrtSessionOptions* options,
5839 _In_opt_ OrtPrepackedWeightsContainer* prepacked_weights_container);
5840#endif // !defined(ORT_MINIMAL_BUILD)
5841};
5842
5850 // Default. Do not enable any additional compilation options.
5852
5853 // Force compilation to return an error (ORT_FAIL) if no nodes were compiled.
5854 // Otherwise, a model with basic optimizations (ORT_ENABLE_BASIC) is still generated by default.
5856
5857 // Force compilation to return an error (ORT_FAIL) if a file with the same filename as the output model exists.
5858 // Otherwise, compilation will automatically overwrite the output file if it exists.
5861
5889 ORT_CLASS_RELEASE(ModelCompilationOptions);
5890
5906 ORT_API2_STATUS(CreateModelCompilationOptionsFromSessionOptions, _In_ const OrtEnv* env,
5907 _In_ const OrtSessionOptions* session_options, _Outptr_ OrtModelCompilationOptions** out);
5908
5921 ORT_API2_STATUS(ModelCompilationOptions_SetInputModelPath, _In_ OrtModelCompilationOptions* model_compile_options,
5922 _In_ const ORTCHAR_T* input_model_path);
5923
5938 _In_ OrtModelCompilationOptions* model_compile_options,
5939 _In_ const void* input_model_data,
5940 size_t input_model_data_size);
5941
5959 ORT_API2_STATUS(ModelCompilationOptions_SetOutputModelPath, _In_ OrtModelCompilationOptions* model_compile_options,
5960 _In_ const ORTCHAR_T* output_model_path);
5961
5978 _In_ OrtModelCompilationOptions* model_compile_options,
5979 _In_ const ORTCHAR_T* external_initializers_file_path,
5980 size_t external_initializers_size_threshold);
5981
6004 _In_ OrtModelCompilationOptions* model_compile_options,
6005 _Inout_ OrtAllocator* allocator,
6006 _Outptr_ void** output_model_buffer_ptr,
6007 _Out_ size_t* output_model_buffer_size_ptr);
6008
6031 ORT_API2_STATUS(ModelCompilationOptions_SetEpContextEmbedMode, _In_ OrtModelCompilationOptions* model_compile_options,
6032 bool embed_ep_context_in_model);
6033
6043 ORT_API2_STATUS(CompileModel, _In_ const OrtEnv* env, _In_ const OrtModelCompilationOptions* model_options);
6044
6054 ORT_API2_STATUS(ModelCompilationOptions_SetFlags, _In_ OrtModelCompilationOptions* model_compile_options,
6055 size_t flags);
6056};
6057
6058ORT_RUNTIME_CLASS(Ep);
6059ORT_RUNTIME_CLASS(EpFactory);
6060
6061struct OrtEpApi {
6075 ORT_API2_STATUS(CreateEpDevice, _In_ OrtEpFactory* ep_factory,
6076 _In_ const OrtHardwareDevice* hardware_device,
6077 _In_opt_ const OrtKeyValuePairs* ep_metadata,
6078 _In_opt_ const OrtKeyValuePairs* ep_options,
6079 _Out_ OrtEpDevice** ep_device);
6080
6081 ORT_CLASS_RELEASE(EpDevice);
6082};
6083
6088struct OrtEp {
6097
6107 const char*(ORT_API_CALL* GetName)(const OrtEp* this_ptr);
6108
6109 // OrtStatus* GetCapability(OrtEp* ep, const OrtGraph* graph,
6110 // size_t* num_supported_subgraphs,
6111 // OrtIndexedSubgraph** supported_subgraphs, OrtAllocator* allocator);
6112
6113 // OrtStatus* Compile(OrtEp* ep, const OrtGraph** graphs, OrtNode** fused_graph_nodes,
6114 // size_t count, OrtNodeComputeInfo* node_compute_infos);
6115
6116 // TODO: Implement OrtEpApi and the complete OrtEp interface as the next step.
6117};
6118
6137typedef OrtStatus* (*CreateEpApiFactoriesFn)(_In_ const char* registered_name, _In_ const OrtApiBase* ort_api_base,
6138 _Inout_ OrtEpFactory** factories, _In_ size_t max_factories,
6139 _Out_ size_t* num_factories);
6140
6151typedef OrtStatus* (*ReleaseEpApiFactoryFn)(_In_ OrtEpFactory* factory);
6152
6166
6174 const char*(ORT_API_CALL* GetName)(const OrtEpFactory* this_ptr);
6175
6183 const char*(ORT_API_CALL* GetVendor)(const OrtEpFactory* this_ptr); // return EP vendor
6184
6204 OrtStatus*(ORT_API_CALL* GetSupportedDevices)(_In_ OrtEpFactory* this_ptr,
6205 _In_reads_(num_devices) const OrtHardwareDevice* const* devices,
6206 _In_ size_t num_devices,
6207 _Inout_ OrtEpDevice** ep_devices,
6208 _In_ size_t max_ep_devices,
6209 _Out_ size_t* num_ep_devices);
6210
6233 OrtStatus*(ORT_API_CALL* CreateEp)(_In_ OrtEpFactory* this_ptr,
6234 _In_reads_(num_devices) const OrtHardwareDevice* const* devices,
6235 _In_reads_(num_devices) const OrtKeyValuePairs* const* ep_metadata_pairs,
6236 _In_ size_t num_devices,
6237 _In_ const OrtSessionOptions* session_options,
6238 _In_ const OrtLogger* logger, _Outptr_ OrtEp** ep);
6239
6247 void(ORT_API_CALL* ReleaseEp)(OrtEpFactory* this_ptr, struct OrtEp* ep);
6248};
6249
6250/*
6251 * This is the old way to add the CUDA provider to the session, please use SessionOptionsAppendExecutionProvider_CUDA above to access the latest functionality
6252 * This function always exists, but will only succeed if Onnxruntime was built with CUDA support and the CUDA provider shared library exists
6253 *
6254 * \param device_id CUDA device id, starts from zero.
6255 */
6256ORT_API_STATUS(OrtSessionOptionsAppendExecutionProvider_CUDA, _In_ OrtSessionOptions* options, int device_id);
6257
6258/*
6259 * This is the old way to add the ROCm provider to the session, please use
6260 * SessionOptionsAppendExecutionProvider_ROCM above to access the latest functionality
6261 * This function always exists, but will only succeed if Onnxruntime was built with
6262 * HIP support and the ROCm provider shared library exists
6263 *
6264 * \param device_id HIP device id, starts from zero.
6265 */
6266ORT_API_STATUS(OrtSessionOptionsAppendExecutionProvider_ROCM, _In_ OrtSessionOptions* options, int device_id);
6267
6268/*
6269 * This is the old way to add the MIGraphX provider to the session, please use
6270 * SessionOptionsAppendExecutionProvider_MIGraphX above to access the latest functionality
6271 * This function always exists, but will only succeed if Onnxruntime was built with
6272 * HIP support and the MIGraphX provider shared library exists
6273 *
6274 * \param device_id HIP device id, starts from zero.
6275 */
6276ORT_API_STATUS(OrtSessionOptionsAppendExecutionProvider_MIGraphX, _In_ OrtSessionOptions* options, int device_id);
6277
6278/*
6279 * This is the old way to add the oneDNN provider to the session, please use
6280 * SessionOptionsAppendExecutionProvider_oneDNN above to access the latest functionality
6281 * This function always exists, but will only succeed if Onnxruntime was built with
6282 * oneDNN support and the oneDNN provider shared library exists
6283 *
6284 * \param use_arena zero: false. non-zero: true.
6285 */
6286ORT_API_STATUS(OrtSessionOptionsAppendExecutionProvider_Dnnl, _In_ OrtSessionOptions* options, int use_arena);
6287
6288/*
6289 * This is the old way to add the TensorRT provider to the session, please use SessionOptionsAppendExecutionProvider_TensorRT_V2 above to access the latest functionality
6290 * This function always exists, but will only succeed if Onnxruntime was built with TensorRT support and the TensorRT provider shared library exists
6291 *
6292 * \param device_id CUDA device id, starts from zero.
6293 */
6294ORT_API_STATUS(OrtSessionOptionsAppendExecutionProvider_Tensorrt, _In_ OrtSessionOptions* options, int device_id);
6295
6296#ifdef __cplusplus
6297}
6298#endif
OrtStatus * OrtSessionOptionsAppendExecutionProvider_MIGraphX(OrtSessionOptions *options, int device_id)
struct OrtMemoryInfo OrtMemoryInfo
Definition onnxruntime_c_api.h:284
struct OrtLoraAdapter OrtLoraAdapter
Definition onnxruntime_c_api.h:310
struct OrtHardwareDevice OrtHardwareDevice
Definition onnxruntime_c_api.h:316
struct OrtKernelInfo OrtKernelInfo
Definition onnxruntime_c_api.h:401
struct OrtNode OrtNode
Definition onnxruntime_c_api.h:312
OrtStatus * OrtSessionOptionsAppendExecutionProvider_Tensorrt(OrtSessionOptions *options, int device_id)
OrtLoggingLevel
Logging severity levels.
Definition onnxruntime_c_api.h:237
const struct OrtCustomHandleType * OrtCustomThreadHandle
OrtMemoryInfoDeviceType
This mimics OrtDevice type constants so they can be returned in the API.
Definition onnxruntime_c_api.h:425
struct OrtModelCompilationOptions OrtModelCompilationOptions
Definition onnxruntime_c_api.h:315
struct OrtShapeInferContext OrtShapeInferContext
Definition onnxruntime_c_api.h:309
void(* OrtLoggingFunction)(void *param, OrtLoggingLevel severity, const char *category, const char *logid, const char *code_location, const char *message)
Definition onnxruntime_c_api.h:365
void(* OrtCustomJoinThreadFn)(OrtCustomThreadHandle ort_custom_thread_handle)
Custom thread join function.
Definition onnxruntime_c_api.h:825
OrtStatus *(* RegisterCustomOpsFn)(OrtSessionOptions *options, const OrtApiBase *api)
Definition onnxruntime_c_api.h:827
OrtCustomOpInputOutputCharacteristic
Definition onnxruntime_c_api.h:5348
struct OrtTensorRTProviderOptionsV2 OrtTensorRTProviderOptionsV2
Definition onnxruntime_c_api.h:301
struct OrtOpAttr OrtOpAttr
Definition onnxruntime_c_api.h:307
struct OrtThreadingOptions OrtThreadingOptions
Definition onnxruntime_c_api.h:298
struct OrtSequenceTypeInfo OrtSequenceTypeInfo
Definition onnxruntime_c_api.h:292
OrtLanguageProjection
Language projection identifiers /see OrtApi::SetLanguageProjection.
Definition onnxruntime_c_api.h:390
struct OrtValueInfo OrtValueInfo
Definition onnxruntime_c_api.h:311
struct OrtDnnlProviderOptions OrtDnnlProviderOptions
Definition onnxruntime_c_api.h:305
OrtSparseIndicesFormat
Definition onnxruntime_c_api.h:226
struct OrtPrepackedWeightsContainer OrtPrepackedWeightsContainer
Definition onnxruntime_c_api.h:300
struct OrtSession OrtSession
Definition onnxruntime_c_api.h:286
OrtStatus *(* EpSelectionDelegate)(const OrtEpDevice **ep_devices, size_t num_devices, const OrtKeyValuePairs *model_metadata, const OrtKeyValuePairs *runtime_metadata, const OrtEpDevice **selected, size_t max_selected, size_t *num_selected, void *state)
Delegate to allow providing custom OrtEpDevice selection logic.
Definition onnxruntime_c_api.h:468
struct OrtCustomOpDomain OrtCustomOpDomain
Definition onnxruntime_c_api.h:295
struct OrtIoBinding OrtIoBinding
Definition onnxruntime_c_api.h:285
OrtAllocatorType
Definition onnxruntime_c_api.h:407
struct OrtOp OrtOp
Definition onnxruntime_c_api.h:306
struct OrtModelMetadata OrtModelMetadata
Definition onnxruntime_c_api.h:296
struct OrtTypeInfo OrtTypeInfo
Definition onnxruntime_c_api.h:289
struct OrtTensorTypeAndShapeInfo OrtTensorTypeAndShapeInfo
Definition onnxruntime_c_api.h:290
struct OrtCUDAProviderOptionsV2 OrtCUDAProviderOptionsV2
Definition onnxruntime_c_api.h:303
struct OrtKernelContext OrtKernelContext
Definition onnxruntime_c_api.h:403
OrtStatus * OrtSessionOptionsAppendExecutionProvider_Dnnl(OrtSessionOptions *options, int use_arena)
OrtCudnnConvAlgoSearch
Algorithm to use for cuDNN Convolution Op.
Definition onnxruntime_c_api.h:479
struct OrtCANNProviderOptions OrtCANNProviderOptions
Definition onnxruntime_c_api.h:304
struct OrtEpDevice OrtEpDevice
Definition onnxruntime_c_api.h:317
void(* RunAsyncCallbackFn)(void *user_data, OrtValue **outputs, size_t num_outputs, OrtStatusPtr status)
Callback function for RunAsync.
Definition onnxruntime_c_api.h:836
struct OrtRunOptions OrtRunOptions
Definition onnxruntime_c_api.h:288
OrtHardwareDeviceType
Definition onnxruntime_c_api.h:431
struct OrtModel OrtModel
Definition onnxruntime_c_api.h:314
struct OrtGraph OrtGraph
Definition onnxruntime_c_api.h:313
void(* OrtThreadWorkerFn)(void *ort_worker_fn_param)
Thread work loop function.
Definition onnxruntime_c_api.h:807
OrtStatus * OrtSessionOptionsAppendExecutionProvider_ROCM(OrtSessionOptions *options, int device_id)
struct OrtOptionalTypeInfo OrtOptionalTypeInfo
Definition onnxruntime_c_api.h:293
struct OrtSessionOptions OrtSessionOptions
Definition onnxruntime_c_api.h:294
struct OrtValue OrtValue
Definition onnxruntime_c_api.h:287
GraphOptimizationLevel
Graph optimization level.
Definition onnxruntime_c_api.h:374
struct OrtKeyValuePairs OrtKeyValuePairs
Definition onnxruntime_c_api.h:318
OrtStatus * OrtStatusPtr
Definition onnxruntime_c_api.h:323
OrtMemType
Memory types for allocated memory, execution provider specific types should be extended in each provi...
Definition onnxruntime_c_api.h:416
OrtSparseFormat
Definition onnxruntime_c_api.h:218
ONNXType
Definition onnxruntime_c_api.h:206
struct OrtEnv OrtEnv
Definition onnxruntime_c_api.h:282
OrtErrorCode
Definition onnxruntime_c_api.h:245
struct OrtStatus OrtStatus
Definition onnxruntime_c_api.h:283
struct OrtLogger OrtLogger
Definition onnxruntime_c_api.h:308
struct OrtMapTypeInfo OrtMapTypeInfo
Definition onnxruntime_c_api.h:291
struct OrtArenaCfg OrtArenaCfg
Definition onnxruntime_c_api.h:299
ExecutionMode
Definition onnxruntime_c_api.h:382
OrtStatus * OrtSessionOptionsAppendExecutionProvider_CUDA(OrtSessionOptions *options, int device_id)
OrtOpAttrType
Definition onnxruntime_c_api.h:262
OrtCustomThreadHandle(* OrtCustomCreateThreadFn)(void *ort_custom_thread_creation_options, OrtThreadWorkerFn ort_thread_worker_fn, void *ort_worker_fn_param)
Ort custom thread creation function.
Definition onnxruntime_c_api.h:818
ONNXTensorElementDataType
Definition onnxruntime_c_api.h:177
OrtCompileApiFlags
Flags representing options to enable when compiling a model.
Definition onnxruntime_c_api.h:5849
OrtExecutionProviderDevicePolicy
These are the default EP selection policies used by ORT when doing automatic EP selection.
Definition onnxruntime_c_api.h:439
const OrtApiBase * OrtGetApiBase(void)
The Onnxruntime library's entry point to access the C API.
@ ORT_LOGGING_LEVEL_VERBOSE
Verbose informational messages (least severe).
Definition onnxruntime_c_api.h:238
@ ORT_LOGGING_LEVEL_INFO
Informational messages.
Definition onnxruntime_c_api.h:239
@ ORT_LOGGING_LEVEL_ERROR
Error messages.
Definition onnxruntime_c_api.h:241
@ ORT_LOGGING_LEVEL_WARNING
Warning messages.
Definition onnxruntime_c_api.h:240
@ ORT_LOGGING_LEVEL_FATAL
Fatal error messages (most severe).
Definition onnxruntime_c_api.h:242
@ OrtMemoryInfoDeviceType_GPU
Definition onnxruntime_c_api.h:427
@ OrtMemoryInfoDeviceType_FPGA
Definition onnxruntime_c_api.h:428
@ OrtMemoryInfoDeviceType_CPU
Definition onnxruntime_c_api.h:426
@ INPUT_OUTPUT_VARIADIC
Definition onnxruntime_c_api.h:5351
@ INPUT_OUTPUT_REQUIRED
Definition onnxruntime_c_api.h:5349
@ INPUT_OUTPUT_OPTIONAL
Definition onnxruntime_c_api.h:5350
@ ORT_PROJECTION_C
Definition onnxruntime_c_api.h:391
@ ORT_PROJECTION_PYTHON
Definition onnxruntime_c_api.h:394
@ ORT_PROJECTION_CPLUSPLUS
Definition onnxruntime_c_api.h:392
@ ORT_PROJECTION_WINML
Definition onnxruntime_c_api.h:396
@ ORT_PROJECTION_CSHARP
Definition onnxruntime_c_api.h:393
@ ORT_PROJECTION_JAVA
Definition onnxruntime_c_api.h:395
@ ORT_PROJECTION_NODEJS
Definition onnxruntime_c_api.h:397
@ ORT_SPARSE_COO_INDICES
Definition onnxruntime_c_api.h:227
@ ORT_SPARSE_BLOCK_SPARSE_INDICES
Definition onnxruntime_c_api.h:230
@ ORT_SPARSE_CSR_OUTER_INDICES
Definition onnxruntime_c_api.h:229
@ ORT_SPARSE_CSR_INNER_INDICES
Definition onnxruntime_c_api.h:228
@ OrtDeviceAllocator
Definition onnxruntime_c_api.h:409
@ OrtArenaAllocator
Definition onnxruntime_c_api.h:410
@ OrtInvalidAllocator
Definition onnxruntime_c_api.h:408
@ OrtCudnnConvAlgoSearchDefault
Definition onnxruntime_c_api.h:482
@ OrtCudnnConvAlgoSearchExhaustive
Definition onnxruntime_c_api.h:480
@ OrtCudnnConvAlgoSearchHeuristic
Definition onnxruntime_c_api.h:481
@ OrtHardwareDeviceType_CPU
Definition onnxruntime_c_api.h:432
@ OrtHardwareDeviceType_NPU
Definition onnxruntime_c_api.h:434
@ OrtHardwareDeviceType_GPU
Definition onnxruntime_c_api.h:433
@ ORT_ENABLE_BASIC
Definition onnxruntime_c_api.h:376
@ ORT_ENABLE_ALL
Definition onnxruntime_c_api.h:379
@ ORT_ENABLE_LAYOUT
Definition onnxruntime_c_api.h:378
@ ORT_DISABLE_ALL
Definition onnxruntime_c_api.h:375
@ ORT_ENABLE_EXTENDED
Definition onnxruntime_c_api.h:377
@ OrtMemTypeCPUInput
Any CPU memory used by non-CPU execution provider.
Definition onnxruntime_c_api.h:417
@ OrtMemTypeCPU
Temporary CPU accessible memory allocated by non-CPU execution provider, i.e. CUDA_PINNED.
Definition onnxruntime_c_api.h:419
@ OrtMemTypeDefault
The default allocator for execution provider.
Definition onnxruntime_c_api.h:420
@ OrtMemTypeCPUOutput
CPU accessible memory outputted by non-CPU execution provider, i.e. CUDA_PINNED.
Definition onnxruntime_c_api.h:418
@ ORT_SPARSE_CSRC
Definition onnxruntime_c_api.h:221
@ ORT_SPARSE_COO
Definition onnxruntime_c_api.h:220
@ ORT_SPARSE_BLOCK_SPARSE
Definition onnxruntime_c_api.h:222
@ ORT_SPARSE_UNDEFINED
Definition onnxruntime_c_api.h:219
@ ONNX_TYPE_SEQUENCE
Definition onnxruntime_c_api.h:209
@ ONNX_TYPE_MAP
Definition onnxruntime_c_api.h:210
@ ONNX_TYPE_OPAQUE
Definition onnxruntime_c_api.h:211
@ ONNX_TYPE_UNKNOWN
Definition onnxruntime_c_api.h:207
@ ONNX_TYPE_TENSOR
Definition onnxruntime_c_api.h:208
@ ONNX_TYPE_SPARSETENSOR
Definition onnxruntime_c_api.h:212
@ ONNX_TYPE_OPTIONAL
Definition onnxruntime_c_api.h:213
@ ORT_MODEL_LOAD_CANCELED
Definition onnxruntime_c_api.h:258
@ ORT_NO_SUCHFILE
Definition onnxruntime_c_api.h:249
@ ORT_OK
Definition onnxruntime_c_api.h:246
@ ORT_INVALID_ARGUMENT
Definition onnxruntime_c_api.h:248
@ ORT_EP_FAIL
Definition onnxruntime_c_api.h:257
@ ORT_NOT_IMPLEMENTED
Definition onnxruntime_c_api.h:255
@ ORT_RUNTIME_EXCEPTION
Definition onnxruntime_c_api.h:252
@ ORT_ENGINE_ERROR
Definition onnxruntime_c_api.h:251
@ ORT_FAIL
Definition onnxruntime_c_api.h:247
@ ORT_MODEL_REQUIRES_COMPILATION
Definition onnxruntime_c_api.h:259
@ ORT_INVALID_PROTOBUF
Definition onnxruntime_c_api.h:253
@ ORT_NO_MODEL
Definition onnxruntime_c_api.h:250
@ ORT_INVALID_GRAPH
Definition onnxruntime_c_api.h:256
@ ORT_MODEL_LOADED
Definition onnxruntime_c_api.h:254
@ ORT_PARALLEL
Definition onnxruntime_c_api.h:384
@ ORT_SEQUENTIAL
Definition onnxruntime_c_api.h:383
@ ORT_OP_ATTR_INT
Definition onnxruntime_c_api.h:264
@ ORT_OP_ATTR_FLOATS
Definition onnxruntime_c_api.h:267
@ ORT_OP_ATTR_STRINGS
Definition onnxruntime_c_api.h:269
@ ORT_OP_ATTR_UNDEFINED
Definition onnxruntime_c_api.h:263
@ ORT_OP_ATTR_INTS
Definition onnxruntime_c_api.h:265
@ ORT_OP_ATTR_STRING
Definition onnxruntime_c_api.h:268
@ ORT_OP_ATTR_FLOAT
Definition onnxruntime_c_api.h:266
@ ONNX_TENSOR_ELEMENT_DATA_TYPE_STRING
Definition onnxruntime_c_api.h:186
@ ONNX_TENSOR_ELEMENT_DATA_TYPE_INT32
Definition onnxruntime_c_api.h:184
@ ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT32
Definition onnxruntime_c_api.h:190
@ ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT16
Definition onnxruntime_c_api.h:182
@ ONNX_TENSOR_ELEMENT_DATA_TYPE_UNDEFINED
Definition onnxruntime_c_api.h:178
@ ONNX_TENSOR_ELEMENT_DATA_TYPE_COMPLEX128
Definition onnxruntime_c_api.h:193
@ ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT8E5M2FNUZ
Definition onnxruntime_c_api.h:199
@ ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT64
Definition onnxruntime_c_api.h:191
@ ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT4
Definition onnxruntime_c_api.h:201
@ ONNX_TENSOR_ELEMENT_DATA_TYPE_INT64
Definition onnxruntime_c_api.h:185
@ ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT8E5M2
Definition onnxruntime_c_api.h:198
@ ONNX_TENSOR_ELEMENT_DATA_TYPE_BOOL
Definition onnxruntime_c_api.h:187
@ ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT16
Definition onnxruntime_c_api.h:188
@ ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT8
Definition onnxruntime_c_api.h:180
@ ONNX_TENSOR_ELEMENT_DATA_TYPE_INT16
Definition onnxruntime_c_api.h:183
@ ONNX_TENSOR_ELEMENT_DATA_TYPE_DOUBLE
Definition onnxruntime_c_api.h:189
@ ONNX_TENSOR_ELEMENT_DATA_TYPE_INT8
Definition onnxruntime_c_api.h:181
@ ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT
Definition onnxruntime_c_api.h:179
@ ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT8E4M3FN
Definition onnxruntime_c_api.h:196
@ ONNX_TENSOR_ELEMENT_DATA_TYPE_BFLOAT16
Definition onnxruntime_c_api.h:194
@ ONNX_TENSOR_ELEMENT_DATA_TYPE_INT4
Definition onnxruntime_c_api.h:202
@ ONNX_TENSOR_ELEMENT_DATA_TYPE_COMPLEX64
Definition onnxruntime_c_api.h:192
@ ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT8E4M3FNUZ
Definition onnxruntime_c_api.h:197
@ OrtCompileApiFlags_NONE
Definition onnxruntime_c_api.h:5851
@ OrtCompileApiFlags_ERROR_IF_NO_NODES_COMPILED
Definition onnxruntime_c_api.h:5855
@ OrtCompileApiFlags_ERROR_IF_OUTPUT_FILE_EXISTS
Definition onnxruntime_c_api.h:5859
@ OrtExecutionProviderDevicePolicy_DEFAULT
Definition onnxruntime_c_api.h:440
@ OrtExecutionProviderDevicePolicy_PREFER_CPU
Definition onnxruntime_c_api.h:441
@ OrtExecutionProviderDevicePolicy_MAX_PERFORMANCE
Definition onnxruntime_c_api.h:444
@ OrtExecutionProviderDevicePolicy_PREFER_NPU
Definition onnxruntime_c_api.h:442
@ OrtExecutionProviderDevicePolicy_MAX_EFFICIENCY
Definition onnxruntime_c_api.h:445
@ OrtExecutionProviderDevicePolicy_PREFER_GPU
Definition onnxruntime_c_api.h:443
@ OrtExecutionProviderDevicePolicy_MIN_OVERALL_POWER
Definition onnxruntime_c_api.h:446
Memory allocation interface.
Definition onnxruntime_c_api.h:332
void(* Free)(struct OrtAllocator *this_, void *p)
Free a block of memory previously allocated with OrtAllocator::Alloc.
Definition onnxruntime_c_api.h:335
const struct OrtMemoryInfo *(* Info)(const struct OrtAllocator *this_)
Return a pointer to an OrtMemoryInfo that describes this allocator.
Definition onnxruntime_c_api.h:336
uint32_t version
Must be initialized to ORT_API_VERSION.
Definition onnxruntime_c_api.h:333
void *(* Alloc)(struct OrtAllocator *this_, size_t size)
Returns a pointer to an allocated block of size bytes.
Definition onnxruntime_c_api.h:334
void *(* Reserve)(struct OrtAllocator *this_, size_t size)
Optional allocation function to use for memory allocations made during session initialization....
Definition onnxruntime_c_api.h:342
OrtStatus * GetStats(const struct OrtAllocator *this_, OrtKeyValuePairs **out)
Function used to get the statistics of the allocator.
The helper interface to get the right version of OrtApi.
Definition onnxruntime_c_api.h:775
const char *(* GetVersionString)(void)
Returns a null terminated string of the version of the Onnxruntime library (eg: "1....
Definition onnxruntime_c_api.h:791
const OrtApi *(* GetApi)(uint32_t version)
Get a pointer to the requested version of the OrtApi.
Definition onnxruntime_c_api.h:785
The C API.
Definition onnxruntime_c_api.h:845
OrtStatus * SetGlobalIntraOpThreadAffinity(OrtThreadingOptions *tp_options, const char *affinity_string)
OrtStatus * ShapeInferContext_SetOutputTypeShape(const OrtShapeInferContext *context, size_t index, const OrtTensorTypeAndShapeInfo *info)
OrtStatus * SessionGetOverridableInitializerTypeInfo(const OrtSession *session, size_t index, OrtTypeInfo **type_info)
Get overridable initializer type information.
OrtStatus * SessionOptionsSetCustomJoinThreadFn(OrtSessionOptions *options, OrtCustomJoinThreadFn ort_custom_join_thread_fn)
Set custom thread join function.
OrtStatus * KernelInfoGetAttributeArray_int64(const OrtKernelInfo *info, const char *name, int64_t *out, size_t *size)
Fetch an array of int64_t values stored as an attribute in the graph node.
OrtStatus * CreateSessionOptions(OrtSessionOptions **options)
Create an OrtSessionOptions object.
OrtHardwareDeviceType(* HardwareDevice_Type)(const OrtHardwareDevice *device)
Get the hardware device type.
Definition onnxruntime_c_api.h:5210
void(* ReleaseDnnlProviderOptions)(OrtDnnlProviderOptions *input)
Release an OrtDnnlProviderOptions.
Definition onnxruntime_c_api.h:4285
OrtStatus * TensorAt(OrtValue *value, const int64_t *location_values, size_t location_values_count, void **out)
Direct memory access to a specified tensor element.
OrtStatus * KernelInfoGetAttribute_float(const OrtKernelInfo *info, const char *name, float *out)
Get a float stored as an attribute in the graph node.
OrtStatus * GetCANNProviderOptionsAsString(const OrtCANNProviderOptions *cann_options, OrtAllocator *allocator, char **ptr)
Get serialized CANN provider options string.
OrtStatus * InvokeOp(const OrtKernelContext *context, const OrtOp *ort_op, const OrtValue *const *input_values, int input_count, OrtValue *const *output_values, int output_count)
: Invoke the operator created by OrtApi::CreateOp The inputs must follow the order as specified in on...
OrtStatus * HasSessionConfigEntry(const OrtSessionOptions *options, const char *config_key, int *out)
Checks if the given session configuration entry exists.
const char *(* GetBuildInfoString)(void)
Returns a null terminated string of the build info including git info and cxx flags.
Definition onnxruntime_c_api.h:4475
OrtStatus * AddExternalInitializersFromFilesInMemory(OrtSessionOptions *options, const char *const *external_initializer_file_names, char *const *external_initializer_file_buffer_array, const size_t *external_initializer_file_lengths, size_t num_external_initializer_files)
Replace initialized Tensors with external data with the provided files in memory.
OrtStatus * GetTensorMemoryInfo(const OrtValue *value, const OrtMemoryInfo **mem_info)
Returns a pointer to the OrtMemoryInfo of a Tensor.
OrtStatus * EnableCpuMemArena(OrtSessionOptions *options)
Enable the memory arena on CPU.
OrtStatus * CreateSparseTensorWithValuesAsOrtValue(const OrtMemoryInfo *info, void *p_data, const int64_t *dense_shape, size_t dense_shape_len, const int64_t *values_shape, size_t values_shape_len, ONNXTensorElementDataType type, OrtValue **out)
OrtStatus * GetValueCount(const OrtValue *value, size_t *out)
Get non tensor value count from an OrtValue.
OrtStatus * SetGlobalCustomJoinThreadFn(OrtThreadingOptions *tp_options, OrtCustomJoinThreadFn ort_custom_join_thread_fn)
Set custom thread join function for global thread pools.
OrtStatus * CreateCUDAProviderOptions(OrtCUDAProviderOptionsV2 **out)
Create an OrtCUDAProviderOptionsV2.
OrtStatus * DisableProfiling(OrtSessionOptions *options)
Disable profiling for a session.
OrtStatus * KernelInfoGetAttributeArray_float(const OrtKernelInfo *info, const char *name, float *out, size_t *size)
Fetch an array of int64_t values stored as an attribute in the graph node.
OrtStatus * CreatePrepackedWeightsContainer(OrtPrepackedWeightsContainer **out)
Create an OrtPrepackedWeightsContainer.
OrtStatus * SetDeterministicCompute(OrtSessionOptions *options, bool value)
Set whether to use deterministic compute.
OrtStatus * UpdateTensorRTProviderOptionsWithValue(OrtTensorRTProviderOptionsV2 *tensorrt_options, const char *key, void *value)
OrtStatus * CreateSessionFromArrayWithPrepackedWeightsContainer(const OrtEnv *env, const void *model_data, size_t model_data_length, const OrtSessionOptions *options, OrtPrepackedWeightsContainer *prepacked_weights_container, OrtSession **out)
Create session from memory with prepacked weights container.
const OrtCompileApi *(* GetCompileApi)()
Get the Compile API instance.
Definition onnxruntime_c_api.h:5033
OrtStatus * AddFreeDimensionOverrideByName(OrtSessionOptions *options, const char *dim_name, int64_t dim_value)
OrtStatus * KernelInfo_GetInputCount(const OrtKernelInfo *info, size_t *out)
Get the number of inputs from OrtKernelInfo.
OrtStatus * GetSparseTensorFormat(const OrtValue *ort_value, enum OrtSparseFormat *out)
Returns sparse tensor format enum iff a given ort value contains an instance of sparse tensor.
OrtStatus * KernelContext_GetGPUComputeStream(const OrtKernelContext *context, void **out)
Used for custom operators, gets the GPU compute stream to use to launch the custom a GPU kernel.
OrtStatus * UpdateCANNProviderOptions(OrtCANNProviderOptions *cann_options, const char *const *provider_options_keys, const char *const *provider_options_values, size_t num_keys)
Set options in a CANN Execution Provider.
OrtStatus * GetTensorSizeInBytes(const OrtValue *ort_value, size_t *size)
Compute total size in bytes of the tensor data contained in an OrtValue.
OrtStatus * CreateAndRegisterAllocatorV2(OrtEnv *env, const char *provider_type, const OrtMemoryInfo *mem_info, const OrtArenaCfg *arena_cfg, const char *const *provider_options_keys, const char *const *provider_options_values, size_t num_keys)
Create an allocator with specific type and register it with the OrtEnv This API enhance CreateAndRegi...
OrtStatus * SessionGetOutputName(const OrtSession *session, size_t index, OrtAllocator *allocator, char **value)
Get output name.
OrtStatus * SessionOptionsAppendExecutionProvider_TensorRT(OrtSessionOptions *options, const OrtTensorRTProviderOptions *tensorrt_options)
Append TensorRT provider to session options.
const char *(* HardwareDevice_Vendor)(const OrtHardwareDevice *device)
Get the hardware device's vendor name.
Definition onnxruntime_c_api.h:5228
const OrtTrainingApi *(* GetTrainingApi)(uint32_t version)
Gets the Training C Api struct.
Definition onnxruntime_c_api.h:3883
OrtStatus * SetIntraOpNumThreads(OrtSessionOptions *options, int intra_op_num_threads)
Sets the number of threads used to parallelize the execution within nodes.
OrtStatus * GetTypeInfo(const OrtValue *value, OrtTypeInfo **out)
Get type information of an OrtValue.
OrtStatus * AllocatorGetStats(const OrtAllocator *ort_allocator, OrtKeyValuePairs **out)
Calls OrtAllocator::GetStats function.
OrtStatus * CastTypeInfoToMapTypeInfo(const OrtTypeInfo *type_info, const OrtMapTypeInfo **out)
Get detailed map information from an OrtTypeInfo.
OrtStatus * KernelContext_GetLogger(const OrtKernelContext *context, const OrtLogger **logger)
Get the runtime logger from OrtKernelContext.
OrtStatus * SetGlobalCustomThreadCreationOptions(OrtThreadingOptions *tp_options, void *ort_custom_thread_creation_options)
Set custom thread creation options for global thread pools.
OrtStatus * AddSessionConfigEntry(OrtSessionOptions *options, const char *config_key, const char *config_value)
Set a session configuration entry as a pair of strings.
OrtStatus * SetGlobalDenormalAsZero(OrtThreadingOptions *tp_options)
Set threading flush-to-zero and denormal-as-zero.
void(* ClearBoundInputs)(OrtIoBinding *binding_ptr) __attribute__((nonnull))
Clears any previously set Inputs for an OrtIoBinding.
Definition onnxruntime_c_api.h:2538
OrtStatus * KernelInfo_GetInputTypeInfo(const OrtKernelInfo *info, size_t index, OrtTypeInfo **type_info)
Get the type information for a OrtKernelInfo's input.
OrtStatus * KernelInfoGetAttribute_string(const OrtKernelInfo *info, const char *name, char *out, size_t *size)
Fetch a string stored as an attribute in the graph node.
OrtStatus * GetSparseTensorIndicesTypeShape(const OrtValue *ort_value, enum OrtSparseIndicesFormat indices_format, OrtTensorTypeAndShapeInfo **out)
Returns data type, shape for the type of indices specified by indices_format.
OrtStatus * SessionOptionsAppendExecutionProvider_MIGraphX(OrtSessionOptions *options, const OrtMIGraphXProviderOptions *migraphx_options)
Append MIGraphX provider to session options.
OrtStatus * RunOptionsSetRunLogVerbosityLevel(OrtRunOptions *options, int log_verbosity_level)
Set per-run log verbosity level.
OrtStatus * AddInitializer(OrtSessionOptions *options, const char *name, const OrtValue *val)
Add a pre-allocated initializer to a session.
OrtStatus * CreateEnv(OrtLoggingLevel log_severity_level, const char *logid, OrtEnv **out)
Create an OrtEnv.
OrtStatus * UseCooIndices(OrtValue *ort_value, int64_t *indices_data, size_t indices_num)
OrtStatus * GetTensorMutableData(OrtValue *value, void **out)
Get a pointer to the raw data inside a tensor.
OrtStatus * KernelInfoGetAllocator(const OrtKernelInfo *info, OrtMemType mem_type, OrtAllocator **out)
Get allocator from KernelInfo for a specific memory type. Please use C API ReleaseAllocator to releas...
OrtStatus * SessionOptionsAppendExecutionProvider_OpenVINO(OrtSessionOptions *options, const OrtOpenVINOProviderOptions *provider_options)
Append OpenVINO execution provider to the session options.
OrtStatus * IsSparseTensor(const OrtValue *value, int *out)
Sets *out to 1 iff an OrtValue is a SparseTensor, and 0 otherwise.
OrtStatus * SessionOptionsAppendExecutionProvider_V2(OrtSessionOptions *session_options, OrtEnv *env, const OrtEpDevice *const *ep_devices, size_t num_ep_devices, const char *const *ep_option_keys, const char *const *ep_option_vals, size_t num_ep_options)
Append the execution provider that is responsible for the selected OrtEpDevice instances to the sessi...
void(* GetKeyValuePairs)(const OrtKeyValuePairs *kvps, const char *const **keys, const char *const **values, size_t *num_entries)
Get all the key-value pairs from the OrtKeyValuePairs instance.
Definition onnxruntime_c_api.h:5082
OrtStatus * GetTensorElementType(const OrtTensorTypeAndShapeInfo *info, enum ONNXTensorElementDataType *out)
Get element type in OrtTensorTypeAndShapeInfo.
OrtStatus * SessionOptionsSetEpSelectionPolicyDelegate(OrtSessionOptions *session_options, EpSelectionDelegate delegate, void *delegate_state)
Set the execution provider selection policy delegate for the session.
OrtStatus * CreateSparseTensorAsOrtValue(OrtAllocator *allocator, const int64_t *dense_shape, size_t dense_shape_len, ONNXTensorElementDataType type, OrtValue **out)
Create an OrtValue with a sparse tensor that is empty.
OrtStatus * FillStringTensorElement(OrtValue *value, const char *s, size_t index)
Set a single string in a string tensor.
OrtStatus * CreateTensorWithDataAsOrtValue(const OrtMemoryInfo *info, void *p_data, size_t p_data_len, const int64_t *shape, size_t shape_len, ONNXTensorElementDataType type, OrtValue **out)
Create a tensor backed by a user supplied buffer.
OrtStatus * AddExternalInitializers(OrtSessionOptions *options, const char *const *initializer_names, const OrtValue *const *initializers, size_t num_initializers)
Replace initialized Tensors with external data with the data provided in initializers.
OrtStatus * SessionOptionsSetEpSelectionPolicy(OrtSessionOptions *session_options, OrtExecutionProviderDevicePolicy policy)
Set the execution provider selection policy for the session.
const OrtHardwareDevice *(* EpDevice_Device)(const OrtEpDevice *ep_device)
Get the OrtHardwareDevice instance for the OrtEpDevice.
Definition onnxruntime_c_api.h:5293
OrtStatus * ModelMetadataGetGraphDescription(const OrtModelMetadata *model_metadata, OrtAllocator *allocator, char **value)
OrtStatus * UpdateDnnlProviderOptions(OrtDnnlProviderOptions *dnnl_options, const char *const *provider_options_keys, const char *const *provider_options_values, size_t num_keys)
Set options in a oneDNN Execution Provider.
OrtStatus * GetStringTensorElementLength(const OrtValue *value, size_t index, size_t *out)
Get the length of a single string in a string tensor.
void(* MemoryInfoGetDeviceType)(const OrtMemoryInfo *ptr, OrtMemoryInfoDeviceType *out)
Definition onnxruntime_c_api.h:3955
OrtStatus * AddRunConfigEntry(OrtRunOptions *options, const char *config_key, const char *config_value)
Set a single run configuration entry as a pair of strings.
OrtStatus * GetBoundOutputValues(const OrtIoBinding *binding_ptr, OrtAllocator *allocator, OrtValue ***output, size_t *output_count)
Get the output OrtValue objects from an OrtIoBinding.
OrtStatus * ModelMetadataGetDomain(const OrtModelMetadata *model_metadata, OrtAllocator *allocator, char **value)
Get domain from an OrtModelMetadata.
OrtStatus * SetLanguageProjection(const OrtEnv *ort_env, OrtLanguageProjection projection)
Set language projection.
OrtStatus * FillStringTensor(OrtValue *value, const char *const *s, size_t s_len)
Set all strings at once in a string tensor.
OrtStatus * SetSessionLogId(OrtSessionOptions *options, const char *logid)
Set session log id.
OrtStatus * GetValueInfoTypeInfo(const OrtValueInfo *value_info, const OrtTypeInfo **type_info)
Get the type information from an OrtValueInfo instance.
OrtStatus * SessionOptionsAppendExecutionProvider_CUDA(OrtSessionOptions *options, const OrtCUDAProviderOptions *cuda_options)
Append CUDA provider to session options.
OrtStatus * RegisterAllocator(OrtEnv *env, OrtAllocator *allocator)
Register a custom allocator.
OrtStatus * SetGlobalSpinControl(OrtThreadingOptions *tp_options, int allow_spinning)
Set global spin control options.
OrtStatus * MemoryInfoGetId(const OrtMemoryInfo *ptr, int *out)
Get the id from OrtMemoryInfo.
OrtStatus * KernelInfo_GetOutputName(const OrtKernelInfo *info, size_t index, char *out, size_t *size)
Get the name of a OrtKernelInfo's output.
OrtStatus * Logger_LogMessage(const OrtLogger *logger, OrtLoggingLevel log_severity_level, const char *message, const char *file_path, int line_number, const char *func_name)
Logs a message at the given severity level using the provided OrtLogger.
OrtStatus * CreateEnvWithCustomLogger(OrtLoggingFunction logging_function, void *logger_param, OrtLoggingLevel log_severity_level, const char *logid, OrtEnv **out)
Create an OrtEnv.
OrtStatus * UpdateCUDAProviderOptionsWithValue(OrtCUDAProviderOptionsV2 *cuda_options, const char *key, void *value)
OrtStatus * MemoryInfoGetName(const OrtMemoryInfo *ptr, const char **out)
Get name from OrtMemoryInfo.
OrtStatus * Logger_GetLoggingSeverityLevel(const OrtLogger *logger, OrtLoggingLevel *out)
Get the logging severity level of the OrtLogger.
OrtStatus * GetExecutionProviderApi(const char *provider_name, uint32_t version, const void **provider_api)
Get a pointer to the requested version of the Execution Provider specific API extensions to the OrtAp...
const OrtModelEditorApi *(* GetModelEditorApi)()
Get the Model Editor API instance.
Definition onnxruntime_c_api.h:4975
OrtStatus * KernelContext_GetOutputCount(const OrtKernelContext *context, size_t *out)
Used for custom operators, get the output count of a kernel.
OrtStatus * GetTensorShapeElementCount(const OrtTensorTypeAndShapeInfo *info, size_t *out)
Get total number of elements in a tensor shape from an OrtTensorTypeAndShapeInfo.
OrtStatus * CastTypeInfoToTensorInfo(const OrtTypeInfo *type_info, const OrtTensorTypeAndShapeInfo **out)
Get OrtTensorTypeAndShapeInfo from an OrtTypeInfo.
OrtStatus * GetOptionalContainedTypeInfo(const OrtOptionalTypeInfo *optional_type_info, OrtTypeInfo **out)
Get OrtTypeInfo for the allowed contained type from an OrtOptionalTypeInfo.
OrtStatus * CreateOp(const OrtKernelInfo *info, const char *op_name, const char *domain, int version, const char **type_constraint_names, const ONNXTensorElementDataType *type_constraint_values, int type_constraint_count, const OrtOpAttr *const *attr_values, int attr_count, int input_count, int output_count, OrtOp **ort_op)
: Create onnxruntime native operator
OrtStatus * MemoryInfoGetType(const OrtMemoryInfo *ptr, OrtAllocatorType *out)
Get the OrtAllocatorType from OrtMemoryInfo.
OrtStatus * HasValue(const OrtValue *value, int *out)
Sets out to 1 iff an optional type OrtValue has an element, 0 otherwise (OrtValue is None) Use this A...
OrtStatus * CreateEnvWithGlobalThreadPools(OrtLoggingLevel log_severity_level, const char *logid, const OrtThreadingOptions *tp_options, OrtEnv **out)
Create an OrtEnv.
OrtStatus * KernelContext_GetAllocator(const OrtKernelContext *context, const OrtMemoryInfo *mem_info, OrtAllocator **out)
Get Allocator from KernelContext for a specific memoryInfo. Please use C API ReleaseAllocator to rele...
OrtStatus * KernelInfoGetConstantInput_tensor(const OrtKernelInfo *info, size_t index, int *is_constant, const OrtValue **out)
Get a OrtValue tensor stored as a constant initializer in the graph node.
OrtStatus * GetCUDAProviderOptionsAsString(const OrtCUDAProviderOptionsV2 *cuda_options, OrtAllocator *allocator, char **ptr)
OrtStatus * UpdateCUDAProviderOptions(OrtCUDAProviderOptionsV2 *cuda_options, const char *const *provider_options_keys, const char *const *provider_options_values, size_t num_keys)
Set options in a CUDA Execution Provider.
OrtStatus * CopyKernelInfo(const OrtKernelInfo *info, OrtKernelInfo **info_copy)
OrtStatus * GetTensorRTProviderOptionsAsString(const OrtTensorRTProviderOptionsV2 *tensorrt_options, OrtAllocator *allocator, char **ptr)
Get serialized TensorRT provider options string.
OrtStatus * SessionOptionsSetCustomThreadCreationOptions(OrtSessionOptions *options, void *ort_custom_thread_creation_options)
Set creation options for custom thread.
OrtStatus * GetDimensionsCount(const OrtTensorTypeAndShapeInfo *info, size_t *out)
Get dimension count in OrtTensorTypeAndShapeInfo.
void(* ReleaseROCMProviderOptions)(OrtROCMProviderOptions *input)
Release an OrtROCMProviderOptions.
Definition onnxruntime_c_api.h:4534
OrtStatus * UpdateROCMProviderOptions(OrtROCMProviderOptions *rocm_options, const char *const *provider_options_keys, const char *const *provider_options_values, size_t num_keys)
Set options in a ROCm Execution Provider.
OrtStatus * KernelInfo_GetInputName(const OrtKernelInfo *info, size_t index, char *out, size_t *size)
Get the name of a OrtKernelInfo's input.
OrtStatus * KernelContext_GetResource(const OrtKernelContext *context, int resource_version, int resource_id, void **resource)
OrtStatus * RegisterCustomOpsLibrary(OrtSessionOptions *options, const char *library_path, void **library_handle)
OrtStatus * SetCurrentGpuDeviceId(int device_id)
Set current GPU device ID.
OrtStatus * GetOnnxTypeFromTypeInfo(const OrtTypeInfo *type_info, enum ONNXType *out)
Get ONNXType from OrtTypeInfo.
OrtStatus * GetEpDevices(const OrtEnv *env, const OrtEpDevice *const **ep_devices, size_t *num_ep_devices)
Get the list of available OrtEpDevice instances.
OrtStatus * CreateLoraAdapterFromArray(const void *bytes, size_t num_bytes, OrtAllocator *allocator, OrtLoraAdapter **out)
Create an OrtLoraAdapter.
OrtStatus * GetDenotationFromTypeInfo(const OrtTypeInfo *type_info, const char **const denotation, size_t *len)
Get denotation from type information.
OrtStatus * KernelContext_ParallelFor(const OrtKernelContext *context, void(*fn)(void *, size_t), size_t total, size_t num_batch, void *usr_data)
void(* ReleaseCANNProviderOptions)(OrtCANNProviderOptions *input)
Release an OrtCANNProviderOptions.
Definition onnxruntime_c_api.h:3949
OrtStatus * SetGlobalInterOpNumThreads(OrtThreadingOptions *tp_options, int inter_op_num_threads)
Set global inter-op thread count.
OrtStatus * CloneSessionOptions(const OrtSessionOptions *in_options, OrtSessionOptions **out_options)
Create a copy of an existing OrtSessionOptions.
OrtStatus * GetSessionConfigEntry(const OrtSessionOptions *options, const char *config_key, char *config_value, size_t *size)
Get a session configuration value.
OrtStatus * SessionOptionsAppendExecutionProvider_TensorRT_V2(OrtSessionOptions *options, const OrtTensorRTProviderOptionsV2 *tensorrt_options)
Append TensorRT execution provider to the session options.
OrtStatus * AddFreeDimensionOverride(OrtSessionOptions *options, const char *dim_denotation, int64_t dim_value)
Override session symbolic dimensions.
OrtStatus * KernelContext_GetOutput(OrtKernelContext *context, size_t index, const int64_t *dim_values, size_t dim_count, OrtValue **out)
Used for custom operators, get an output of a kernel.
OrtStatus * EnableTelemetryEvents(const OrtEnv *env)
Enable Telemetry.
OrtStatus * CreateMemoryInfo(const char *name, enum OrtAllocatorType type, int id, enum OrtMemType mem_type, OrtMemoryInfo **out)
Create an OrtMemoryInfo.
OrtStatus * SessionOptionsAppendExecutionProvider_ROCM(OrtSessionOptions *options, const OrtROCMProviderOptions *rocm_options)
Append ROCM execution provider to the session options.
const OrtEpApi *(* GetEpApi)()
Get the OrtEpApi instance for implementing an execution provider.
Definition onnxruntime_c_api.h:5299
OrtStatus * SessionGetInputTypeInfo(const OrtSession *session, size_t index, OrtTypeInfo **type_info)
Get input type information.
OrtStatus * GetSymbolicDimensions(const OrtTensorTypeAndShapeInfo *info, const char *dim_params[], size_t dim_params_length)
Get symbolic dimension names in OrtTensorTypeAndShapeInfo.
OrtStatus * SessionOptionsAppendExecutionProvider_OpenVINO_V2(OrtSessionOptions *options, const char *const *provider_options_keys, const char *const *provider_options_values, size_t num_keys)
Append OpenVINO execution provider to the session options.
OrtStatus * GetStringTensorDataLength(const OrtValue *value, size_t *len)
Get total byte length for all strings in a string tensor.
OrtStatus * KernelContext_GetInputCount(const OrtKernelContext *context, size_t *out)
Used for custom operators, get the input count of a kernel.
OrtStatus * BindOutputToDevice(OrtIoBinding *binding_ptr, const char *name, const OrtMemoryInfo *mem_info_ptr)
Bind an OrtIoBinding output to a device.
OrtStatus * SessionOptionsAppendExecutionProvider(OrtSessionOptions *options, const char *provider_name, const char *const *provider_options_keys, const char *const *provider_options_values, size_t num_keys)
: Append execution provider to the session options.
OrtStatus * SetSessionGraphOptimizationLevel(OrtSessionOptions *options, GraphOptimizationLevel graph_optimization_level)
Set the optimization level to apply when loading a graph.
OrtStatus * ModelMetadataGetDescription(const OrtModelMetadata *model_metadata, OrtAllocator *allocator, char **value)
Get description from an OrtModelMetadata.
OrtStatus * CreateCANNProviderOptions(OrtCANNProviderOptions **out)
Create an OrtCANNProviderOptions.
OrtStatus * ReadOpAttr(const OrtOpAttr *op_attr, OrtOpAttrType type, void *data, size_t len, size_t *out)
OrtStatus * DisablePerSessionThreads(OrtSessionOptions *options)
Use global thread pool on a session.
OrtStatus * SetDimensions(OrtTensorTypeAndShapeInfo *info, const int64_t *dim_values, size_t dim_count)
Set shape information in OrtTensorTypeAndShapeInfo.
OrtStatus * SetInterOpNumThreads(OrtSessionOptions *options, int inter_op_num_threads)
Sets the number of threads used to parallelize the execution of the graph.
OrtStatus * CustomOpDomain_Add(OrtCustomOpDomain *custom_op_domain, const OrtCustomOp *op)
Add a custom op to a custom op domain.
OrtStatus * GetSequenceElementType(const OrtSequenceTypeInfo *sequence_type_info, OrtTypeInfo **type_info)
Get element type from an OrtSequenceTypeInfo.
OrtStatus * RunOptionsGetRunLogVerbosityLevel(const OrtRunOptions *options, int *log_verbosity_level)
Get per-run log verbosity level.
OrtStatus * FillSparseTensorCsr(OrtValue *ort_value, const OrtMemoryInfo *data_mem_info, const int64_t *values_shape, size_t values_shape_len, const void *values, const int64_t *inner_indices_data, size_t inner_indices_num, const int64_t *outer_indices_data, size_t outer_indices_num)
OrtStatus * CreateAndRegisterAllocator(OrtEnv *env, const OrtMemoryInfo *mem_info, const OrtArenaCfg *arena_cfg)
Create an allocator and register it with the OrtEnv.
OrtStatus * CreateCpuMemoryInfo(enum OrtAllocatorType type, enum OrtMemType mem_type, OrtMemoryInfo **out)
Create an OrtMemoryInfo for CPU memory.
OrtStatus * AddCustomOpDomain(OrtSessionOptions *options, OrtCustomOpDomain *custom_op_domain)
Add custom op domain to a session options.
OrtStatus * KernelInfo_GetOutputTypeInfo(const OrtKernelInfo *info, size_t index, OrtTypeInfo **type_info)
Get the type information for a OrtKernelInfo's output.
OrtStatus * KernelContext_GetInput(const OrtKernelContext *context, size_t index, const OrtValue **out)
Used for custom operators, get an input of a kernel.
OrtStatus * CreateEnvWithCustomLoggerAndGlobalThreadPools(OrtLoggingFunction logging_function, void *logger_param, OrtLoggingLevel log_severity_level, const char *logid, const struct OrtThreadingOptions *tp_options, OrtEnv **out)
uint32_t(* HardwareDevice_VendorId)(const OrtHardwareDevice *device)
Get the hardware device's vendor identifier.
Definition onnxruntime_c_api.h:5219
OrtStatus * DisableTelemetryEvents(const OrtEnv *env)
Disable Telemetry.
OrtStatus * KernelInfo_GetOutputCount(const OrtKernelInfo *info, size_t *out)
Get the number of outputs from OrtKernelInfo.
OrtStatus * CreateTensorWithDataAndDeleterAsOrtValue(OrtAllocator *deleter, void *p_data, size_t p_data_len, const int64_t *shape, size_t shape_len, ONNXTensorElementDataType type, OrtValue **out)
Create an OrtValue for a Tensor that uses pre-existing memory.
OrtStatus * ShapeInferContext_GetInputCount(const OrtShapeInferContext *context, size_t *out)
OrtStatus * ModelMetadataGetGraphName(const OrtModelMetadata *model_metadata, OrtAllocator *allocator, char **value)
Get graph name from an OrtModelMetadata.
OrtStatus * CreateROCMProviderOptions(OrtROCMProviderOptions **out)
Create an OrtROCMProviderOptions.
OrtStatus * ModelMetadataLookupCustomMetadataMap(const OrtModelMetadata *model_metadata, OrtAllocator *allocator, const char *key, char **value)
Return data for a key in the custom metadata map in an OrtModelMetadata.
OrtStatus * RegisterExecutionProviderLibrary(OrtEnv *env, const char *registration_name, const char *path)
Register an execution provider library with ORT.
OrtStatus * RunOptionsSetRunLogSeverityLevel(OrtRunOptions *options, int log_severity_level)
Set per-run log severity level.
OrtStatus * GetCUDAProviderOptionsByName(const OrtCUDAProviderOptionsV2 *cuda_options, const char *key, void **ptr)
OrtStatus * SessionOptionsSetLoadCancellationFlag(OrtSessionOptions *options, bool cancel)
sets load cancellation flag to abort session loading process.
OrtStatus * SetSessionExecutionMode(OrtSessionOptions *options, ExecutionMode execution_mode)
Set execution mode.
OrtStatus * SessionGetInputName(const OrtSession *session, size_t index, OrtAllocator *allocator, char **value)
Get input name.
OrtStatus * CreateLoraAdapter(const char *adapter_file_path, OrtAllocator *allocator, OrtLoraAdapter **out)
Create an OrtLoraAdapter.
OrtStatus * GetDnnlProviderOptionsAsString(const OrtDnnlProviderOptions *dnnl_options, OrtAllocator *allocator, char **ptr)
void(* AddKeyValuePair)(OrtKeyValuePairs *kvps, const char *key, const char *value)
Add a key-value pair to the OrtKeyValuePairs instance.
Definition onnxruntime_c_api.h:5060
OrtStatus * CreateRunOptions(OrtRunOptions **out)
Create an OrtRunOptions.
OrtStatus * RunOptionsGetRunTag(const OrtRunOptions *options, const char **run_tag)
Get per-run tag.
OrtStatus * CreateCustomOpDomain(const char *domain, OrtCustomOpDomain **out)
Create a custom op domain.
OrtStatus * ModelMetadataGetCustomMetadataMapKeys(const OrtModelMetadata *model_metadata, OrtAllocator *allocator, char ***keys, int64_t *num_keys)
const char *(* GetErrorMessage)(const OrtStatus *status) __attribute__((nonnull))
Get error string from OrtStatus.
Definition onnxruntime_c_api.h:870
OrtStatus * IsTensor(const OrtValue *value, int *out)
Return if an OrtValue is a tensor type.
OrtStatus * AllocatorFree(OrtAllocator *ort_allocator, void *p)
Calls OrtAllocator::Free function.
OrtStatus * GetMapValueType(const OrtMapTypeInfo *map_type_info, OrtTypeInfo **type_info)
Get the value type from an OrtMapTypeInfo.
OrtStatus * CreateSessionFromArray(const OrtEnv *env, const void *model_data, size_t model_data_length, const OrtSessionOptions *options, OrtSession **out)
Create an OrtSession from memory.
OrtStatus * CreateArenaCfgV2(const char *const *arena_config_keys, const size_t *arena_config_values, size_t num_keys, OrtArenaCfg **out)
Create an OrtArenaCfg.
OrtStatus * GetAllocatorWithDefaultOptions(OrtAllocator **out)
Get the default allocator.
OrtStatus * CreateSession(const OrtEnv *env, const char *model_path, const OrtSessionOptions *options, OrtSession **out)
Create an OrtSession from a model file.
OrtStatus * SessionOptionsAppendExecutionProvider_Dnnl(OrtSessionOptions *options, const OrtDnnlProviderOptions *dnnl_options)
Append dnnl provider to session options.
OrtStatus * CreateArenaCfg(size_t max_mem, int arena_extend_strategy, int initial_chunk_size_bytes, int max_dead_bytes_per_chunk, OrtArenaCfg **out)
OrtStatus * SessionGetInputCount(const OrtSession *session, size_t *out)
Get input count for a session.
const char *(* GetKeyValue)(const OrtKeyValuePairs *kvps, const char *key)
Get the value associated with a key in the OrtKeyValuePairs instance.
Definition onnxruntime_c_api.h:5071
OrtStatus * GetValue(const OrtValue *value, int index, OrtAllocator *allocator, OrtValue **out)
Get non tensor data from an OrtValue.
OrtStatus * ShapeInferContext_GetAttribute(const OrtShapeInferContext *context, const char *attr_name, const OrtOpAttr **attr)
OrtStatus * GetSparseTensorIndices(const OrtValue *ort_value, enum OrtSparseIndicesFormat indices_format, size_t *num_indices, const void **indices)
Returns indices data for the type of the indices specified by indices_format.
const char *(* EpDevice_EpName)(const OrtEpDevice *ep_device)
Get the execution provider name.
Definition onnxruntime_c_api.h:5257
OrtStatus * EnableProfiling(OrtSessionOptions *options, const char *profile_file_prefix)
Enable profiling for a session.
uint32_t(* HardwareDevice_DeviceId)(const OrtHardwareDevice *device)
Get the hardware device's unique identifier.
Definition onnxruntime_c_api.h:5238
OrtStatus * SetUserLoggingFunction(OrtSessionOptions *options, OrtLoggingFunction user_logging_function, void *user_logging_param)
Set user logging function.
OrtStatus * GetStringTensorElement(const OrtValue *value, size_t s_len, size_t index, void *s)
Get a single string from a string tensor.
OrtStatus * GetTensorTypeAndShape(const OrtValue *value, OrtTensorTypeAndShapeInfo **out)
Get type and shape information from a tensor OrtValue.
OrtStatus * BindInput(OrtIoBinding *binding_ptr, const char *name, const OrtValue *val_ptr)
Bind an OrtValue to an OrtIoBinding input.
const OrtKeyValuePairs *(* EpDevice_EpMetadata)(const OrtEpDevice *ep_device)
Get the metadata for the OrtEpDevice.
Definition onnxruntime_c_api.h:5275
OrtStatus * GetResizedStringTensorElementBuffer(OrtValue *value, size_t index, size_t length_in_bytes, char **buffer)
Set a single string in a string tensor Do not zero terminate the string data.
OrtStatus * DisableCpuMemArena(OrtSessionOptions *options)
Disable the memory arena on CPU.
void(* ClearBoundOutputs)(OrtIoBinding *binding_ptr) __attribute__((nonnull))
Clears any previously set Outputs for an OrtIoBinding.
Definition onnxruntime_c_api.h:2542
OrtStatus * SetSymbolicDimensions(OrtTensorTypeAndShapeInfo *info, const char *dim_params[], size_t dim_params_length)
OrtStatus * SessionOptionsAppendExecutionProvider_CANN(OrtSessionOptions *options, const OrtCANNProviderOptions *cann_options)
Append CANN provider to session options.
OrtStatus * MemoryInfoGetMemType(const OrtMemoryInfo *ptr, OrtMemType *out)
Get the OrtMemType from OrtMemoryInfo.
OrtStatus * AllocatorGetInfo(const OrtAllocator *ort_allocator, const struct OrtMemoryInfo **out)
Calls OrtAllocator::Info function.
OrtStatus * CompareMemoryInfo(const OrtMemoryInfo *info1, const OrtMemoryInfo *info2, int *out)
Compare OrtMemoryInfo objects for equality.
OrtStatus * GetAvailableProviders(char ***out_ptr, int *provider_length)
Get the names of all available providers.
OrtStatus * SynchronizeBoundInputs(OrtIoBinding *binding_ptr)
Synchronize bound inputs. The call may be necessary for some providers, such as cuda,...
OrtStatus * GetOpaqueValue(const char *domain_name, const char *type_name, const OrtValue *in, void *data_container, size_t data_container_size)
Get internal data from an opaque (custom user defined type) OrtValue.
OrtStatus * AllocatorAlloc(OrtAllocator *ort_allocator, size_t size, void **out)
Calls OrtAllocator::Alloc function.
OrtStatus * RunAsync(OrtSession *session, const OrtRunOptions *run_options, const char *const *input_names, const OrtValue *const *input, size_t input_len, const char *const *output_names, size_t output_names_len, OrtValue **output, RunAsyncCallbackFn run_async_callback, void *user_data)
Run the model asynchronously in a thread owned by intra op thread pool.
OrtStatus * GetTensorRTProviderOptionsByName(const OrtTensorRTProviderOptionsV2 *tensorrt_options, const char *key, void **ptr)
OrtStatus * RegisterCustomOpsLibrary_V2(OrtSessionOptions *options, const char *library_name)
Register custom ops from a shared library.
OrtStatus * SessionGetOverridableInitializerName(const OrtSession *session, size_t index, OrtAllocator *allocator, char **value)
Get overridable initializer name.
OrtStatus * GetROCMProviderOptionsAsString(const OrtROCMProviderOptions *rocm_options, OrtAllocator *allocator, char **ptr)
OrtStatus * UnregisterAllocator(OrtEnv *env, const OrtMemoryInfo *mem_info)
Unregister a custom allocator.
OrtStatus * DisableMemPattern(OrtSessionOptions *options)
Disable the memory pattern optimization.
OrtStatus * UseBlockSparseIndices(OrtValue *ort_value, const int64_t *indices_shape, size_t indices_shape_len, int32_t *indices_data)
OrtStatus * SetEpDynamicOptions(OrtSession *sess, const char *const *keys, const char *const *values, size_t kv_len)
Set DynamicOptions for EPs (Execution Providers)
void(* CreateKeyValuePairs)(OrtKeyValuePairs **out)
Create an OrtKeyValuePairs instance.
Definition onnxruntime_c_api.h:5047
OrtStatus *(* CreateStatus)(OrtErrorCode code, const char *msg) __attribute__((nonnull))
Create an OrtStatus from a null terminated string.
Definition onnxruntime_c_api.h:856
OrtStatus * RunWithBinding(OrtSession *session, const OrtRunOptions *run_options, const OrtIoBinding *binding_ptr)
Run a model using Io Bindings for the inputs & outputs.
OrtStatus * CreateDnnlProviderOptions(OrtDnnlProviderOptions **out)
Create an OrtDnnlProviderOptions.
OrtStatus * GetMapKeyType(const OrtMapTypeInfo *map_type_info, enum ONNXTensorElementDataType *out)
Get key type from an OrtMapTypeInfo.
OrtStatus * RunOptionsGetRunLogSeverityLevel(const OrtRunOptions *options, int *log_severity_level)
Get per-run log severity level.
OrtStatus * CastTypeInfoToOptionalTypeInfo(const OrtTypeInfo *type_info, const OrtOptionalTypeInfo **out)
Get Optional Type information from an OrtTypeInfo.
OrtStatus * SessionGetModelMetadata(const OrtSession *session, OrtModelMetadata **out)
Get OrtModelMetadata from an OrtSession.
OrtStatus * GetCurrentGpuDeviceId(int *device_id)
Get current GPU device ID.
OrtStatus * SessionGetOutputTypeInfo(const OrtSession *session, size_t index, OrtTypeInfo **type_info)
Get output type information.
OrtStatus * KernelContext_GetScratchBuffer(const OrtKernelContext *context, const OrtMemoryInfo *mem_info, size_t count_or_bytes, void **out)
Get scratch buffer from the corresponding allocator under the specific OrtMemoryInfo object....
OrtStatus * EnableOrtCustomOps(OrtSessionOptions *options)
Enable custom operators.
OrtStatus * UpdateEnvWithCustomLogLevel(OrtEnv *ort_env, OrtLoggingLevel log_severity_level)
OrtStatus * CreateValue(const OrtValue *const *in, size_t num_values, enum ONNXType value_type, OrtValue **out)
Create a map or sequence OrtValue.
OrtStatus * SessionOptionsAppendExecutionProvider_VitisAI(OrtSessionOptions *options, const char *const *provider_options_keys, const char *const *provider_options_values, size_t num_keys)
Append VitisAI provider to session options.
OrtStatus * RegisterCustomOpsUsingFunction(OrtSessionOptions *options, const char *registration_func_name)
Register custom ops by calling a RegisterCustomOpsFn function.
OrtStatus * RunOptionsSetTerminate(OrtRunOptions *options)
Set terminate flag.
OrtStatus * SetSessionLogVerbosityLevel(OrtSessionOptions *options, int session_log_verbosity_level)
Set session log verbosity level.
OrtStatus * SetSessionLogSeverityLevel(OrtSessionOptions *options, int session_log_severity_level)
Set session log severity level.
OrtStatus * CreateThreadingOptions(OrtThreadingOptions **out)
Create an OrtThreadingOptions.
OrtStatus * UseCsrIndices(OrtValue *ort_value, int64_t *inner_data, size_t inner_num, int64_t *outer_data, size_t outer_num)
OrtStatus * SessionGetOverridableInitializerCount(const OrtSession *session, size_t *out)
Get overridable initializer count.
OrtStatus * GetValueInfoName(const OrtValueInfo *value_info, const char **name)
Get the value name from an OrtValueInfo instance.
OrtStatus * UnregisterExecutionProviderLibrary(OrtEnv *env, const char *registration_name)
Unregister an execution provider library with ORT.
OrtStatus * CreateSessionWithPrepackedWeightsContainer(const OrtEnv *env, const char *model_path, const OrtSessionOptions *options, OrtPrepackedWeightsContainer *prepacked_weights_container, OrtSession **out)
Create session with prepacked weights container.
OrtStatus * KernelInfo_GetLogger(const OrtKernelInfo *info, const OrtLogger **logger)
Get the session logger from OrtKernelInfo.
OrtStatus * UpdateTensorRTProviderOptions(OrtTensorRTProviderOptionsV2 *tensorrt_options, const char *const *provider_options_keys, const char *const *provider_options_values, size_t num_keys)
Set options in a TensorRT Execution Provider.
OrtStatus * KernelInfoGetAttribute_tensor(const OrtKernelInfo *info, const char *name, OrtAllocator *allocator, OrtValue **out)
Get a OrtValue tensor stored as an attribute in the graph node.
OrtStatus * EnableMemPattern(OrtSessionOptions *options)
Enable the memory pattern optimization.
OrtStatus * SetOptimizedModelFilePath(OrtSessionOptions *options, const char *optimized_model_filepath)
Set filepath to save optimized model after graph level transformations.
const OrtKeyValuePairs *(* EpDevice_EpOptions)(const OrtEpDevice *ep_device)
Get the execution provider options for the OrtEpDevice.
Definition onnxruntime_c_api.h:5284
OrtStatus * CreateAllocator(const OrtSession *session, const OrtMemoryInfo *mem_info, OrtAllocator **out)
Create an allocator for an OrtSession following an OrtMemoryInfo.
OrtStatus * SynchronizeBoundOutputs(OrtIoBinding *binding_ptr)
Synchronize bound outputs. The call may be necessary for some providers, such as cuda,...
OrtStatus * SessionGetOutputCount(const OrtSession *session, size_t *out)
Get output count for a session.
OrtStatus * CastTypeInfoToSequenceTypeInfo(const OrtTypeInfo *type_info, const OrtSequenceTypeInfo **out)
Cast OrtTypeInfo to an OrtSequenceTypeInfo.
OrtStatus * Run(OrtSession *session, const OrtRunOptions *run_options, const char *const *input_names, const OrtValue *const *inputs, size_t input_len, const char *const *output_names, size_t output_names_len, OrtValue **outputs)
Run the model in an OrtSession.
OrtStatus * GetValueType(const OrtValue *value, enum ONNXType *out)
Get ONNXType of an OrtValue.
OrtStatus * ShapeInferContext_GetInputTypeShape(const OrtShapeInferContext *context, size_t index, OrtTensorTypeAndShapeInfo **info)
OrtStatus * KernelInfo_GetNodeName(const OrtKernelInfo *info, char *out, size_t *size)
Get the graph node name from OrtKernelInfo.
OrtStatus * CreateTensorRTProviderOptions(OrtTensorRTProviderOptionsV2 **out)
Create an OrtTensorRTProviderOptionsV2.
OrtStatus * GetDimensions(const OrtTensorTypeAndShapeInfo *info, int64_t *dim_values, size_t dim_values_length)
Get dimensions in OrtTensorTypeAndShapeInfo.
OrtStatus * SessionGetProfilingStartTimeNs(const OrtSession *session, uint64_t *out)
Return the time that profiling was started.
OrtStatus * RunOptionsUnsetTerminate(OrtRunOptions *options)
Clears the terminate flag.
OrtStatus * CreateOpaqueValue(const char *domain_name, const char *type_name, const void *data_container, size_t data_container_size, OrtValue **out)
Create an opaque (custom user defined type) OrtValue.
OrtStatus * GetSparseTensorValuesTypeAndShape(const OrtValue *ort_value, OrtTensorTypeAndShapeInfo **out)
Returns data type and shape of sparse tensor values (nnz) iff OrtValue contains a SparseTensor.
void(* ReleaseTensorRTProviderOptions)(OrtTensorRTProviderOptionsV2 *input)
Release an OrtTensorRTProviderOptionsV2.
Definition onnxruntime_c_api.h:3099
OrtStatus * ReleaseAvailableProviders(char **ptr, int providers_length)
Release data from OrtApi::GetAvailableProviders. This API will never fail so you can rely on it in a ...
OrtStatus * RunOptionsSetRunTag(OrtRunOptions *options, const char *run_tag)
Set per-run tag.
OrtStatus * CreateIoBinding(OrtSession *session, OrtIoBinding **out)
Create an OrtIoBinding instance.
OrtStatus * SetGlobalIntraOpNumThreads(OrtThreadingOptions *tp_options, int intra_op_num_threads)
Set global intra-op thread count.
OrtStatus * CreateOpAttr(const char *name, const void *data, int len, OrtOpAttrType type, OrtOpAttr **op_attr)
: Create attribute of onnxruntime operator
const char *(* EpDevice_EpVendor)(const OrtEpDevice *ep_device)
Get the execution provider's vendor name.
Definition onnxruntime_c_api.h:5266
OrtStatus * FillSparseTensorBlockSparse(OrtValue *ort_value, const OrtMemoryInfo *data_mem_info, const int64_t *values_shape, size_t values_shape_len, const void *values, const int64_t *indices_shape_data, size_t indices_shape_len, const int32_t *indices_data)
const OrtKeyValuePairs *(* HardwareDevice_Metadata)(const OrtHardwareDevice *device)
Get hardware device metadata.
Definition onnxruntime_c_api.h:5248
OrtStatus * ModelMetadataGetVersion(const OrtModelMetadata *model_metadata, int64_t *value)
Get version number from an OrtModelMetadata.
OrtStatus * GetStringTensorContent(const OrtValue *value, void *s, size_t s_len, size_t *offsets, size_t offsets_len)
Get all strings from a string tensor.
OrtStatus * GetBoundOutputNames(const OrtIoBinding *binding_ptr, OrtAllocator *allocator, char **buffer, size_t **lengths, size_t *count)
Get the names of an OrtIoBinding's outputs.
OrtStatus * CreateTensorTypeAndShapeInfo(OrtTensorTypeAndShapeInfo **out)
Create an OrtTensorTypeAndShapeInfo object.
OrtStatus * FillSparseTensorCoo(OrtValue *ort_value, const OrtMemoryInfo *data_mem_info, const int64_t *values_shape, size_t values_shape_len, const void *values, const int64_t *indices_data, size_t indices_num)
OrtStatus * SessionEndProfiling(OrtSession *session, OrtAllocator *allocator, char **out)
End profiling and return filename of the profile data.
OrtStatus * ModelMetadataGetProducerName(const OrtModelMetadata *model_metadata, OrtAllocator *allocator, char **value)
Get producer name from an OrtModelMetadata.
OrtStatus * SessionOptionsSetCustomCreateThreadFn(OrtSessionOptions *options, OrtCustomCreateThreadFn ort_custom_create_thread_fn)
Set custom thread creation function.
OrtStatus * SetGlobalCustomCreateThreadFn(OrtThreadingOptions *tp_options, OrtCustomCreateThreadFn ort_custom_create_thread_fn)
Set custom thread creation function for global thread pools.
OrtStatus * SessionOptionsAppendExecutionProvider_CUDA_V2(OrtSessionOptions *options, const OrtCUDAProviderOptionsV2 *cuda_options)
Append CUDA execution provider to the session options.
OrtStatus * CreateTensorAsOrtValue(OrtAllocator *allocator, const int64_t *shape, size_t shape_len, ONNXTensorElementDataType type, OrtValue **out)
Create a tensor.
void(* RemoveKeyValuePair)(OrtKeyValuePairs *kvps, const char *key)
Remove a key-value pair from the OrtKeyValuePairs instance.
Definition onnxruntime_c_api.h:5093
void(* ReleaseCUDAProviderOptions)(OrtCUDAProviderOptionsV2 *input)
Release an OrtCUDAProviderOptionsV2.
Definition onnxruntime_c_api.h:3602
OrtStatus * RunOptionsAddActiveLoraAdapter(OrtRunOptions *options, const OrtLoraAdapter *adapter)
Add the Lora Adapter to the list of active adapters.
OrtStatus * KernelInfoGetAttribute_int64(const OrtKernelInfo *info, const char *name, int64_t *out)
Fetch a 64-bit int stored as an attribute in the graph node.
OrtErrorCode(* GetErrorCode)(const OrtStatus *status) __attribute__((nonnull))
Get OrtErrorCode from OrtStatus.
Definition onnxruntime_c_api.h:863
OrtStatus * SetTensorElementType(OrtTensorTypeAndShapeInfo *info, enum ONNXTensorElementDataType type)
Set element type in OrtTensorTypeAndShapeInfo.
OrtStatus * BindOutput(OrtIoBinding *binding_ptr, const char *name, const OrtValue *val_ptr)
Bind an OrtValue to an OrtIoBinding output.
OrtStatus * GetSparseTensorValues(const OrtValue *ort_value, const void **out)
Returns numeric data for sparse tensor values (nnz). For string values use GetStringTensor*().
CUDA Provider Options.
Definition onnxruntime_c_api.h:489
int tunable_op_max_tuning_duration_ms
Max tuning duration time limit for each instance of TunableOp. Defaults to 0 to disable the limit.
Definition onnxruntime_c_api.h:568
int has_user_compute_stream
Flag indicating if there is a user provided compute stream Defaults to 0.
Definition onnxruntime_c_api.h:542
int do_copy_in_default_stream
Flag indicating if copying needs to take place on the same stream as the compute stream in the CUDA E...
Definition onnxruntime_c_api.h:537
void * user_compute_stream
User provided compute stream. If provided, please set has_user_compute_stream to 1.
Definition onnxruntime_c_api.h:547
int tunable_op_enable
Enable TunableOp for using. Set it to 1/0 to enable/disable TunableOp. Otherwise, it is disabled by d...
Definition onnxruntime_c_api.h:557
size_t gpu_mem_limit
CUDA memory limit (To use all possible memory pass in maximum size_t) Defaults to SIZE_MAX.
Definition onnxruntime_c_api.h:520
int arena_extend_strategy
Strategy used to grow the memory arena 0 = kNextPowerOfTwo 1 = kSameAsRequested Defaults to 0.
Definition onnxruntime_c_api.h:528
OrtCUDAProviderOptions()
Definition onnxruntime_c_api.h:491
OrtArenaCfg * default_memory_arena_cfg
CUDA memory arena configuration parameters.
Definition onnxruntime_c_api.h:551
int tunable_op_tuning_enable
Enable TunableOp for tuning. Set it to 1/0 to enable/disable TunableOp tuning. Otherwise,...
Definition onnxruntime_c_api.h:563
OrtCudnnConvAlgoSearch cudnn_conv_algo_search
CUDA Convolution algorithm search configuration. See enum OrtCudnnConvAlgoSearch for more details....
Definition onnxruntime_c_api.h:514
int device_id
CUDA device Id Defaults to 0.
Definition onnxruntime_c_api.h:508
The OrtCompileApi struct provides functions to compile ONNX models.
Definition onnxruntime_c_api.h:5885
OrtStatus * ModelCompilationOptions_SetOutputModelBuffer(OrtModelCompilationOptions *model_compile_options, OrtAllocator *allocator, void **output_model_buffer_ptr, size_t *output_model_buffer_size_ptr)
Configures model compilation to store the output compiled ONNX model in a buffer.
OrtStatus * ModelCompilationOptions_SetInputModelFromBuffer(OrtModelCompilationOptions *model_compile_options, const void *input_model_data, size_t input_model_data_size)
Sets the buffer that stores the bytes of the loaded ONNX model to compile.
OrtStatus * ModelCompilationOptions_SetInputModelPath(OrtModelCompilationOptions *model_compile_options, const char *input_model_path)
Sets the file path to the input ONNX model to compile.
OrtStatus * ModelCompilationOptions_SetOutputModelExternalInitializersFile(OrtModelCompilationOptions *model_compile_options, const char *external_initializers_file_path, size_t external_initializers_size_threshold)
Optionally sets the file that should store external initializers for the compiled ONNX model....
OrtStatus * CreateModelCompilationOptionsFromSessionOptions(const OrtEnv *env, const OrtSessionOptions *session_options, OrtModelCompilationOptions **out)
Creates an OrtModelCompilationOptions object from an existing OrtSessionOptions object.
OrtStatus * ModelCompilationOptions_SetFlags(OrtModelCompilationOptions *model_compile_options, size_t flags)
Sets flags from OrtCompileApiFlags that represent one or more boolean options to enable.
OrtStatus * ModelCompilationOptions_SetEpContextEmbedMode(OrtModelCompilationOptions *model_compile_options, bool embed_ep_context_in_model)
Enables or disables the embedding of EPContext binary data into the ep_cache_context attribute of EPC...
OrtStatus * ModelCompilationOptions_SetOutputModelPath(OrtModelCompilationOptions *model_compile_options, const char *output_model_path)
Sets the file path for the output ONNX model generated by CompileModel.
OrtStatus * CompileModel(const OrtEnv *env, const OrtModelCompilationOptions *model_options)
Compiles an input ONNX model with the given compilation options.
Definition onnxruntime_c_api.h:809
char __place_holder
Definition onnxruntime_c_api.h:810
Definition onnxruntime_c_api.h:5358
int(* GetVariadicInputHomogeneity)(const struct OrtCustomOp *op)
Definition onnxruntime_c_api.h:5404
OrtCustomOpInputOutputCharacteristic(* GetOutputCharacteristic)(const struct OrtCustomOp *op, size_t index)
Definition onnxruntime_c_api.h:5388
size_t(* GetInputTypeCount)(const struct OrtCustomOp *op)
Definition onnxruntime_c_api.h:5376
int(* GetVariadicOutputMinArity)(const struct OrtCustomOp *op)
Definition onnxruntime_c_api.h:5408
size_t(* GetAliasMap)(int **input_index, int **output_index)
Definition onnxruntime_c_api.h:5441
int(* GetStartVersion)(const struct OrtCustomOp *op)
Definition onnxruntime_c_api.h:5426
void(* ReleaseMayInplace)(int *input_index, int *output_index)
Definition onnxruntime_c_api.h:5438
const char *(* GetName)(const struct OrtCustomOp *op)
Definition onnxruntime_c_api.h:5369
size_t(* GetOutputTypeCount)(const struct OrtCustomOp *op)
Definition onnxruntime_c_api.h:5378
void(* KernelDestroy)(void *op_kernel)
Definition onnxruntime_c_api.h:5384
int(* GetVariadicOutputHomogeneity)(const struct OrtCustomOp *op)
Definition onnxruntime_c_api.h:5413
OrtMemType(* GetInputMemoryType)(const struct OrtCustomOp *op, size_t index)
Definition onnxruntime_c_api.h:5395
void *(* CreateKernel)(const struct OrtCustomOp *op, const OrtApi *api, const OrtKernelInfo *info)
Definition onnxruntime_c_api.h:5365
uint32_t version
Definition onnxruntime_c_api.h:5359
ONNXTensorElementDataType(* GetInputType)(const struct OrtCustomOp *op, size_t index)
Definition onnxruntime_c_api.h:5375
void(* ReleaseAliasMap)(int *input_index, int *output_index)
Definition onnxruntime_c_api.h:5442
OrtCustomOpInputOutputCharacteristic(* GetInputCharacteristic)(const struct OrtCustomOp *op, size_t index)
Definition onnxruntime_c_api.h:5387
const char *(* GetExecutionProviderType)(const struct OrtCustomOp *op)
Definition onnxruntime_c_api.h:5372
ONNXTensorElementDataType(* GetOutputType)(const struct OrtCustomOp *op, size_t index)
Definition onnxruntime_c_api.h:5377
int(* GetVariadicInputMinArity)(const struct OrtCustomOp *op)
Definition onnxruntime_c_api.h:5399
OrtStatusPtr(* InferOutputShapeFn)(const struct OrtCustomOp *op, OrtShapeInferContext *)
Definition onnxruntime_c_api.h:5423
int(* GetEndVersion)(const struct OrtCustomOp *op)
Definition onnxruntime_c_api.h:5427
OrtStatusPtr(* CreateKernelV2)(const struct OrtCustomOp *op, const OrtApi *api, const OrtKernelInfo *info, void **kernel)
Definition onnxruntime_c_api.h:5416
size_t(* GetMayInplace)(int **input_index, int **output_index)
Definition onnxruntime_c_api.h:5434
OrtStatusPtr(* KernelComputeV2)(void *op_kernel, OrtKernelContext *context)
Definition onnxruntime_c_api.h:5421
void(* KernelCompute)(void *op_kernel, OrtKernelContext *context)
Definition onnxruntime_c_api.h:5383
Definition onnxruntime_c_api.h:6061
OrtStatus * CreateEpDevice(OrtEpFactory *ep_factory, const OrtHardwareDevice *hardware_device, const OrtKeyValuePairs *ep_metadata, const OrtKeyValuePairs *ep_options, OrtEpDevice **ep_device)
Create an OrtEpDevice for the EP and an OrtHardwareDevice.
The OrtEpFactory provides functions to create and manage execution providers.
Definition onnxruntime_c_api.h:6157
const char *(* GetVendor)(const OrtEpFactory *this_ptr)
Get the name of vendor who owns the execution provider that the factory creates.
Definition onnxruntime_c_api.h:6183
OrtStatus *(* CreateEp)(OrtEpFactory *this_ptr, const OrtHardwareDevice *const *devices, const OrtKeyValuePairs *const *ep_metadata_pairs, size_t num_devices, const OrtSessionOptions *session_options, const OrtLogger *logger, OrtEp **ep)
Function to create an OrtEp instance for use in a Session.
Definition onnxruntime_c_api.h:6233
OrtStatus *(* GetSupportedDevices)(OrtEpFactory *this_ptr, const OrtHardwareDevice *const *devices, size_t num_devices, OrtEpDevice **ep_devices, size_t max_ep_devices, size_t *num_ep_devices)
Get information from the execution provider if it supports the OrtHardwareDevice.
Definition onnxruntime_c_api.h:6204
uint32_t ort_version_supported
The ONNX Runtime version the execution provider was compiled with.
Definition onnxruntime_c_api.h:6165
void(* ReleaseEp)(OrtEpFactory *this_ptr, struct OrtEp *ep)
Release the OrtEp instance.
Definition onnxruntime_c_api.h:6247
const char *(* GetName)(const OrtEpFactory *this_ptr)
Get the name the of the execution provider that the factory creates.
Definition onnxruntime_c_api.h:6174
The OrtEp struct provides functions to implement for an execution provider.
Definition onnxruntime_c_api.h:6088
const char *(* GetName)(const OrtEp *this_ptr)
Get the execution provider name.
Definition onnxruntime_c_api.h:6107
uint32_t ort_version_supported
The ONNX Runtime version the execution provider was compiled with.
Definition onnxruntime_c_api.h:6096
MIGraphX Provider Options.
Definition onnxruntime_c_api.h:693
bool migraphx_exhaustive_tune
Definition onnxruntime_c_api.h:704
int migraphx_save_compiled_model
Definition onnxruntime_c_api.h:700
int migraphx_fp8_enable
Definition onnxruntime_c_api.h:696
int migraphx_int8_enable
Definition onnxruntime_c_api.h:697
int migraphx_load_compiled_model
Definition onnxruntime_c_api.h:702
int migraphx_fp16_enable
Definition onnxruntime_c_api.h:695
int device_id
Definition onnxruntime_c_api.h:694
int migraphx_use_native_calibration_table
Definition onnxruntime_c_api.h:698
size_t migraphx_mem_limit
MIGraphX memory limit (To use all possible memory pass in maximum size_t) Defaults to SIZE_MAX.
Definition onnxruntime_c_api.h:710
const char * migraphx_load_model_path
Definition onnxruntime_c_api.h:703
const char * migraphx_save_model_path
Definition onnxruntime_c_api.h:701
int migraphx_arena_extend_strategy
Strategy used to grow the memory arena 0 = kNextPowerOfTwo 1 = kSameAsRequested Defaults to 0.
Definition onnxruntime_c_api.h:718
const char * migraphx_int8_calibration_table_name
Definition onnxruntime_c_api.h:699
The OrtModelEditorApi struct provides functions to create or edit an ONNX model.
Definition onnxruntime_c_api.h:5456
OrtStatus * CreateModel(const char *const *domain_names, const int *opset_versions, size_t opset_entries_len, OrtModel **model)
Create an OrtModel.
OrtStatus * CreateGraph(OrtGraph **graph)
Create an OrtGraph.
OrtStatus * ApplyModelToModelEditorSession(OrtSession *session, OrtModel *model)
Apply changes to augment the ONNX model in a session created using CreateModelEditorSession[FromArray...
OrtStatus * AddInitializerToGraph(OrtGraph *graph, const char *name, OrtValue *tensor, bool data_is_external)
Add an initializer to the OrtGraph.
OrtStatus * SessionGetOpsetForDomain(const OrtSession *session, const char *domain, int *opset)
Query the session for the opset version of a domain.
OrtStatus * CreateValueInfo(const char *name, const OrtTypeInfo *type_info, OrtValueInfo **value_info)
Create an OrtValueInfo for use as an OrtGraph input or output.
OrtStatus * CreateModelEditorSessionFromArray(const OrtEnv *env, const void *model_data, size_t model_data_length, const OrtSessionOptions *options, OrtSession **out)
Create an OrtSession to augment an existing model.
OrtStatus * CreateSequenceTypeInfo(const OrtTypeInfo *sequence_type, OrtTypeInfo **type_info)
Create an OrtTypeInfo instance for a Sequence.
OrtStatus * CreateOptionalTypeInfo(const OrtTypeInfo *contained_type, OrtTypeInfo **type_info)
Create an OrtTypeInfo instance for an Optional.
OrtStatus * AddGraphToModel(OrtModel *model, OrtGraph *graph)
Add an OrtGraph to an OrtModel.
OrtStatus * FinalizeModelEditorSession(OrtSession *session, const OrtSessionOptions *options, OrtPrepackedWeightsContainer *prepacked_weights_container)
Finalize the Model Editor session that was created using CreateModelEditorSession[FromArray].
OrtStatus * CreateMapTypeInfo(ONNXTensorElementDataType map_key_type, const OrtTypeInfo *map_value_type, OrtTypeInfo **type_info)
Create an OrtTypeInfo instance for a Map.
OrtStatus * CreateSparseTensorTypeInfo(const OrtTensorTypeAndShapeInfo *tensor_info, OrtTypeInfo **type_info)
Create an OrtTypeInfo instance for a SparseTensor.
OrtStatus * CreateNode(const char *operator_name, const char *domain_name, const char *node_name, const char *const *input_names, size_t input_names_len, const char *const *output_names, size_t output_names_len, OrtOpAttr **attributes, size_t attribs_len, OrtNode **node)
Create an OrtNode to add to an OrtGraph.
OrtStatus * CreateModelEditorSession(const OrtEnv *env, const char *model_path, const OrtSessionOptions *options, OrtSession **out)
Create an OrtSession to augment an existing model.
OrtStatus * CreateSessionFromModel(const OrtEnv *env, const OrtModel *model, const OrtSessionOptions *options, OrtSession **out)
Create an OrtSession using the OrtModel.
OrtStatus * SetGraphOutputs(OrtGraph *graph, OrtValueInfo **outputs, size_t outputs_len)
Set the outputs for the OrtGraph.
OrtStatus * CreateTensorTypeInfo(const OrtTensorTypeAndShapeInfo *tensor_info, OrtTypeInfo **type_info)
Create an OrtTypeInfo instance for a Tensor.
OrtStatus * AddNodeToGraph(OrtGraph *graph, OrtNode *node)
Add an OrtNode to an OrtGraph.
OrtStatus * SetGraphInputs(OrtGraph *graph, OrtValueInfo **inputs, size_t inputs_len)
Set the inputs for the OrtGraph.
OpenVINO Provider Options.
Definition onnxruntime_c_api.h:731
unsigned char enable_opencl_throttling
0 = disabled, nonzero = enabled
Definition onnxruntime_c_api.h:752
size_t num_of_threads
0 = Use default number of threads
Definition onnxruntime_c_api.h:749
void * context
Definition onnxruntime_c_api.h:751
const char * cache_dir
Definition onnxruntime_c_api.h:750
const char * device_type
Device type string.
Definition onnxruntime_c_api.h:746
const char * device_id
Definition onnxruntime_c_api.h:748
unsigned char enable_npu_fast_compile
0 = disabled, nonzero = enabled
Definition onnxruntime_c_api.h:747
OrtOpenVINOProviderOptions()
Definition onnxruntime_c_api.h:733
unsigned char enable_dynamic_shapes
0 = disabled, nonzero = enabled
Definition onnxruntime_c_api.h:753
ROCM Provider Options.
Definition onnxruntime_c_api.h:576
int device_id
ROCM device Id Defaults to 0.
Definition onnxruntime_c_api.h:596
int tunable_op_max_tuning_duration_ms
Max tuning duration time limit for each instance of TunableOp. Defaults to 0 to disable the limit.
Definition onnxruntime_c_api.h:657
int do_copy_in_default_stream
Flag indicating if copying needs to take place on the same stream as the compute stream in the ROCM E...
Definition onnxruntime_c_api.h:624
OrtArenaCfg * default_memory_arena_cfg
ROCM memory arena configuration parameters.
Definition onnxruntime_c_api.h:638
size_t gpu_mem_limit
ROCM memory limit (To use all possible memory pass in maximum size_t) Defaults to SIZE_MAX.
Definition onnxruntime_c_api.h:607
OrtROCMProviderOptions()
Definition onnxruntime_c_api.h:578
int enable_hip_graph
Definition onnxruntime_c_api.h:640
int tunable_op_enable
Enable TunableOp for using. Set it to 1/0 to enable/disable TunableOp. Otherwise, it is disabled by d...
Definition onnxruntime_c_api.h:646
void * user_compute_stream
User provided compute stream. If provided, please set has_user_compute_stream to 1.
Definition onnxruntime_c_api.h:634
int arena_extend_strategy
Strategy used to grow the memory arena 0 = kNextPowerOfTwo 1 = kSameAsRequested Defaults to 0.
Definition onnxruntime_c_api.h:615
int tunable_op_tuning_enable
Enable TunableOp for tuning. Set it to 1/0 to enable/disable TunableOp tuning. Otherwise,...
Definition onnxruntime_c_api.h:652
int has_user_compute_stream
Flag indicating if there is a user provided compute stream Defaults to 0.
Definition onnxruntime_c_api.h:629
int miopen_conv_exhaustive_search
ROCM MIOpen Convolution algorithm exhaustive search option. Defaults to 0 (false).
Definition onnxruntime_c_api.h:601
TensorRT Provider Options.
Definition onnxruntime_c_api.h:665
int trt_engine_cache_enable
Definition onnxruntime_c_api.h:679
void * user_compute_stream
Definition onnxruntime_c_api.h:668
int device_id
CUDA device id (0 = default device)
Definition onnxruntime_c_api.h:666
const char * trt_engine_cache_path
Definition onnxruntime_c_api.h:680
int trt_engine_decryption_enable
Definition onnxruntime_c_api.h:681
int trt_max_partition_iterations
Definition onnxruntime_c_api.h:669
size_t trt_max_workspace_size
Definition onnxruntime_c_api.h:671
int trt_dla_enable
Definition onnxruntime_c_api.h:676
const char * trt_int8_calibration_table_name
Definition onnxruntime_c_api.h:674
int has_user_compute_stream
Definition onnxruntime_c_api.h:667
int trt_dla_core
Definition onnxruntime_c_api.h:677
int trt_int8_use_native_calibration_table
Definition onnxruntime_c_api.h:675
int trt_min_subgraph_size
Definition onnxruntime_c_api.h:670
int trt_force_sequential_engine_build
Definition onnxruntime_c_api.h:683
int trt_dump_subgraphs
Definition onnxruntime_c_api.h:678
int trt_fp16_enable
Definition onnxruntime_c_api.h:672
const char * trt_engine_decryption_lib_path
Definition onnxruntime_c_api.h:682
int trt_int8_enable
Definition onnxruntime_c_api.h:673
The Training C API that holds onnxruntime training function pointers.
Definition onnxruntime_training_c_api.h:122