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
37#include "onnxruntime_error_code.h"
38
43#define ORT_API_VERSION 32
44
45#ifdef __cplusplus
46extern "C" {
47#endif
48
50// SAL2 Definitions
51#ifndef _MSC_VER
52#define _In_
53#define _In_z_
54#define _In_opt_
55#define _In_opt_z_
56#define _Out_
57#define _Out_opt_
58#define _Outptr_
59#define _Outptr_opt_
60#define _Inout_
61#define _Inout_opt_
62#define _Frees_ptr_opt_
63#define _Ret_maybenull_
64#define _Ret_notnull_
65#define _Check_return_
66#define _Outptr_result_maybenull_
67#define _Outptr_result_maybenull_z_
68#define _In_reads_(X)
69#define _In_reads_opt_
70#define _Inout_updates_(X)
71#define _Out_writes_(X)
72#define _Out_writes_opt_(X)
73#define _Inout_updates_all_(X)
74#define _Out_writes_bytes_all_(X)
75#define _Out_writes_all_(X)
76#define _Success_(X)
77#define _Outptr_result_buffer_maybenull_(X)
78#define ORT_ALL_ARGS_NONNULL __attribute__((nonnull))
79#else
80#include <specstrings.h>
81#define ORT_ALL_ARGS_NONNULL
82#endif
83
84#ifdef _WIN32
85// Define ORT_DLL_IMPORT if your program is dynamically linked to Ort.
86// dllexport is not used, we use a .def file.
87#ifdef ORT_DLL_IMPORT
88#define ORT_EXPORT __declspec(dllimport)
89#else
90#define ORT_EXPORT
91#endif
92#define ORT_API_CALL __stdcall
93#define ORT_MUST_USE_RESULT
94#define ORTCHAR_T wchar_t
95#else
96// Make symbols visible on non-Windows platforms. The visibility attribute is
97// needed when ORT is built as a shared library without a version script
98// (e.g. when compiled within another project's build system). On non-Apple
99// platforms, the default ORT build uses a generated version script
100// (tools/ci_build/gen_def.py) that exports the needed symbols, so this was
101// previously only enabled for __APPLE__. Expanding to __GNUC__ (GCC/Clang)
102// covers additional embedding scenarios while remaining harmless when a
103// version script is also in use.
104#if defined(__GNUC__)
105#define ORT_EXPORT __attribute__((visibility("default")))
106#else
107#define ORT_EXPORT
108#endif
109#define ORT_API_CALL
110#define ORT_MUST_USE_RESULT __attribute__((warn_unused_result))
111#define ORTCHAR_T char
112#endif
113
116#ifndef ORT_TSTR
117#ifdef _WIN32
118#define ORT_TSTR(X) L##X
119// When X is a macro, L##X is not defined. In this case, we need to use ORT_TSTR_ON_MACRO.
120#define ORT_TSTR_ON_MACRO(X) L"" X
121#else
122#define ORT_TSTR(X) X
123#define ORT_TSTR_ON_MACRO(X) X
124#endif
125#endif
126
127// On Windows, ORT_FILE is a wchar_t version of the __FILE__ macro.
128// Otherwise, ORT_FILE is equivalent to __FILE__.
129#ifndef ORT_FILE
130#define ORT_FILE_INTERNAL(x) ORT_TSTR(x)
131#define ORT_FILE ORT_FILE_INTERNAL(__FILE__)
132#endif
133
134// Any pointer marked with _In_ or _Out_, cannot be NULL.
135
136// Windows users should use unicode paths when possible to bypass the MAX_PATH limitation
137// Every pointer marked with _In_ or _Out_, cannot be NULL. Caller should ensure that.
138// for ReleaseXXX(...) functions, they can accept NULL pointer.
139
140#ifdef __cplusplus
141// For any compiler with C++11 support, MSVC 2015 and greater, or Clang version supporting noexcept.
142// Such complex condition is needed because compilers set __cplusplus value differently.
143#ifndef __has_feature
144#define __has_feature(x) 0
145#endif
146#if ((__cplusplus >= 201103L) || (_MSC_VER >= 1900) || (defined(__has_feature) && __has_feature(cxx_noexcept)))
147#define NO_EXCEPTION noexcept
148#else
149#define NO_EXCEPTION throw()
150#endif
151#else
152#define NO_EXCEPTION
153#endif
154
155// __VA_ARGS__ on Windows and Linux are different
156#define ORT_API(RETURN_TYPE, NAME, ...) RETURN_TYPE ORT_API_CALL NAME(__VA_ARGS__) NO_EXCEPTION
157
158#define ORT_API_T(RETURN_TYPE, NAME, ...) \
159 RETURN_TYPE(ORT_API_CALL* NAME)(__VA_ARGS__) NO_EXCEPTION
160
161#define ORT_API_STATUS(NAME, ...) \
162 _Success_(return == 0) _Check_return_ _Ret_maybenull_ OrtStatusPtr ORT_API_CALL NAME(__VA_ARGS__) \
163 NO_EXCEPTION ORT_MUST_USE_RESULT
164
165// XXX: Unfortunately, SAL annotations are known to not work with function pointers
166#define ORT_API2_STATUS(NAME, ...) \
167 _Check_return_ _Ret_maybenull_ OrtStatusPtr(ORT_API_CALL* NAME)(__VA_ARGS__) NO_EXCEPTION ORT_MUST_USE_RESULT
168
169// Used in *.cc files. Almost as same as ORT_API_STATUS, except without ORT_MUST_USE_RESULT and ORT_EXPORT
170#define ORT_API_STATUS_IMPL(NAME, ...) \
171 _Success_(return == 0) _Check_return_ _Ret_maybenull_ OrtStatusPtr ORT_API_CALL NAME(__VA_ARGS__) NO_EXCEPTION
172
173#define ORT_CLASS_RELEASE(X) void(ORT_API_CALL * Release##X)(_Frees_ptr_opt_ Ort##X * input)
174
175#ifdef __DOXYGEN__
176#undef ORT_API_STATUS
177#define ORT_API_STATUS(NAME, ...) OrtStatus* NAME(__VA_ARGS__)
178#undef ORT_API2_STATUS
179#define ORT_API2_STATUS(NAME, ...) OrtStatus* NAME(__VA_ARGS__)
180#undef ORT_CLASS_RELEASE
181#define ORT_CLASS_RELEASE(X) void Release##X(Ort##X* input)
182#undef NO_EXCEPTION
183#define NO_EXCEPTION
184#endif
196 ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT, // maps to c type float
197 ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT8, // maps to c type uint8_t
198 ONNX_TENSOR_ELEMENT_DATA_TYPE_INT8, // maps to c type int8_t
199 ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT16, // maps to c type uint16_t
200 ONNX_TENSOR_ELEMENT_DATA_TYPE_INT16, // maps to c type int16_t
201 ONNX_TENSOR_ELEMENT_DATA_TYPE_INT32, // maps to c type int32_t
202 ONNX_TENSOR_ELEMENT_DATA_TYPE_INT64, // maps to c type int64_t
203 ONNX_TENSOR_ELEMENT_DATA_TYPE_STRING, // maps to c++ type std::string
206 ONNX_TENSOR_ELEMENT_DATA_TYPE_DOUBLE, // maps to c type double
207 ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT32, // maps to c type uint32_t
208 ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT64, // maps to c type uint64_t
209 ONNX_TENSOR_ELEMENT_DATA_TYPE_COMPLEX64, // complex with float32 real and imaginary components
210 ONNX_TENSOR_ELEMENT_DATA_TYPE_COMPLEX128, // complex with float64 real and imaginary components
211 ONNX_TENSOR_ELEMENT_DATA_TYPE_BFLOAT16, // Non-IEEE floating-point format based on IEEE754 single-precision
212 // float 8 types were introduced in onnx 1.14, see https://onnx.ai/onnx/technical/float8.html
213 ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT8E4M3FN, // Non-IEEE floating-point format based on IEEE754 single-precision
214 ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT8E4M3FNUZ, // Non-IEEE floating-point format based on IEEE754 single-precision
215 ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT8E5M2, // Non-IEEE floating-point format based on IEEE754 single-precision
216 ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT8E5M2FNUZ, // Non-IEEE floating-point format based on IEEE754 single-precision
217 // Int4 types were introduced in ONNX 1.16. See https://onnx.ai/onnx/technical/int4.html
218 ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT4, // maps to a pair of packed uint4 values (size == 1 byte)
219 ONNX_TENSOR_ELEMENT_DATA_TYPE_INT4, // maps to a pair of packed int4 values (size == 1 byte)
220 // Float4 types were introduced in ONNX 1.18. See https://onnx.ai/onnx/technical/float4.html
221 ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT4E2M1, // maps to a pair of packed float4 values (size == 1 byte)
222 // Int2 types were introduced in ONNX 1.20. See https://onnx.ai/onnx/technical/int2.html
223 ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT2, // maps to 4 packed uint2 values (size == 1 byte)
224 ONNX_TENSOR_ELEMENT_DATA_TYPE_INT2, // maps to 4 packed int2 values (size == 1 byte)
225 // Float8E8M0 type introduced in ONNX 1.21. 8-bit float with 8 exponent bits, 0 mantissa bits, no sign bit.
226 ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT8E8M0, // Non-IEEE floating-point format, all values are powers of two
227 // Float6 types introduced in ONNX 1.23.
228 // ORT tensor storage uses one byte per element. TensorProto typed serialization uses int32_data;
229 // TensorProto raw_data uses bit-packed 6-bit values.
233
234// Synced with onnx TypeProto oneof
244
245// These types are synced with internal
246// SparseFormatFlags
253
254// Enum allows to query sparse tensor indices
261
273
285
287#define ORT_RUNTIME_CLASS(X) \
288 struct Ort##X; \
289 typedef struct Ort##X Ort##X
290
295// The actual types defined have an Ort prefix
296ORT_RUNTIME_CLASS(Env);
297ORT_RUNTIME_CLASS(Status); // nullptr for Status* indicates success
298ORT_RUNTIME_CLASS(MemoryInfo);
299ORT_RUNTIME_CLASS(IoBinding);
300ORT_RUNTIME_CLASS(Session); // Don't call ReleaseSession from Dllmain (because session owns a thread pool)
301ORT_RUNTIME_CLASS(Value);
302ORT_RUNTIME_CLASS(RunOptions);
303ORT_RUNTIME_CLASS(TypeInfo);
304ORT_RUNTIME_CLASS(TensorTypeAndShapeInfo);
305ORT_RUNTIME_CLASS(MapTypeInfo);
306ORT_RUNTIME_CLASS(SequenceTypeInfo);
307ORT_RUNTIME_CLASS(OptionalTypeInfo);
308ORT_RUNTIME_CLASS(SessionOptions);
309ORT_RUNTIME_CLASS(CustomOpDomain);
310ORT_RUNTIME_CLASS(ModelMetadata);
311ORT_RUNTIME_CLASS(ThreadPoolParams);
312ORT_RUNTIME_CLASS(ThreadingOptions);
313ORT_RUNTIME_CLASS(ArenaCfg);
314ORT_RUNTIME_CLASS(PrepackedWeightsContainer);
315ORT_RUNTIME_CLASS(TensorRTProviderOptionsV2);
316ORT_RUNTIME_CLASS(NvTensorRtRtxProviderOptions);
317ORT_RUNTIME_CLASS(CUDAProviderOptionsV2);
318ORT_RUNTIME_CLASS(CANNProviderOptions);
319ORT_RUNTIME_CLASS(DnnlProviderOptions);
320ORT_RUNTIME_CLASS(Op);
321ORT_RUNTIME_CLASS(OpAttr);
322ORT_RUNTIME_CLASS(Logger);
323ORT_RUNTIME_CLASS(ShapeInferContext);
324ORT_RUNTIME_CLASS(LoraAdapter);
325ORT_RUNTIME_CLASS(ValueInfo);
326ORT_RUNTIME_CLASS(Node);
327ORT_RUNTIME_CLASS(Graph);
328ORT_RUNTIME_CLASS(Model);
329ORT_RUNTIME_CLASS(ModelCompilationOptions);
330ORT_RUNTIME_CLASS(EpContextConfig);
331ORT_RUNTIME_CLASS(HardwareDevice);
332ORT_RUNTIME_CLASS(EpDevice);
333ORT_RUNTIME_CLASS(KeyValuePairs);
334ORT_RUNTIME_CLASS(SyncStream); // Opaque class to create an onnxruntime::Stream.
335ORT_RUNTIME_CLASS(ExternalInitializerInfo);
336ORT_RUNTIME_CLASS(ExternalResourceImporter); // Capability object for external resource import
337ORT_RUNTIME_CLASS(ExternalMemoryHandle); // EP-imported view of shared external allocation
338ORT_RUNTIME_CLASS(ExternalSemaphoreHandle); // EP-imported view of shared external semaphore
339ORT_RUNTIME_CLASS(DeviceEpIncompatibilityDetails);
340ORT_RUNTIME_CLASS(EpAssignedSubgraph);
341ORT_RUNTIME_CLASS(EpAssignedNode);
342ORT_RUNTIME_CLASS(ModelPackageOptions);
343ORT_RUNTIME_CLASS(ModelPackageContext);
344ORT_RUNTIME_CLASS(ModelPackageComponentContext);
345
346#ifdef _MSC_VER
347typedef _Return_type_success_(return == 0) OrtStatus* OrtStatusPtr;
348#else
350#endif
351
360typedef void(ORT_API_CALL* OrtExperimentalFnPtr)(void);
361
368typedef struct OrtAllocator {
369 uint32_t version;
370
372 void*(ORT_API_CALL* Alloc)(struct OrtAllocator* this_, size_t size);
373
375 void(ORT_API_CALL* Free)(struct OrtAllocator* this_, void* p);
376
378 const struct OrtMemoryInfo*(ORT_API_CALL* Info)(const struct OrtAllocator* this_);
389 void*(ORT_API_CALL* Reserve)(struct OrtAllocator* this_, size_t size);
390
416 ORT_API2_STATUS(GetStats, _In_ const struct OrtAllocator* this_, _Outptr_ OrtKeyValuePairs** out);
417
433 void*(ORT_API_CALL* AllocOnStream)(struct OrtAllocator* this_, size_t size, OrtSyncStream* stream);
434
449 ORT_API2_STATUS(Shrink, _In_ struct OrtAllocator* this_);
451
452typedef void(ORT_API_CALL* OrtLoggingFunction)(
453 void* param, OrtLoggingLevel severity, const char* category, const char* logid, const char* code_location,
454 const char* message);
455
468
473
486
487struct OrtKernelInfo;
489struct OrtKernelContext;
491struct OrtCustomOp;
493
500
503// Whenever this struct is updated, please also update the MakeKey function in onnxruntime / core / framework / execution_provider.cc
514
520
529
535
547
557
577typedef OrtStatus*(ORT_API_CALL* EpSelectionDelegate)(_In_ const OrtEpDevice** ep_devices,
578 _In_ size_t num_devices,
579 _In_ const OrtKeyValuePairs* model_metadata,
580 _In_opt_ const OrtKeyValuePairs* runtime_metadata,
581 _Inout_ const OrtEpDevice** selected,
582 _In_ size_t max_selected,
583 _Out_ size_t* num_selected,
584 _In_ void* state);
585
596typedef OrtStatus*(ORT_API_CALL* OrtWriteBufferFunc)(_In_ void* state,
597 _In_ const void* buffer,
598 _In_ size_t buffer_num_bytes);
599
614typedef OrtStatus*(ORT_API_CALL* OrtWriteNamedBufferFunc)(_In_ void* state,
615 _In_ const char* name,
616 _In_ const void* buffer,
617 _In_ size_t buffer_num_bytes);
618
634typedef OrtStatus*(ORT_API_CALL* OrtReadNamedBufferFunc)(_In_ void* state,
635 _In_ const char* name,
636 _In_ OrtAllocator* allocator,
637 _Outptr_result_buffer_maybenull_(*data_size) void** buffer,
638 _Out_ size_t* data_size);
639
654
686 _In_ void* state,
687 _In_ const char* initializer_name,
688 _In_ const OrtValue* initializer_value,
689 _In_opt_ const OrtExternalInitializerInfo* external_info,
690 _Outptr_result_maybenull_ OrtExternalInitializerInfo** new_external_info);
691
695 OrtCudnnConvAlgoSearchExhaustive, // expensive exhaustive benchmarking using cudnnFindConvolutionForwardAlgorithmEx
696 OrtCudnnConvAlgoSearchHeuristic, // lightweight heuristic based search using cudnnGetConvolutionForwardAlgorithm_v7
697 OrtCudnnConvAlgoSearchDefault, // default algorithm using CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_PRECOMP_GEMM
699
786
875
882 int has_user_compute_stream; // indicator of user specified CUDA compute stream.
883 void* user_compute_stream; // user specified CUDA compute stream.
884 int trt_max_partition_iterations; // maximum iterations for TensorRT parser to get capability
885 int trt_min_subgraph_size; // minimum size of TensorRT subgraphs
886 size_t trt_max_workspace_size; // maximum workspace size for TensorRT.
887 int trt_fp16_enable; // enable TensorRT FP16 precision. Default 0 = false, nonzero = true
888 int trt_int8_enable; // enable TensorRT INT8 precision. Default 0 = false, nonzero = true
889 const char* trt_int8_calibration_table_name; // TensorRT INT8 calibration table name.
890 int trt_int8_use_native_calibration_table; // use native TensorRT generated calibration table. Default 0 = false, nonzero = true
891 int trt_dla_enable; // enable DLA. Default 0 = false, nonzero = true
892 int trt_dla_core; // DLA core number. Default 0
893 int trt_dump_subgraphs; // dump TRT subgraph. Default 0 = false, nonzero = true
894 int trt_engine_cache_enable; // enable engine caching. Default 0 = false, nonzero = true
895 const char* trt_engine_cache_path; // specify engine cache path
896 int trt_engine_decryption_enable; // enable engine decryption. Default 0 = false, nonzero = true
897 const char* trt_engine_decryption_lib_path; // specify engine decryption library path
898 int trt_force_sequential_engine_build; // force building TensorRT engine sequentially. Default 0 = false, nonzero = true
899 // This is the legacy struct and don't add new fields here.
900 // For new field that can be represented by string, please add it in include/onnxruntime/core/providers/tensorrt/tensorrt_provider_options.h
901 // For non-string field, need to create a new separate api to handle it.
903
909 int device_id; // hip device id.
910 int migraphx_fp16_enable; // MIGraphX FP16 precision. Default 0 = false, nonzero = true
911 int migraphx_fp8_enable; // MIGraphX FP8 precision. Default 0 = false, nonzero = true
912 int migraphx_int8_enable; // MIGraphX INT8 precision. Default 0 = false, nonzero = true
913 int migraphx_use_native_calibration_table; // MIGraphx INT8 cal table. Default 0 = false, nonzero = true
914 const char* migraphx_int8_calibration_table_name; // MIGraphx INT8 calibration table name
915 int migraphx_save_compiled_model; // migraphx save compiled model. Default 0 = false, nonzero = true
916 const char* migraphx_save_model_path; // migraphx model path name
917 int migraphx_load_compiled_model; // migraphx int8 cal table. Default 0 = false, nonzero = true
918 const char* migraphx_load_model_path; // migraphx model path name
919 bool migraphx_exhaustive_tune; // MIGraphX tuned compile. Default = false, nonzero = true
920
926
934
935 // This is the legacy struct and don't add new fields here.
937
948#ifdef __cplusplus
957#endif
962 const char* device_type;
964 const char* device_id;
966 const char* cache_dir; // path is set to empty by default
967 void* context;
969 unsigned char enable_dynamic_shapes;
971
972struct OrtApi;
973typedef struct OrtApi OrtApi;
974
975struct OrtTrainingApi;
977
978struct OrtModelEditorApi;
980
981struct OrtCompileApi;
983
984struct OrtInteropApi;
986
987struct OrtModelPackageApi;
989
990struct OrtEpApi;
991typedef struct OrtEpApi OrtEpApi;
992
1007 const OrtApi*(ORT_API_CALL* GetApi)(uint32_t version)NO_EXCEPTION;
1008
1013 const char*(ORT_API_CALL* GetVersionString)(void)NO_EXCEPTION;
1014};
1015
1016typedef struct OrtApiBase OrtApiBase;
1017
1022ORT_EXPORT const OrtApiBase* ORT_API_CALL OrtGetApiBase(void) NO_EXCEPTION;
1023
1029typedef void (*OrtThreadWorkerFn)(void* ort_worker_fn_param);
1030
1034
1040typedef OrtCustomThreadHandle (*OrtCustomCreateThreadFn)(void* ort_custom_thread_creation_options, OrtThreadWorkerFn ort_thread_worker_fn, void* ort_worker_fn_param);
1041
1047typedef void (*OrtCustomJoinThreadFn)(OrtCustomThreadHandle ort_custom_thread_handle);
1048
1058typedef _Ret_maybenull_ void* (*OrtThreadPoolWorkEnqueueFn)(_In_opt_ void* user_context)NO_EXCEPTION;
1059
1068typedef void (*OrtThreadPoolWorkStartFn)(_In_opt_ void* user_context, _In_opt_ void* enqueue_data) NO_EXCEPTION;
1069
1079typedef void (*OrtThreadPoolWorkStopFn)(_In_opt_ void* user_context, _In_opt_ void* enqueue_data) NO_EXCEPTION;
1080
1088typedef void (*OrtThreadPoolWorkAbandonFn)(_In_opt_ void* user_context, _In_opt_ void* enqueue_data) NO_EXCEPTION;
1089
1111
1112typedef OrtStatus*(ORT_API_CALL* RegisterCustomOpsFn)(OrtSessionOptions* options, const OrtApiBase* api);
1113
1121typedef void (*RunAsyncCallbackFn)(void* user_data, OrtValue** outputs, size_t num_outputs, OrtStatusPtr status);
1122
1140
1141// Previous enum values added for backwards compatibility
1142#ifndef ORT_EXTERNAL_MEMORY_HANDLE_TYPE_VK_MEMORY_WIN32
1143#define ORT_EXTERNAL_MEMORY_HANDLE_TYPE_VK_MEMORY_WIN32 ORT_EXTERNAL_MEMORY_HANDLE_TYPE_MEMORY_WIN32
1144#endif
1145#ifndef ORT_EXTERNAL_MEMORY_HANDLE_TYPE_VK_MEMORY_OPAQUE_FD
1146#define ORT_EXTERNAL_MEMORY_HANDLE_TYPE_VK_MEMORY_OPAQUE_FD ORT_EXTERNAL_MEMORY_HANDLE_TYPE_MEMORY_OPAQUE_FD
1147#endif
1148
1164
1174
1187
1201
1252
1269
1270/*
1271 * Public enum for compiled model compatibility across EPs.
1272 */
1279
1288 uint32_t version;
1289
1301
1308 const char* log_id;
1309
1320
1327
1341
1361
1362 //
1363 // End of fields available in ORT 1.24
1364 //
1365
1367
1375struct OrtApi {
1378
1386 OrtStatus*(ORT_API_CALL* CreateStatus)(OrtErrorCode code, _In_ const char* msg)NO_EXCEPTION ORT_ALL_ARGS_NONNULL;
1387
1393 OrtErrorCode(ORT_API_CALL* GetErrorCode)(_In_ const OrtStatus* status) NO_EXCEPTION ORT_ALL_ARGS_NONNULL;
1394
1400 const char*(ORT_API_CALL* GetErrorMessage)(_In_ const OrtStatus* status)NO_EXCEPTION ORT_ALL_ARGS_NONNULL;
1401
1405
1416 ORT_API2_STATUS(CreateEnv, OrtLoggingLevel log_severity_level, _In_ const char* logid, _Outptr_ OrtEnv** out);
1417
1432 ORT_API2_STATUS(CreateEnvWithCustomLogger, _In_ OrtLoggingFunction logging_function, _In_opt_ void* logger_param,
1433 _In_ OrtLoggingLevel log_severity_level, _In_ const char* logid, _Outptr_ OrtEnv** out);
1434
1442 ORT_API2_STATUS(EnableTelemetryEvents, _In_ const OrtEnv* env);
1450 ORT_API2_STATUS(DisableTelemetryEvents, _In_ const OrtEnv* env);
1451
1455
1465 // TODO: document the path separator convention? '/' vs '\'
1466 // TODO: should specify the access characteristics of model_path. Is this read only during the
1467 // execution of CreateSession, or does the OrtSession retain a handle to the file/directory
1468 // and continue to access throughout the OrtSession lifetime?
1469 // What sort of access is needed to model_path : read or read/write?
1470 ORT_API2_STATUS(CreateSession, _In_ const OrtEnv* env, _In_ const ORTCHAR_T* model_path,
1471 _In_ const OrtSessionOptions* options, _Outptr_ OrtSession** out);
1472
1483 ORT_API2_STATUS(CreateSessionFromArray, _In_ const OrtEnv* env,
1484 _In_ const void* model_data, size_t model_data_length,
1485 _In_ const OrtSessionOptions* options, _Outptr_ OrtSession** out);
1486
1505 ORT_API2_STATUS(Run, _Inout_ OrtSession* session, _In_opt_ const OrtRunOptions* run_options,
1506 _In_reads_(input_len) const char* const* input_names,
1507 _In_reads_(input_len) const OrtValue* const* inputs, size_t input_len,
1508 _In_reads_(output_names_len) const char* const* output_names, size_t output_names_len,
1509 _Inout_updates_all_(output_names_len) OrtValue** outputs);
1510
1514
1530 ORT_API2_STATUS(CreateSessionOptions, _Outptr_ OrtSessionOptions** options);
1531
1539 ORT_API2_STATUS(SetOptimizedModelFilePath, _Inout_ OrtSessionOptions* options,
1540 _In_ const ORTCHAR_T* optimized_model_filepath);
1541
1549 ORT_API2_STATUS(CloneSessionOptions, _In_ const OrtSessionOptions* in_options,
1550 _Outptr_ OrtSessionOptions** out_options);
1551
1563 ORT_API2_STATUS(SetSessionExecutionMode, _Inout_ OrtSessionOptions* options, ExecutionMode execution_mode);
1564
1572 ORT_API2_STATUS(EnableProfiling, _Inout_ OrtSessionOptions* options, _In_ const ORTCHAR_T* profile_file_prefix);
1573
1580 ORT_API2_STATUS(DisableProfiling, _Inout_ OrtSessionOptions* options);
1581
1595 ORT_API2_STATUS(EnableMemPattern, _Inout_ OrtSessionOptions* options);
1596
1605 ORT_API2_STATUS(DisableMemPattern, _Inout_ OrtSessionOptions* options);
1606
1615 ORT_API2_STATUS(EnableCpuMemArena, _Inout_ OrtSessionOptions* options);
1616
1623 ORT_API2_STATUS(DisableCpuMemArena, _Inout_ OrtSessionOptions* options);
1624
1632 ORT_API2_STATUS(SetSessionLogId, _Inout_ OrtSessionOptions* options, const char* logid);
1633
1643 ORT_API2_STATUS(SetSessionLogVerbosityLevel, _Inout_ OrtSessionOptions* options, int session_log_verbosity_level);
1644
1652 ORT_API2_STATUS(SetSessionLogSeverityLevel, _Inout_ OrtSessionOptions* options, int session_log_severity_level);
1653
1662 ORT_API2_STATUS(SetSessionGraphOptimizationLevel, _Inout_ OrtSessionOptions* options,
1663 GraphOptimizationLevel graph_optimization_level);
1664
1678 ORT_API2_STATUS(SetIntraOpNumThreads, _Inout_ OrtSessionOptions* options, int intra_op_num_threads);
1679
1692 ORT_API2_STATUS(SetInterOpNumThreads, _Inout_ OrtSessionOptions* options, int inter_op_num_threads);
1693
1697
1705 ORT_API2_STATUS(CreateCustomOpDomain, _In_ const char* domain, _Outptr_ OrtCustomOpDomain** out);
1706
1716 ORT_API2_STATUS(CustomOpDomain_Add, _Inout_ OrtCustomOpDomain* custom_op_domain, _In_ const OrtCustomOp* op);
1717
1721
1731 ORT_API2_STATUS(AddCustomOpDomain, _Inout_ OrtSessionOptions* options, _In_ OrtCustomOpDomain* custom_op_domain);
1732
1749 ORT_API2_STATUS(RegisterCustomOpsLibrary, _Inout_ OrtSessionOptions* options, _In_ const char* library_path, _Outptr_ void** library_handle);
1750
1754
1766 ORT_API2_STATUS(SessionGetInputCount, _In_ const OrtSession* session, _Out_ size_t* out);
1767
1779 ORT_API2_STATUS(SessionGetOutputCount, _In_ const OrtSession* session, _Out_ size_t* out);
1780
1790 ORT_API2_STATUS(SessionGetOverridableInitializerCount, _In_ const OrtSession* session, _Out_ size_t* out);
1791
1800 ORT_API2_STATUS(SessionGetInputTypeInfo, _In_ const OrtSession* session, size_t index, _Outptr_ OrtTypeInfo** type_info);
1801
1810 ORT_API2_STATUS(SessionGetOutputTypeInfo, _In_ const OrtSession* session, size_t index, _Outptr_ OrtTypeInfo** type_info);
1811
1820 ORT_API2_STATUS(SessionGetOverridableInitializerTypeInfo, _In_ const OrtSession* session, size_t index, _Outptr_ OrtTypeInfo** type_info);
1821
1831 ORT_API2_STATUS(SessionGetInputName, _In_ const OrtSession* session, size_t index, _Inout_ OrtAllocator* allocator, _Outptr_ char** value);
1832
1842 ORT_API2_STATUS(SessionGetOutputName, _In_ const OrtSession* session, size_t index, _Inout_ OrtAllocator* allocator, _Outptr_ char** value);
1843
1853 ORT_API2_STATUS(SessionGetOverridableInitializerName, _In_ const OrtSession* session, size_t index,
1854 _Inout_ OrtAllocator* allocator, _Outptr_ char** value);
1855
1859
1866 ORT_API2_STATUS(CreateRunOptions, _Outptr_ OrtRunOptions** out);
1867
1877 ORT_API2_STATUS(RunOptionsSetRunLogVerbosityLevel, _Inout_ OrtRunOptions* options, int log_verbosity_level);
1878
1886 ORT_API2_STATUS(RunOptionsSetRunLogSeverityLevel, _Inout_ OrtRunOptions* options, int log_severity_level);
1887
1897 ORT_API2_STATUS(RunOptionsSetRunTag, _Inout_ OrtRunOptions* options, _In_ const char* run_tag);
1898
1908 ORT_API2_STATUS(RunOptionsGetRunLogVerbosityLevel, _In_ const OrtRunOptions* options,
1909 _Out_ int* log_verbosity_level);
1910
1918 ORT_API2_STATUS(RunOptionsGetRunLogSeverityLevel, _In_ const OrtRunOptions* options, _Out_ int* log_severity_level);
1919
1931 ORT_API2_STATUS(RunOptionsGetRunTag, _In_ const OrtRunOptions* options, _Out_ const char** run_tag);
1932
1941 ORT_API2_STATUS(RunOptionsSetTerminate, _Inout_ OrtRunOptions* options);
1942
1951 ORT_API2_STATUS(RunOptionsUnsetTerminate, _Inout_ OrtRunOptions* options);
1952
1956
1969 ORT_API2_STATUS(CreateTensorAsOrtValue, _Inout_ OrtAllocator* allocator, _In_ const int64_t* shape, size_t shape_len,
1971
1989 ORT_API2_STATUS(CreateTensorWithDataAsOrtValue, _In_ const OrtMemoryInfo* info, _Inout_ void* p_data,
1990 size_t p_data_len, _In_ const int64_t* shape, size_t shape_len, ONNXTensorElementDataType type,
1991 _Outptr_ OrtValue** out);
1992
2000 ORT_API2_STATUS(IsTensor, _In_ const OrtValue* value, _Out_ int* out);
2001
2012 ORT_API2_STATUS(GetTensorMutableData, _In_ OrtValue* value, _Outptr_ void** out);
2013
2022 ORT_API2_STATUS(FillStringTensor, _Inout_ OrtValue* value, _In_ const char* const* s, size_t s_len);
2023
2033 ORT_API2_STATUS(GetStringTensorDataLength, _In_ const OrtValue* value, _Out_ size_t* len);
2034
2054 ORT_API2_STATUS(GetStringTensorContent, _In_ const OrtValue* value, _Out_writes_bytes_all_(s_len) void* s,
2055 size_t s_len, _Out_writes_all_(offsets_len) size_t* offsets, size_t offsets_len);
2056
2060
2069 ORT_API2_STATUS(CastTypeInfoToTensorInfo, _In_ const OrtTypeInfo* type_info,
2070 _Outptr_result_maybenull_ const OrtTensorTypeAndShapeInfo** out);
2071
2079 ORT_API2_STATUS(GetOnnxTypeFromTypeInfo, _In_ const OrtTypeInfo* type_info, _Out_ enum ONNXType* out);
2080
2084
2092
2101
2110 ORT_API2_STATUS(SetDimensions, OrtTensorTypeAndShapeInfo* info, _In_ const int64_t* dim_values, size_t dim_count);
2111
2121 ORT_API2_STATUS(GetTensorElementType, _In_ const OrtTensorTypeAndShapeInfo* info,
2123
2133 ORT_API2_STATUS(GetDimensionsCount, _In_ const OrtTensorTypeAndShapeInfo* info, _Out_ size_t* out);
2134
2143 ORT_API2_STATUS(GetDimensions, _In_ const OrtTensorTypeAndShapeInfo* info, _Out_ int64_t* dim_values,
2144 size_t dim_values_length);
2145
2154 ORT_API2_STATUS(GetSymbolicDimensions, _In_ const OrtTensorTypeAndShapeInfo* info,
2155 _Out_writes_all_(dim_params_length) const char* dim_params[], size_t dim_params_length);
2156
2173 ORT_API2_STATUS(GetTensorShapeElementCount, _In_ const OrtTensorTypeAndShapeInfo* info, _Out_ size_t* out);
2174
2178
2186 ORT_API2_STATUS(GetTensorTypeAndShape, _In_ const OrtValue* value, _Outptr_ OrtTensorTypeAndShapeInfo** out);
2187
2195 ORT_API2_STATUS(GetTypeInfo, _In_ const OrtValue* value, _Outptr_result_maybenull_ OrtTypeInfo** out);
2196
2204 ORT_API2_STATUS(GetValueType, _In_ const OrtValue* value, _Out_ enum ONNXType* out);
2205
2209
2220 ORT_API2_STATUS(CreateMemoryInfo, _In_ const char* name, enum OrtAllocatorType type, int id,
2221 enum OrtMemType mem_type, _Outptr_ OrtMemoryInfo** out);
2222
2233 ORT_API2_STATUS(CreateCpuMemoryInfo, enum OrtAllocatorType type, enum OrtMemType mem_type,
2234 _Outptr_ OrtMemoryInfo** out);
2235
2246 ORT_API2_STATUS(CompareMemoryInfo, _In_ const OrtMemoryInfo* info1, _In_ const OrtMemoryInfo* info2, _Out_ int* out);
2247
2255 ORT_API2_STATUS(MemoryInfoGetName, _In_ const OrtMemoryInfo* ptr, _Out_ const char** out);
2256
2259 ORT_API2_STATUS(MemoryInfoGetId, _In_ const OrtMemoryInfo* ptr, _Out_ int* out);
2260
2263 ORT_API2_STATUS(MemoryInfoGetMemType, _In_ const OrtMemoryInfo* ptr, _Out_ OrtMemType* out);
2264
2267 ORT_API2_STATUS(MemoryInfoGetType, _In_ const OrtMemoryInfo* ptr, _Out_ OrtAllocatorType* out);
2268
2272
2274 ORT_API2_STATUS(AllocatorAlloc, _Inout_ OrtAllocator* ort_allocator, size_t size, _Outptr_ void** out);
2276 ORT_API2_STATUS(AllocatorFree, _Inout_ OrtAllocator* ort_allocator, void* p);
2278 ORT_API2_STATUS(AllocatorGetInfo, _In_ const OrtAllocator* ort_allocator, _Outptr_ const struct OrtMemoryInfo** out);
2279
2288 ORT_API2_STATUS(GetAllocatorWithDefaultOptions, _Outptr_ OrtAllocator** out);
2289
2293
2305 ORT_API2_STATUS(AddFreeDimensionOverride, _Inout_ OrtSessionOptions* options, _In_ const char* dim_denotation,
2306 _In_ int64_t dim_value);
2307
2311
2312 /* Internal information (not seen in Doxygen)
2313 *
2314 * APIs to support non-tensor types - map and sequence.
2315 * Currently only the following types are supported
2316 * Note: the following types should be kept in sync with data_types.h
2317 * Map types
2318 * =========
2319 * std::map<std::string, std::string>
2320 * std::map<std::string, int64_t>
2321 * std::map<std::string, float>
2322 * std::map<std::string, double>
2323 * std::map<int64_t, std::string>
2324 * std::map<int64_t, int64_t>
2325 * std::map<int64_t, float>
2326 * std::map<int64_t, double>
2327 *
2328 * Sequence types
2329 * ==============
2330 * std::vector<std::string>
2331 * std::vector<int64_t>
2332 * std::vector<float>
2333 * std::vector<double>
2334 * std::vector<std::map<std::string, float>>
2335 * std::vector<std::map<int64_t, float>
2336 */
2337
2352 ORT_API2_STATUS(GetValue, _In_ const OrtValue* value, int index, _Inout_ OrtAllocator* allocator,
2353 _Outptr_ OrtValue** out);
2354
2365 ORT_API2_STATUS(GetValueCount, _In_ const OrtValue* value, _Out_ size_t* out);
2366
2382 ORT_API2_STATUS(CreateValue, _In_reads_(num_values) const OrtValue* const* in, size_t num_values,
2383 enum ONNXType value_type, _Outptr_ OrtValue** out);
2384
2407 ORT_API2_STATUS(CreateOpaqueValue, _In_z_ const char* domain_name, _In_z_ const char* type_name,
2408 _In_ const void* data_container, size_t data_container_size, _Outptr_ OrtValue** out);
2409
2424 ORT_API2_STATUS(GetOpaqueValue, _In_ const char* domain_name, _In_ const char* type_name, _In_ const OrtValue* in,
2425 _Out_ void* data_container, size_t data_container_size);
2426
2431
2440 ORT_API2_STATUS(KernelInfoGetAttribute_float, _In_ const OrtKernelInfo* info, _In_ const char* name,
2441 _Out_ float* out);
2442
2451 ORT_API2_STATUS(KernelInfoGetAttribute_int64, _In_ const OrtKernelInfo* info, _In_ const char* name,
2452 _Out_ int64_t* out);
2453
2476 ORT_API2_STATUS(KernelInfoGetAttribute_string, _In_ const OrtKernelInfo* info, _In_ const char* name, _Out_ char* out,
2477 _Inout_ size_t* size);
2478
2483
2488 ORT_API2_STATUS(KernelContext_GetInputCount, _In_ const OrtKernelContext* context, _Out_ size_t* out);
2489
2494 ORT_API2_STATUS(KernelContext_GetOutputCount, _In_ const OrtKernelContext* context, _Out_ size_t* out);
2495
2507 ORT_API2_STATUS(KernelContext_GetInput, _In_ const OrtKernelContext* context, _In_ size_t index,
2508 _Out_ const OrtValue** out);
2509
2523 ORT_API2_STATUS(KernelContext_GetOutput, _Inout_ OrtKernelContext* context, _In_ size_t index,
2524 _In_ const int64_t* dim_values, size_t dim_count, _Outptr_ OrtValue** out);
2525
2529 ORT_CLASS_RELEASE(Env);
2533 ORT_CLASS_RELEASE(Status);
2537 ORT_CLASS_RELEASE(MemoryInfo);
2541 ORT_CLASS_RELEASE(Session); // Don't call ReleaseSession from Dllmain (because session owns a thread pool)
2545 ORT_CLASS_RELEASE(Value);
2549 ORT_CLASS_RELEASE(RunOptions);
2553 ORT_CLASS_RELEASE(TypeInfo);
2557 ORT_CLASS_RELEASE(TensorTypeAndShapeInfo);
2561 ORT_CLASS_RELEASE(SessionOptions);
2565 ORT_CLASS_RELEASE(CustomOpDomain);
2566
2570
2583 ORT_API2_STATUS(GetDenotationFromTypeInfo, _In_ const OrtTypeInfo* type_info, _Out_ const char** const denotation,
2584 _Out_ size_t* len);
2585
2599 ORT_API2_STATUS(CastTypeInfoToMapTypeInfo, _In_ const OrtTypeInfo* type_info,
2600 _Outptr_result_maybenull_ const OrtMapTypeInfo** out);
2601
2615 ORT_API2_STATUS(CastTypeInfoToSequenceTypeInfo, _In_ const OrtTypeInfo* type_info,
2616 _Outptr_result_maybenull_ const OrtSequenceTypeInfo** out);
2617
2621
2633 ORT_API2_STATUS(GetMapKeyType, _In_ const OrtMapTypeInfo* map_type_info, _Out_ enum ONNXTensorElementDataType* out);
2634
2643 ORT_API2_STATUS(GetMapValueType, _In_ const OrtMapTypeInfo* map_type_info, _Outptr_ OrtTypeInfo** type_info);
2644
2648
2659 ORT_API2_STATUS(GetSequenceElementType, _In_ const OrtSequenceTypeInfo* sequence_type_info,
2660 _Outptr_ OrtTypeInfo** type_info);
2661
2665 ORT_CLASS_RELEASE(MapTypeInfo);
2669 ORT_CLASS_RELEASE(SequenceTypeInfo);
2670
2674
2685 ORT_API2_STATUS(SessionEndProfiling, _In_ OrtSession* session, _Inout_ OrtAllocator* allocator, _Outptr_ char** out);
2686
2694 ORT_API2_STATUS(SessionGetModelMetadata, _In_ const OrtSession* session, _Outptr_ OrtModelMetadata** out);
2695
2699
2708 ORT_API2_STATUS(ModelMetadataGetProducerName, _In_ const OrtModelMetadata* model_metadata,
2709 _Inout_ OrtAllocator* allocator, _Outptr_ char** value);
2710
2719 ORT_API2_STATUS(ModelMetadataGetGraphName, _In_ const OrtModelMetadata* model_metadata,
2720 _Inout_ OrtAllocator* allocator, _Outptr_ char** value);
2721
2730 ORT_API2_STATUS(ModelMetadataGetDomain, _In_ const OrtModelMetadata* model_metadata, _Inout_ OrtAllocator* allocator,
2731 _Outptr_ char** value);
2732
2741 ORT_API2_STATUS(ModelMetadataGetDescription, _In_ const OrtModelMetadata* model_metadata,
2742 _Inout_ OrtAllocator* allocator, _Outptr_ char** value);
2743
2754 ORT_API2_STATUS(ModelMetadataLookupCustomMetadataMap, _In_ const OrtModelMetadata* model_metadata,
2755 _Inout_ OrtAllocator* allocator, _In_ const char* key, _Outptr_result_maybenull_ char** value);
2756
2764 ORT_API2_STATUS(ModelMetadataGetVersion, _In_ const OrtModelMetadata* model_metadata, _Out_ int64_t* value);
2765
2766 ORT_CLASS_RELEASE(ModelMetadata);
2767
2771
2785 ORT_API2_STATUS(CreateEnvWithGlobalThreadPools, OrtLoggingLevel log_severity_level, _In_ const char* logid,
2786 _In_ const OrtThreadingOptions* tp_options, _Outptr_ OrtEnv** out);
2787
2791
2801 ORT_API2_STATUS(DisablePerSessionThreads, _Inout_ OrtSessionOptions* options);
2802
2806
2812 ORT_API2_STATUS(CreateThreadingOptions, _Outptr_ OrtThreadingOptions** out);
2813
2814 ORT_CLASS_RELEASE(ThreadingOptions);
2815
2819
2831 ORT_API2_STATUS(ModelMetadataGetCustomMetadataMapKeys, _In_ const OrtModelMetadata* model_metadata,
2832 _Inout_ OrtAllocator* allocator, _Outptr_result_buffer_maybenull_(*num_keys) char*** keys, _Out_ int64_t* num_keys);
2833
2837
2845 ORT_API2_STATUS(AddFreeDimensionOverrideByName,
2846 _Inout_ OrtSessionOptions* options, _In_ const char* dim_name,
2847 _In_ int64_t dim_value);
2848
2852
2864 ORT_API2_STATUS(GetAvailableProviders, _Outptr_ char*** out_ptr, _Out_ int* provider_length);
2865
2874 ORT_API2_STATUS(ReleaseAvailableProviders, _In_ char** ptr,
2875 _In_ int providers_length);
2876
2880
2889 ORT_API2_STATUS(GetStringTensorElementLength, _In_ const OrtValue* value, size_t index, _Out_ size_t* out);
2890
2900 ORT_API2_STATUS(GetStringTensorElement, _In_ const OrtValue* value, size_t s_len, size_t index, _Out_writes_bytes_all_(s_len) void* s);
2901
2910 ORT_API2_STATUS(FillStringTensorElement, _Inout_ OrtValue* value, _In_ const char* s, size_t index);
2911
2915
2928 ORT_API2_STATUS(AddSessionConfigEntry, _Inout_ OrtSessionOptions* options,
2929 _In_z_ const char* config_key, _In_z_ const char* config_value);
2930
2934
2945 ORT_API2_STATUS(CreateAllocator, _In_ const OrtSession* session, _In_ const OrtMemoryInfo* mem_info,
2946 _Outptr_ OrtAllocator** out);
2947
2950 ORT_CLASS_RELEASE(Allocator);
2951
2955
2966 ORT_API2_STATUS(RunWithBinding, _Inout_ OrtSession* session, _In_ const OrtRunOptions* run_options, _In_ const OrtIoBinding* binding_ptr);
2967
2979 ORT_API2_STATUS(CreateIoBinding, _Inout_ OrtSession* session, _Outptr_ OrtIoBinding** out);
2980
2984
2987 ORT_CLASS_RELEASE(IoBinding);
2988
2999 ORT_API2_STATUS(BindInput, _Inout_ OrtIoBinding* binding_ptr, _In_ const char* name, _In_ const OrtValue* val_ptr);
3000
3011 ORT_API2_STATUS(BindOutput, _Inout_ OrtIoBinding* binding_ptr, _In_ const char* name, _In_ const OrtValue* val_ptr);
3012
3028 ORT_API2_STATUS(BindOutputToDevice, _Inout_ OrtIoBinding* binding_ptr, _In_ const char* name, _In_ const OrtMemoryInfo* mem_info_ptr);
3029
3047 ORT_API2_STATUS(GetBoundOutputNames, _In_ const OrtIoBinding* binding_ptr, _In_ OrtAllocator* allocator,
3048 _Out_ char** buffer, _Out_writes_all_(count) size_t** lengths, _Out_ size_t* count);
3049
3067 ORT_API2_STATUS(GetBoundOutputValues, _In_ const OrtIoBinding* binding_ptr, _In_ OrtAllocator* allocator,
3068 _Out_writes_all_(output_count) OrtValue*** output, _Out_ size_t* output_count);
3069
3072 void(ORT_API_CALL* ClearBoundInputs)(_Inout_ OrtIoBinding* binding_ptr) NO_EXCEPTION ORT_ALL_ARGS_NONNULL;
3073
3076 void(ORT_API_CALL* ClearBoundOutputs)(_Inout_ OrtIoBinding* binding_ptr) NO_EXCEPTION ORT_ALL_ARGS_NONNULL;
3077
3081
3097 ORT_API2_STATUS(TensorAt, _Inout_ OrtValue* value, const int64_t* location_values, size_t location_values_count, _Outptr_ void** out);
3098
3102
3117 ORT_API2_STATUS(CreateAndRegisterAllocator, _Inout_ OrtEnv* env, _In_ const OrtMemoryInfo* mem_info,
3118 _In_ const OrtArenaCfg* arena_cfg);
3119
3131 ORT_API2_STATUS(SetLanguageProjection, _In_ const OrtEnv* ort_env, _In_ OrtLanguageProjection projection);
3132
3136
3146 ORT_API2_STATUS(SessionGetProfilingStartTimeNs, _In_ const OrtSession* session, _Outptr_ uint64_t* out);
3147
3151
3163 ORT_API2_STATUS(SetGlobalIntraOpNumThreads, _Inout_ OrtThreadingOptions* tp_options, int intra_op_num_threads);
3164
3176 ORT_API2_STATUS(SetGlobalInterOpNumThreads, _Inout_ OrtThreadingOptions* tp_options, int inter_op_num_threads);
3177
3191 ORT_API2_STATUS(SetGlobalSpinControl, _Inout_ OrtThreadingOptions* tp_options, int allow_spinning);
3192
3196
3211 ORT_API2_STATUS(AddInitializer, _Inout_ OrtSessionOptions* options, _In_z_ const char* name,
3212 _In_ const OrtValue* val);
3213
3217
3233 ORT_API2_STATUS(CreateEnvWithCustomLoggerAndGlobalThreadPools, OrtLoggingFunction logging_function, _In_opt_ void* logger_param, OrtLoggingLevel log_severity_level,
3234 _In_ const char* logid, _In_ const struct OrtThreadingOptions* tp_options, _Outptr_ OrtEnv** out);
3235
3239
3250 _In_ OrtSessionOptions* options, _In_ const OrtCUDAProviderOptions* cuda_options);
3251
3262 _In_ OrtSessionOptions* options, _In_ const OrtROCMProviderOptions* rocm_options);
3263
3274 _In_ OrtSessionOptions* options, _In_ const OrtOpenVINOProviderOptions* provider_options);
3275
3279
3290 ORT_API2_STATUS(SetGlobalDenormalAsZero, _Inout_ OrtThreadingOptions* tp_options);
3291
3295
3308 ORT_API2_STATUS(CreateArenaCfg, _In_ size_t max_mem, int arena_extend_strategy, int initial_chunk_size_bytes,
3309 int max_dead_bytes_per_chunk, _Outptr_ OrtArenaCfg** out);
3310
3311 ORT_CLASS_RELEASE(ArenaCfg);
3312
3316
3328 ORT_API2_STATUS(ModelMetadataGetGraphDescription, _In_ const OrtModelMetadata* model_metadata,
3329 _Inout_ OrtAllocator* allocator, _Outptr_ char** value);
3330
3334
3345 _In_ OrtSessionOptions* options, _In_ const OrtTensorRTProviderOptions* tensorrt_options);
3346
3350
3361 ORT_API2_STATUS(SetCurrentGpuDeviceId, _In_ int device_id);
3362
3373 ORT_API2_STATUS(GetCurrentGpuDeviceId, _In_ int* device_id);
3374
3379
3402 ORT_API2_STATUS(KernelInfoGetAttributeArray_float, _In_ const OrtKernelInfo* info, _In_ const char* name,
3403 _Out_ float* out, _Inout_ size_t* size);
3404
3426 ORT_API2_STATUS(KernelInfoGetAttributeArray_int64, _In_ const OrtKernelInfo* info, _In_ const char* name,
3427 _Out_ int64_t* out, _Inout_ size_t* size);
3428
3432
3464 ORT_API2_STATUS(CreateArenaCfgV2, _In_reads_(num_keys) const char* const* arena_config_keys,
3465 _In_reads_(num_keys) const size_t* arena_config_values, _In_ size_t num_keys,
3466 _Outptr_ OrtArenaCfg** out);
3467
3471
3484 ORT_API2_STATUS(AddRunConfigEntry, _Inout_ OrtRunOptions* options,
3485 _In_z_ const char* config_key, _In_z_ const char* config_value);
3486
3490
3504
3509 ORT_CLASS_RELEASE(PrepackedWeightsContainer);
3510
3514
3532 ORT_API2_STATUS(CreateSessionWithPrepackedWeightsContainer, _In_ const OrtEnv* env, _In_ const ORTCHAR_T* model_path,
3533 _In_ const OrtSessionOptions* options,
3534 _Inout_ OrtPrepackedWeightsContainer* prepacked_weights_container,
3535 _Outptr_ OrtSession** out);
3536
3555 ORT_API2_STATUS(CreateSessionFromArrayWithPrepackedWeightsContainer, _In_ const OrtEnv* env,
3556 _In_ const void* model_data, size_t model_data_length,
3557 _In_ const OrtSessionOptions* options,
3558 _Inout_ OrtPrepackedWeightsContainer* prepacked_weights_container,
3559 _Outptr_ OrtSession** out);
3560
3564
3583 _In_ OrtSessionOptions* options, _In_ const OrtTensorRTProviderOptionsV2* tensorrt_options);
3584
3588
3596
3612 ORT_API2_STATUS(UpdateTensorRTProviderOptions, _Inout_ OrtTensorRTProviderOptionsV2* tensorrt_options,
3613 _In_reads_(num_keys) const char* const* provider_options_keys,
3614 _In_reads_(num_keys) const char* const* provider_options_values,
3615 _In_ size_t num_keys);
3616
3628 ORT_API2_STATUS(GetTensorRTProviderOptionsAsString, _In_ const OrtTensorRTProviderOptionsV2* tensorrt_options, _Inout_ OrtAllocator* allocator, _Outptr_ char** ptr);
3629
3634 void(ORT_API_CALL* ReleaseTensorRTProviderOptions)(_Frees_ptr_opt_ OrtTensorRTProviderOptionsV2* input);
3635
3639
3646 ORT_API2_STATUS(EnableOrtCustomOps, _Inout_ OrtSessionOptions* options);
3647
3651
3667 ORT_API2_STATUS(RegisterAllocator, _Inout_ OrtEnv* env, _In_ OrtAllocator* allocator);
3668
3679 ORT_API2_STATUS(UnregisterAllocator, _Inout_ OrtEnv* env,
3680 _In_ const OrtMemoryInfo* mem_info);
3681
3685
3694 ORT_API2_STATUS(IsSparseTensor, _In_ const OrtValue* value, _Out_ int* out);
3695
3712 ORT_API2_STATUS(CreateSparseTensorAsOrtValue, _Inout_ OrtAllocator* allocator, _In_ const int64_t* dense_shape,
3713 size_t dense_shape_len, ONNXTensorElementDataType type, _Outptr_ OrtValue** out);
3714
3732 ORT_API2_STATUS(FillSparseTensorCoo, _Inout_ OrtValue* ort_value, _In_ const OrtMemoryInfo* data_mem_info,
3733 _In_ const int64_t* values_shape, size_t values_shape_len, _In_ const void* values,
3734 _In_ const int64_t* indices_data, size_t indices_num);
3735
3755 ORT_API2_STATUS(FillSparseTensorCsr, _Inout_ OrtValue* ort_value, _In_ const OrtMemoryInfo* data_mem_info,
3756 _In_ const int64_t* values_shape, size_t values_shape_len, _In_ const void* values,
3757 _In_ const int64_t* inner_indices_data, size_t inner_indices_num,
3758 _In_ const int64_t* outer_indices_data, size_t outer_indices_num);
3759
3778 ORT_API2_STATUS(FillSparseTensorBlockSparse, _Inout_ OrtValue* ort_value, _In_ const OrtMemoryInfo* data_mem_info,
3779 _In_ const int64_t* values_shape, size_t values_shape_len, _In_ const void* values,
3780 _In_ const int64_t* indices_shape_data, size_t indices_shape_len,
3781 _In_ const int32_t* indices_data);
3782
3807 ORT_API2_STATUS(CreateSparseTensorWithValuesAsOrtValue, _In_ const OrtMemoryInfo* info, _Inout_ void* p_data,
3808 _In_ const int64_t* dense_shape, size_t dense_shape_len,
3809 _In_ const int64_t* values_shape, size_t values_shape_len,
3811
3826 ORT_API2_STATUS(UseCooIndices, _Inout_ OrtValue* ort_value, _Inout_ int64_t* indices_data, size_t indices_num);
3827
3844 ORT_API2_STATUS(UseCsrIndices, _Inout_ OrtValue* ort_value, _Inout_ int64_t* inner_data, size_t inner_num,
3845 _Inout_ int64_t* outer_data, size_t outer_num);
3846
3860 ORT_API2_STATUS(UseBlockSparseIndices, _Inout_ OrtValue* ort_value, const int64_t* indices_shape, size_t indices_shape_len, _Inout_ int32_t* indices_data);
3861
3869 ORT_API2_STATUS(GetSparseTensorFormat, _In_ const OrtValue* ort_value, _Out_ enum OrtSparseFormat* out);
3870
3878 ORT_API2_STATUS(GetSparseTensorValuesTypeAndShape, _In_ const OrtValue* ort_value, _Outptr_ OrtTensorTypeAndShapeInfo** out);
3879
3887 ORT_API2_STATUS(GetSparseTensorValues, _In_ const OrtValue* ort_value, _Outptr_ const void** out);
3888
3898 ORT_API2_STATUS(GetSparseTensorIndicesTypeShape, _In_ const OrtValue* ort_value, enum OrtSparseIndicesFormat indices_format, _Outptr_ OrtTensorTypeAndShapeInfo** out);
3899
3909 ORT_API2_STATUS(GetSparseTensorIndices, _In_ const OrtValue* ort_value, enum OrtSparseIndicesFormat indices_format, _Out_ size_t* num_indices, _Outptr_ const void** indices);
3913
3926 ORT_API2_STATUS(HasValue, _In_ const OrtValue* value, _Out_ int* out);
3927
3932
3944 ORT_API2_STATUS(KernelContext_GetGPUComputeStream, _In_ const OrtKernelContext* context, _Outptr_ void** out);
3945
3949
3955 ORT_API2_STATUS(GetTensorMemoryInfo, _In_ const OrtValue* value, _Out_ const OrtMemoryInfo** mem_info);
3956
3960
3970 ORT_API2_STATUS(GetExecutionProviderApi, _In_ const char* provider_name, _In_ uint32_t version, _Outptr_ const void** provider_api);
3971
3973
3976
3983 ORT_API2_STATUS(SessionOptionsSetCustomCreateThreadFn, _Inout_ OrtSessionOptions* options, _In_ OrtCustomCreateThreadFn ort_custom_create_thread_fn);
3984
3992 ORT_API2_STATUS(SessionOptionsSetCustomThreadCreationOptions, _Inout_ OrtSessionOptions* options, _In_ void* ort_custom_thread_creation_options);
3993
4001 ORT_API2_STATUS(SessionOptionsSetCustomJoinThreadFn, _Inout_ OrtSessionOptions* options, _In_ OrtCustomJoinThreadFn ort_custom_join_thread_fn);
4003
4006
4013 ORT_API2_STATUS(SetGlobalCustomCreateThreadFn, _Inout_ OrtThreadingOptions* tp_options, _In_ OrtCustomCreateThreadFn ort_custom_create_thread_fn);
4014
4022 ORT_API2_STATUS(SetGlobalCustomThreadCreationOptions, _Inout_ OrtThreadingOptions* tp_options, _In_ void* ort_custom_thread_creation_options);
4023
4031 ORT_API2_STATUS(SetGlobalCustomJoinThreadFn, _Inout_ OrtThreadingOptions* tp_options, _In_ OrtCustomJoinThreadFn ort_custom_join_thread_fn);
4033
4042 ORT_API2_STATUS(SynchronizeBoundInputs, _Inout_ OrtIoBinding* binding_ptr);
4043
4052 ORT_API2_STATUS(SynchronizeBoundOutputs, _Inout_ OrtIoBinding* binding_ptr);
4053
4056
4077 _In_ OrtSessionOptions* options, _In_ const OrtCUDAProviderOptionsV2* cuda_options);
4078
4082
4091 ORT_API2_STATUS(CreateCUDAProviderOptions, _Outptr_ OrtCUDAProviderOptionsV2** out);
4092
4110 ORT_API2_STATUS(UpdateCUDAProviderOptions, _Inout_ OrtCUDAProviderOptionsV2* cuda_options,
4111 _In_reads_(num_keys) const char* const* provider_options_keys,
4112 _In_reads_(num_keys) const char* const* provider_options_values,
4113 _In_ size_t num_keys);
4114
4129 ORT_API2_STATUS(GetCUDAProviderOptionsAsString, _In_ const OrtCUDAProviderOptionsV2* cuda_options, _Inout_ OrtAllocator* allocator, _Outptr_ char** ptr);
4130
4137 void(ORT_API_CALL* ReleaseCUDAProviderOptions)(_Frees_ptr_opt_ OrtCUDAProviderOptionsV2* input);
4138
4140
4153 _In_ OrtSessionOptions* options, _In_ const OrtMIGraphXProviderOptions* migraphx_options);
4154
4177 ORT_API2_STATUS(AddExternalInitializers, _In_ OrtSessionOptions* options,
4178 _In_reads_(num_initializers) const char* const* initializer_names,
4179 _In_reads_(num_initializers) const OrtValue* const* initializers, size_t num_initializers);
4180
4192 ORT_API2_STATUS(CreateOpAttr,
4193 _In_ const char* name,
4194 _In_ const void* data,
4195 _In_ int len,
4196 _In_ OrtOpAttrType type,
4197 _Outptr_ OrtOpAttr** op_attr);
4198
4199 /* \brief: Release op attribute
4200 *
4201 * \param[in] opAttr Attribute created by OrtApi::CreateOpAttr
4202 *
4203 * \since Version 1.12.
4204 */
4205 ORT_CLASS_RELEASE(OpAttr);
4206
4224 ORT_API2_STATUS(CreateOp,
4225 _In_ const OrtKernelInfo* info,
4226 _In_z_ const char* op_name,
4227 _In_z_ const char* domain,
4228 int version,
4229 _In_reads_(type_constraint_count) const char** type_constraint_names,
4230 _In_reads_(type_constraint_count) const ONNXTensorElementDataType* type_constraint_values,
4231 int type_constraint_count,
4232 _In_reads_(attr_count) const OrtOpAttr* const* attr_values,
4233 int attr_count,
4234 int input_count,
4235 int output_count,
4236 _Outptr_ OrtOp** ort_op);
4237
4250 ORT_API2_STATUS(InvokeOp,
4251 _In_ const OrtKernelContext* context,
4252 _In_ const OrtOp* ort_op,
4253 _In_ const OrtValue* const* input_values,
4254 _In_ int input_count,
4255 _Inout_ OrtValue* const* output_values,
4256 _In_ int output_count);
4257
4258 /* \brief: Release an onnxruntime operator
4259 *
4260 * \param[in] Op Operator created by OrtApi::CreateOp
4261 *
4262 * \since Version 1.12.
4263 */
4264 ORT_CLASS_RELEASE(Op);
4265
4388 ORT_API2_STATUS(SessionOptionsAppendExecutionProvider, _In_ OrtSessionOptions* options,
4389 _In_ const char* provider_name,
4390 _In_reads_(num_keys) const char* const* provider_options_keys,
4391 _In_reads_(num_keys) const char* const* provider_options_values,
4392 _In_ size_t num_keys);
4393
4394 /* \brief: Get a copy of kernel info
4395 *
4396 * \param[in] info Kernel info
4397 * \param[out] info_copy Copy of kernel info
4398 *
4399 * \since Version 1.12.
4400 */
4401 ORT_API2_STATUS(CopyKernelInfo,
4402 _In_ const OrtKernelInfo* info,
4403 _Outptr_ OrtKernelInfo** info_copy);
4404
4405 /* \brief: Release kernel info
4406 *
4407 * \param[in] KernelInfo A copy of kernel info returned by CopyKernelInfo
4408 *
4409 * \since Version 1.12.
4410 */
4411 ORT_CLASS_RELEASE(KernelInfo);
4412
4415
4429 const OrtTrainingApi*(ORT_API_CALL* GetTrainingApi)(uint32_t version)NO_EXCEPTION;
4430
4432
4445 _In_ OrtSessionOptions* options, _In_ const OrtCANNProviderOptions* cann_options);
4446
4455 ORT_API2_STATUS(CreateCANNProviderOptions, _Outptr_ OrtCANNProviderOptions** out);
4456
4468 ORT_API2_STATUS(UpdateCANNProviderOptions, _Inout_ OrtCANNProviderOptions* cann_options,
4469 _In_reads_(num_keys) const char* const* provider_options_keys,
4470 _In_reads_(num_keys) const char* const* provider_options_values,
4471 _In_ size_t num_keys);
4472
4486 ORT_API2_STATUS(GetCANNProviderOptionsAsString, _In_ const OrtCANNProviderOptions* cann_options,
4487 _Inout_ OrtAllocator* allocator, _Outptr_ char** ptr);
4488
4495 void(ORT_API_CALL* ReleaseCANNProviderOptions)(_Frees_ptr_opt_ OrtCANNProviderOptions* input);
4496
4497 /* \brief Get OrtDevice type from MemoryInfo
4498 *
4499 * \since Version 1.14
4500 */
4501 void(ORT_API_CALL* MemoryInfoGetDeviceType)(_In_ const OrtMemoryInfo* ptr, _Out_ OrtMemoryInfoDeviceType* out);
4502
4503 /* \brief Update the OrtEnv instance with custom log severity level
4504 *
4505 * \param[in] ort_env The OrtEnv instance being used
4506 * \param[in] log_severity_level The log severity level.
4507 *
4508 * \since Version 1.14.
4509 */
4510 ORT_API2_STATUS(UpdateEnvWithCustomLogLevel, _In_ OrtEnv* ort_env, OrtLoggingLevel log_severity_level);
4511
4512 /* \brief Set affinities for intra op threads
4513 *
4514 * Affinity string follows format:
4515 * logical_processor_id,logical_processor_id;logical_processor_id,logical_processor_id
4516 * Semicolon isolates configurations among threads, while comma split processors where ith thread expected to attach to.
4517 * e.g. 1,2,3;4,5
4518 * 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.
4519 * To ease the configuration, an "interval" is also allowed:
4520 * e.g. 1-8;8-16;17-24
4521 * orders that the 1st thread runs on first eight processors, 2nd thread runs on next eight processors, and so forth.
4522 * Note:
4523 * 1. Once set, the number of thread affinities must equal to intra_op_num_threads - 1,
4524 * ort does not set affinity on the main thread which is started and managed by the calling app;
4525 * 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,
4526 * 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.
4527 * Hence 64-65 is an invalid configuration, because a windows thread cannot be attached to processors across group boundary.
4528 *
4529 * \since Version 1.14
4530 */
4531 ORT_API2_STATUS(SetGlobalIntraOpThreadAffinity, _Inout_ OrtThreadingOptions* tp_options, const char* affinity_string);
4532
4551 ORT_API2_STATUS(RegisterCustomOpsLibrary_V2, _Inout_ OrtSessionOptions* options, _In_ const ORTCHAR_T* library_name);
4552
4577 ORT_API2_STATUS(RegisterCustomOpsUsingFunction, _Inout_ OrtSessionOptions* options,
4578 _In_ const char* registration_func_name);
4579
4583
4595 ORT_API2_STATUS(KernelInfo_GetInputCount, _In_ const OrtKernelInfo* info, _Out_ size_t* out);
4596
4608 ORT_API2_STATUS(KernelInfo_GetOutputCount, _In_ const OrtKernelInfo* info, _Out_ size_t* out);
4609
4634 ORT_API2_STATUS(KernelInfo_GetInputName, _In_ const OrtKernelInfo* info, size_t index, _Out_opt_ char* out,
4635 _Inout_ size_t* size);
4636
4662 ORT_API2_STATUS(KernelInfo_GetOutputName, _In_ const OrtKernelInfo* info, size_t index, _Out_opt_ char* out,
4663 _Inout_ size_t* size);
4664
4677 ORT_API2_STATUS(KernelInfo_GetInputTypeInfo, _In_ const OrtKernelInfo* info, size_t index,
4678 _Outptr_ OrtTypeInfo** type_info);
4679
4692 ORT_API2_STATUS(KernelInfo_GetOutputTypeInfo, _In_ const OrtKernelInfo* info, size_t index,
4693 _Outptr_ OrtTypeInfo** type_info);
4694
4707 ORT_API2_STATUS(KernelInfoGetAttribute_tensor, _In_ const OrtKernelInfo* info, _In_z_ const char* name,
4708 _Inout_ OrtAllocator* allocator, _Outptr_ OrtValue** out);
4709
4714
4730 ORT_API2_STATUS(HasSessionConfigEntry, _In_ const OrtSessionOptions* options,
4731 _In_z_ const char* config_key, _Out_ int* out);
4732
4761 ORT_API2_STATUS(GetSessionConfigEntry, _In_ const OrtSessionOptions* options,
4762 _In_z_ const char* config_key, _Out_ char* config_value, _Inout_ size_t* size);
4763
4765
4778 _In_ OrtSessionOptions* options, _In_ const OrtDnnlProviderOptions* dnnl_options);
4779
4788 ORT_API2_STATUS(CreateDnnlProviderOptions, _Outptr_ OrtDnnlProviderOptions** out);
4789
4806 ORT_API2_STATUS(UpdateDnnlProviderOptions, _Inout_ OrtDnnlProviderOptions* dnnl_options,
4807 _In_reads_(num_keys) const char* const* provider_options_keys,
4808 _In_reads_(num_keys) const char* const* provider_options_values,
4809 _In_ size_t num_keys);
4810
4825 ORT_API2_STATUS(GetDnnlProviderOptionsAsString, _In_ const OrtDnnlProviderOptions* dnnl_options, _Inout_ OrtAllocator* allocator, _Outptr_ char** ptr);
4826
4831 void(ORT_API_CALL* ReleaseDnnlProviderOptions)(_Frees_ptr_opt_ OrtDnnlProviderOptions* input);
4832
4836
4859 ORT_API2_STATUS(KernelInfo_GetNodeName, _In_ const OrtKernelInfo* info, _Out_opt_ char* out, _Inout_ size_t* size);
4860
4872 ORT_API2_STATUS(KernelInfo_GetLogger, _In_ const OrtKernelInfo* info, _Outptr_ const OrtLogger** logger);
4873
4878
4890 ORT_API2_STATUS(KernelContext_GetLogger, _In_ const OrtKernelContext* context, _Outptr_ const OrtLogger** logger);
4891
4896
4915 ORT_API2_STATUS(Logger_LogMessage, _In_ const OrtLogger* logger, OrtLoggingLevel log_severity_level,
4916 _In_z_ const char* message, _In_z_ const ORTCHAR_T* file_path, int line_number,
4917 _In_z_ const char* func_name);
4918
4930 ORT_API2_STATUS(Logger_GetLoggingSeverityLevel, _In_ const OrtLogger* logger, _Out_ OrtLoggingLevel* out);
4931
4933
4947 ORT_API2_STATUS(KernelInfoGetConstantInput_tensor, _In_ const OrtKernelInfo* info, size_t index, _Out_ int* is_constant, _Outptr_ const OrtValue** out);
4948
4969 ORT_API2_STATUS(CastTypeInfoToOptionalTypeInfo, _In_ const OrtTypeInfo* type_info,
4970 _Outptr_result_maybenull_ const OrtOptionalTypeInfo** out);
4971
4988 ORT_API2_STATUS(GetOptionalContainedTypeInfo, _In_ const OrtOptionalTypeInfo* optional_type_info,
4989 _Outptr_ OrtTypeInfo** out);
4990
5001 ORT_API2_STATUS(GetResizedStringTensorElementBuffer, _Inout_ OrtValue* value, _In_ size_t index, _In_ size_t length_in_bytes, _Inout_ char** buffer);
5002
5013 ORT_API2_STATUS(KernelContext_GetAllocator, _In_ const OrtKernelContext* context, _In_ const OrtMemoryInfo* mem_info, _Outptr_ OrtAllocator** out);
5014
5021 const char*(ORT_API_CALL* GetBuildInfoString)(void);
5022
5025
5034 ORT_API2_STATUS(CreateROCMProviderOptions, _Outptr_ OrtROCMProviderOptions** out);
5035
5053 ORT_API2_STATUS(UpdateROCMProviderOptions, _Inout_ OrtROCMProviderOptions* rocm_options,
5054 _In_reads_(num_keys) const char* const* provider_options_keys,
5055 _In_reads_(num_keys) const char* const* provider_options_values,
5056 _In_ size_t num_keys);
5057
5072 ORT_API2_STATUS(GetROCMProviderOptionsAsString, _In_ const OrtROCMProviderOptions* rocm_options, _Inout_ OrtAllocator* allocator, _Outptr_ char** ptr);
5073
5080 void(ORT_API_CALL* ReleaseROCMProviderOptions)(_Frees_ptr_opt_ OrtROCMProviderOptions* input);
5081
5095 ORT_API2_STATUS(CreateAndRegisterAllocatorV2, _Inout_ OrtEnv* env, _In_ const char* provider_type,
5096 _In_ const OrtMemoryInfo* mem_info, _In_ const OrtArenaCfg* arena_cfg,
5097 _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);
5098
5117 ORT_API2_STATUS(RunAsync, _Inout_ OrtSession* session, _In_opt_ const OrtRunOptions* run_options,
5118 _In_reads_(input_len) const char* const* input_names,
5119 _In_reads_(input_len) const OrtValue* const* input, size_t input_len,
5120 _In_reads_(output_names_len) const char* const* output_names, size_t output_names_len,
5121 _Inout_updates_all_(output_names_len) OrtValue** output,
5122 _In_ RunAsyncCallbackFn run_async_callback, _In_opt_ void* user_data);
5123
5136 ORT_API2_STATUS(UpdateTensorRTProviderOptionsWithValue, _Inout_ OrtTensorRTProviderOptionsV2* tensorrt_options, _In_ const char* key, _In_ void* value);
5137
5148 ORT_API2_STATUS(GetTensorRTProviderOptionsByName, _In_ const OrtTensorRTProviderOptionsV2* tensorrt_options, _In_ const char* key, _Outptr_ void** ptr);
5149
5162 ORT_API2_STATUS(UpdateCUDAProviderOptionsWithValue, _Inout_ OrtCUDAProviderOptionsV2* cuda_options, _In_ const char* key, _In_ void* value);
5163
5174 ORT_API2_STATUS(GetCUDAProviderOptionsByName, _In_ const OrtCUDAProviderOptionsV2* cuda_options, _In_ const char* key, _Outptr_ void** ptr);
5175
5187 ORT_API2_STATUS(KernelContext_GetResource, _In_ const OrtKernelContext* context, _In_ int resource_version,
5188 _In_ int resource_id, _Outptr_ void** resource);
5189
5207 ORT_API2_STATUS(SetUserLoggingFunction, _Inout_ OrtSessionOptions* options,
5208 _In_ OrtLoggingFunction user_logging_function, _In_opt_ void* user_logging_param);
5209
5218 ORT_API2_STATUS(ShapeInferContext_GetInputCount, _In_ const OrtShapeInferContext* context, _Out_ size_t* out);
5219
5229 ORT_API2_STATUS(ShapeInferContext_GetInputTypeShape, _In_ const OrtShapeInferContext* context, _In_ size_t index, _Outptr_ OrtTensorTypeAndShapeInfo** info);
5230
5240 ORT_API2_STATUS(ShapeInferContext_GetAttribute, _In_ const OrtShapeInferContext* context, _In_ const char* attr_name, _Outptr_ const OrtOpAttr** attr);
5241
5251 ORT_API2_STATUS(ShapeInferContext_SetOutputTypeShape, _In_ const OrtShapeInferContext* context, _In_ size_t index, _In_ const OrtTensorTypeAndShapeInfo* info);
5252
5262 ORT_API2_STATUS(SetSymbolicDimensions, _In_ OrtTensorTypeAndShapeInfo* info, _In_ const char* dim_params[], _In_ size_t dim_params_length);
5263
5277 ORT_API2_STATUS(ReadOpAttr, _In_ const OrtOpAttr* op_attr, _In_ OrtOpAttrType type, _Inout_ void* data, _In_ size_t len, _Out_ size_t* out);
5278
5289 ORT_API2_STATUS(SetDeterministicCompute, _Inout_ OrtSessionOptions* options, bool value);
5290
5302 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);
5303
5318 _In_ OrtSessionOptions* options,
5319 _In_reads_(num_keys) const char* const* provider_options_keys,
5320 _In_reads_(num_keys) const char* const* provider_options_values,
5321 _In_ size_t num_keys);
5322
5337 _In_ OrtSessionOptions* options,
5338 _In_reads_(num_keys) const char* const* provider_options_keys,
5339 _In_reads_(num_keys) const char* const* provider_options_values,
5340 _In_ size_t num_keys);
5341
5353 ORT_API2_STATUS(KernelContext_GetScratchBuffer, _In_ const OrtKernelContext* context, _In_ const OrtMemoryInfo* mem_info, _In_ size_t count_or_bytes, _Outptr_ void** out);
5354
5365 ORT_API2_STATUS(KernelInfoGetAllocator, _In_ const OrtKernelInfo* info, _In_ OrtMemType mem_type, _Outptr_ OrtAllocator** out);
5366
5393 ORT_API2_STATUS(AddExternalInitializersFromFilesInMemory, _In_ OrtSessionOptions* options,
5394 _In_reads_(num_external_initializer_files) const ORTCHAR_T* const* external_initializer_file_names,
5395 _In_reads_(num_external_initializer_files) char* const* external_initializer_file_buffer_array,
5396 _In_reads_(num_external_initializer_files) const size_t* external_initializer_file_lengths,
5397 size_t num_external_initializer_files);
5398
5417 ORT_API2_STATUS(CreateLoraAdapter, const ORTCHAR_T* adapter_file_path, _In_ OrtAllocator* allocator,
5418 _Outptr_ OrtLoraAdapter** out);
5419
5437 ORT_API2_STATUS(CreateLoraAdapterFromArray, _In_ const void* bytes, size_t num_bytes, _In_ OrtAllocator* allocator,
5438 _Outptr_ OrtLoraAdapter** out);
5439
5442 ORT_CLASS_RELEASE(LoraAdapter);
5443
5460 ORT_API2_STATUS(RunOptionsAddActiveLoraAdapter, _Inout_ OrtRunOptions* options, _In_ const OrtLoraAdapter* adapter);
5461
5465
5480 ORT_API2_STATUS(SetEpDynamicOptions, _Inout_ OrtSession* sess, _In_reads_(kv_len) const char* const* keys,
5481 _In_reads_(kv_len) const char* const* values, _In_ size_t kv_len);
5482
5484
5488 ORT_CLASS_RELEASE(ValueInfo);
5489
5493 ORT_CLASS_RELEASE(Node);
5494
5498 ORT_CLASS_RELEASE(Graph);
5499
5503 ORT_CLASS_RELEASE(Model);
5504
5511 ORT_API2_STATUS(GetValueInfoName, _In_ const OrtValueInfo* value_info, _Out_ const char** name);
5512
5519 ORT_API2_STATUS(GetValueInfoTypeInfo, _In_ const OrtValueInfo* value_info, _Outptr_ const OrtTypeInfo** type_info);
5520
5529 const OrtModelEditorApi*(ORT_API_CALL* GetModelEditorApi)(void);
5530
5549 ORT_API2_STATUS(CreateTensorWithDataAndDeleterAsOrtValue, _In_ OrtAllocator* deleter,
5550 _In_ void* p_data, size_t p_data_len,
5551 _In_ const int64_t* shape, size_t shape_len,
5553 _Outptr_ OrtValue** out);
5554
5571 ORT_API2_STATUS(SessionOptionsSetLoadCancellationFlag, _Inout_ OrtSessionOptions* options,
5572 _In_ bool cancel);
5573
5587 const OrtCompileApi*(ORT_API_CALL* GetCompileApi)(void);
5588
5589 //
5590 // OrtKeyValuePairs
5591 //
5592
5601 void(ORT_API_CALL* CreateKeyValuePairs)(_Outptr_ OrtKeyValuePairs** out);
5602
5616 void(ORT_API_CALL* AddKeyValuePair)(_In_ OrtKeyValuePairs* kvps, _In_ const char* key, _In_ const char* value);
5617
5627 const char*(ORT_API_CALL* GetKeyValue)(_In_ const OrtKeyValuePairs* kvps, _In_ const char* key);
5628
5638 void(ORT_API_CALL* GetKeyValuePairs)(_In_ const OrtKeyValuePairs* kvps,
5639 _Outptr_ const char* const** keys, _Outptr_ const char* const** values,
5640 _Out_ size_t* num_entries);
5641
5649 void(ORT_API_CALL* RemoveKeyValuePair)(_In_ OrtKeyValuePairs* kvps, _In_ const char* key);
5650
5657 ORT_CLASS_RELEASE(KeyValuePairs);
5658
5672 ORT_API2_STATUS(RegisterExecutionProviderLibrary, _In_ OrtEnv* env, _In_ const char* registration_name,
5673 _In_ const ORTCHAR_T* path);
5674
5689 ORT_API2_STATUS(UnregisterExecutionProviderLibrary, _In_ OrtEnv* env, _In_ const char* registration_name);
5690
5703 ORT_API2_STATUS(GetEpDevices, _In_ const OrtEnv* env,
5704 _Outptr_ const OrtEpDevice* const** ep_devices, _Out_ size_t* num_ep_devices);
5705
5725 ORT_API2_STATUS(SessionOptionsAppendExecutionProvider_V2, _In_ OrtSessionOptions* session_options,
5726 _In_ OrtEnv* env,
5727 _In_reads_(num_ep_devices) const OrtEpDevice* const* ep_devices, _In_ size_t num_ep_devices,
5728 _In_reads_(num_op_options) const char* const* ep_option_keys,
5729 _In_reads_(num_op_options) const char* const* ep_option_vals,
5730 size_t num_ep_options);
5731
5742 ORT_API2_STATUS(SessionOptionsSetEpSelectionPolicy, _In_ OrtSessionOptions* session_options,
5744
5755 ORT_API2_STATUS(SessionOptionsSetEpSelectionPolicyDelegate, _In_ OrtSessionOptions* session_options,
5756 _In_ EpSelectionDelegate delegate,
5757 _In_opt_ void* delegate_state);
5758
5767
5775 uint32_t(ORT_API_CALL* HardwareDevice_VendorId)(_In_ const OrtHardwareDevice* device);
5776
5784 const char*(ORT_API_CALL* HardwareDevice_Vendor)(_In_ const OrtHardwareDevice* device);
5785
5794 uint32_t(ORT_API_CALL* HardwareDevice_DeviceId)(_In_ const OrtHardwareDevice* device);
5795
5804 const OrtKeyValuePairs*(ORT_API_CALL* HardwareDevice_Metadata)(_In_ const OrtHardwareDevice* device);
5805
5813 const char*(ORT_API_CALL* EpDevice_EpName)(_In_ const OrtEpDevice* ep_device);
5814
5822 const char*(ORT_API_CALL* EpDevice_EpVendor)(_In_ const OrtEpDevice* ep_device);
5823
5831 const OrtKeyValuePairs*(ORT_API_CALL* EpDevice_EpMetadata)(_In_ const OrtEpDevice* ep_device);
5832
5840 const OrtKeyValuePairs*(ORT_API_CALL* EpDevice_EpOptions)(_In_ const OrtEpDevice* ep_device);
5841
5849 const OrtHardwareDevice*(ORT_API_CALL* EpDevice_Device)(_In_ const OrtEpDevice* ep_device);
5850
5855 const OrtEpApi*(ORT_API_CALL* GetEpApi)(void);
5856
5874 ORT_API2_STATUS(GetTensorSizeInBytes, _In_ const OrtValue* ort_value, _Out_ size_t* size);
5875
5890 ORT_API2_STATUS(AllocatorGetStats, _In_ const OrtAllocator* ort_allocator, _Outptr_ OrtKeyValuePairs** out);
5891
5912 ORT_API2_STATUS(CreateMemoryInfo_V2, _In_ const char* name, _In_ enum OrtMemoryInfoDeviceType device_type,
5913 _In_ uint32_t vendor_id, _In_ int32_t device_id, _In_ enum OrtDeviceMemoryType mem_type,
5914 _In_ size_t alignment, enum OrtAllocatorType allocator_type,
5915 _Outptr_ OrtMemoryInfo** out);
5916
5925
5933 ORT_API_T(uint32_t, MemoryInfoGetVendorId, _In_ const OrtMemoryInfo* ptr);
5934
5937
5948 ORT_API2_STATUS(ValueInfo_GetValueProducer, _In_ const OrtValueInfo* value_info,
5949 _Outptr_ const OrtNode** producer_node, _Out_opt_ size_t* producer_output_index);
5950
5966 ORT_API2_STATUS(ValueInfo_GetValueNumConsumers, _In_ const OrtValueInfo* value_info, _Out_ size_t* num_consumers);
5967
5994 ORT_API2_STATUS(ValueInfo_GetValueConsumers, _In_ const OrtValueInfo* value_info,
5995 _Out_writes_all_(num_consumers) const OrtNode** nodes,
5996 _Out_writes_all_(num_consumers) int64_t* input_indices,
5997 _In_ size_t num_consumers);
5998
6018 ORT_API2_STATUS(ValueInfo_GetInitializerValue, _In_ const OrtValueInfo* value_info,
6019 _Outptr_ const OrtValue** initializer_value);
6020
6036 ORT_API2_STATUS(ValueInfo_GetExternalInitializerInfo, _In_ const OrtValueInfo* value_info,
6037 _Outptr_result_maybenull_ OrtExternalInitializerInfo** info);
6038
6053 ORT_API2_STATUS(ValueInfo_IsRequiredGraphInput, _In_ const OrtValueInfo* value_info,
6054 _Out_ bool* is_required_graph_input);
6055
6069 ORT_API2_STATUS(ValueInfo_IsOptionalGraphInput, _In_ const OrtValueInfo* value_info,
6070 _Out_ bool* is_optional_graph_input);
6071
6081 ORT_API2_STATUS(ValueInfo_IsGraphOutput, _In_ const OrtValueInfo* value_info, _Out_ bool* is_graph_output);
6082
6097 ORT_API2_STATUS(ValueInfo_IsConstantInitializer, _In_ const OrtValueInfo* value_info,
6098 _Out_ bool* is_constant_initializer);
6099
6113 ORT_API2_STATUS(ValueInfo_IsFromOuterScope, _In_ const OrtValueInfo* value_info,
6114 _Out_ bool* is_from_outer_scope);
6115
6117
6120
6130 ORT_API2_STATUS(Graph_GetName, _In_ const OrtGraph* graph, _Outptr_ const char** graph_name);
6131
6145 ORT_API2_STATUS(Graph_GetModelPath, _In_ const OrtGraph* graph, _Outptr_ const ORTCHAR_T** model_path);
6146
6156 ORT_API2_STATUS(Graph_GetOnnxIRVersion, _In_ const OrtGraph* graph, _Out_ int64_t* onnx_ir_version);
6157
6171 ORT_API2_STATUS(Graph_GetNumOperatorSets, _In_ const OrtGraph* graph, _Out_ size_t* num_operator_sets);
6172
6193 ORT_API2_STATUS(Graph_GetOperatorSets, _In_ const OrtGraph* graph,
6194 _Out_writes_(num_operator_sets) const char** domains,
6195 _Out_writes_(num_operator_sets) int64_t* opset_versions, _In_ size_t num_operator_sets);
6196
6208 ORT_API2_STATUS(Graph_GetNumInputs, _In_ const OrtGraph* graph, _Out_ size_t* num_inputs);
6209
6224 ORT_API2_STATUS(Graph_GetInputs, _In_ const OrtGraph* graph,
6225 _Out_writes_(num_inputs) const OrtValueInfo** inputs, _In_ size_t num_inputs);
6226
6236 ORT_API2_STATUS(Graph_GetNumOutputs, _In_ const OrtGraph* graph, _Out_ size_t* num_outputs);
6237
6250 ORT_API2_STATUS(Graph_GetOutputs, _In_ const OrtGraph* graph,
6251 _Out_writes_(num_outputs) const OrtValueInfo** outputs, _In_ size_t num_outputs);
6252
6264 ORT_API2_STATUS(Graph_GetNumInitializers, _In_ const OrtGraph* graph, _Out_ size_t* num_initializers);
6265
6287 ORT_API2_STATUS(Graph_GetInitializers, _In_ const OrtGraph* graph,
6288 _Out_writes_(num_initializers) const OrtValueInfo** initializers,
6289 _In_ size_t num_initializers);
6290
6300 ORT_API2_STATUS(Graph_GetNumNodes, _In_ const OrtGraph* graph, _Out_ size_t* num_nodes);
6301
6317 ORT_API2_STATUS(Graph_GetNodes, _In_ const OrtGraph* graph,
6318 _Out_writes_(num_nodes) const OrtNode** nodes, _In_ size_t num_nodes);
6319
6333 ORT_API2_STATUS(Graph_GetParentNode, _In_ const OrtGraph* graph, _Outptr_result_maybenull_ const OrtNode** node);
6334
6350 ORT_API2_STATUS(Graph_GetGraphView, _In_ const OrtGraph* src_graph, _In_ const OrtNode** nodes,
6351 _In_ size_t num_nodes, _Outptr_ OrtGraph** dst_graph);
6352
6354
6357
6370 ORT_API2_STATUS(Node_GetId, _In_ const OrtNode* node, _Out_ size_t* node_id);
6371
6381 ORT_API2_STATUS(Node_GetName, _In_ const OrtNode* node, _Outptr_ const char** node_name);
6382
6392 ORT_API2_STATUS(Node_GetOperatorType, _In_ const OrtNode* node, _Outptr_ const char** operator_type);
6393
6403 ORT_API2_STATUS(Node_GetDomain, _In_ const OrtNode* node, _Outptr_ const char** domain_name);
6404
6414 ORT_API2_STATUS(Node_GetSinceVersion, _In_ const OrtNode* node, _Out_ int* since_version);
6415
6425 ORT_API2_STATUS(Node_GetNumInputs, _In_ const OrtNode* node, _Out_ size_t* num_inputs);
6426
6439 ORT_API2_STATUS(Node_GetInputs, _In_ const OrtNode* node,
6440 _Out_writes_(num_inputs) const OrtValueInfo** inputs, _In_ size_t num_inputs);
6441
6451 ORT_API2_STATUS(Node_GetNumOutputs, _In_ const OrtNode* node, _Out_ size_t* num_outputs);
6452
6465 ORT_API2_STATUS(Node_GetOutputs, _In_ const OrtNode* node,
6466 _Out_writes_(num_outputs) const OrtValueInfo** outputs, _In_ size_t num_outputs);
6467
6481 ORT_API2_STATUS(Node_GetNumImplicitInputs, _In_ const OrtNode* node, _Out_ size_t* num_implicit_inputs);
6482
6500 ORT_API2_STATUS(Node_GetImplicitInputs, _In_ const OrtNode* node,
6501 _Out_writes_(num_implicit_inputs) const OrtValueInfo** implicit_inputs,
6502 _In_ size_t num_implicit_inputs);
6503
6513 ORT_API2_STATUS(Node_GetNumAttributes, _In_ const OrtNode* node, _Out_ size_t* num_attributes);
6514
6532 ORT_API2_STATUS(Node_GetAttributes, _In_ const OrtNode* node,
6533 _Out_writes_(num_attributes) const OrtOpAttr** attributes, _In_ size_t num_attributes);
6534
6553 ORT_API2_STATUS(Node_GetAttributeByName, _In_ const OrtNode* node, _In_ const char* attribute_name,
6554 _Outptr_result_maybenull_ const OrtOpAttr** attribute);
6555
6566 ORT_API2_STATUS(OpAttr_GetTensorAttributeAsOrtValue, _In_ const OrtOpAttr* attribute,
6567 _Outptr_result_maybenull_ OrtValue** attr_tensor);
6568
6578 ORT_API2_STATUS(OpAttr_GetType, _In_ const OrtOpAttr* attribute, _Out_ OrtOpAttrType* type);
6579
6589 ORT_API2_STATUS(OpAttr_GetName, _In_ const OrtOpAttr* attribute, _Outptr_ const char** name);
6590
6602 ORT_API2_STATUS(Node_GetNumSubgraphs, _In_ const OrtNode* node, _Out_ size_t* num_subgraphs);
6603
6621 ORT_API2_STATUS(Node_GetSubgraphs, _In_ const OrtNode* node,
6622 _Out_writes_(num_subgraphs) const OrtGraph** subgraphs, _In_ size_t num_subgraphs,
6623 _Out_writes_opt_(num_subgraphs) const char** attribute_names);
6624
6640 ORT_API2_STATUS(Node_GetGraph, _In_ const OrtNode* node, _Outptr_result_maybenull_ const OrtGraph** graph);
6641
6653 ORT_API2_STATUS(Node_GetEpName, _In_ const OrtNode* node, _Outptr_result_maybenull_ const char** out);
6654
6656
6659
6666 ORT_CLASS_RELEASE(ExternalInitializerInfo);
6667
6679 ORT_API_T(const ORTCHAR_T*, ExternalInitializerInfo_GetFilePath, _In_ const OrtExternalInitializerInfo* info);
6680
6689
6698
6700
6703
6718 ORT_API_T(const char*, GetRunConfigEntry, _In_ const OrtRunOptions* options,
6719 _In_z_ const char* config_key);
6720
6722
6732 ORT_API_T(const OrtMemoryInfo*, EpDevice_MemoryInfo, _In_ const OrtEpDevice* ep_device,
6733 _In_ OrtDeviceMemoryType memory_type);
6734
6758 ORT_API2_STATUS(CreateSharedAllocator, _In_ OrtEnv* env, _In_ const OrtEpDevice* ep_device,
6759 _In_ OrtDeviceMemoryType mem_type, _In_ OrtAllocatorType allocator_type,
6760 _In_opt_ const OrtKeyValuePairs* allocator_options,
6761 _Outptr_opt_ OrtAllocator** allocator);
6762
6781 ORT_API2_STATUS(GetSharedAllocator, _In_ OrtEnv* env, _In_ const OrtMemoryInfo* mem_info,
6782 _Outptr_result_maybenull_ OrtAllocator** allocator);
6783
6797 ORT_API2_STATUS(ReleaseSharedAllocator, _In_ OrtEnv* env, _In_ const OrtEpDevice* ep_device,
6798 _In_ OrtDeviceMemoryType mem_type);
6799
6812 ORT_API2_STATUS(GetTensorData, _In_ const OrtValue* value, _Outptr_ const void** out);
6813
6824 ORT_API2_STATUS(GetSessionOptionsConfigEntries, _In_ const OrtSessionOptions* options, _Outptr_ OrtKeyValuePairs** out);
6825
6843 ORT_API2_STATUS(SessionGetMemoryInfoForInputs, _In_ const OrtSession* session,
6844 _Out_writes_(num_inputs) const OrtMemoryInfo** inputs_memory_info,
6845 _In_ size_t num_inputs);
6846
6866 ORT_API2_STATUS(SessionGetMemoryInfoForOutputs, _In_ const OrtSession* session,
6867 _Out_writes_(num_outputs) const OrtMemoryInfo** outputs_memory_info,
6868 _In_ size_t num_outputs);
6869
6894 ORT_API2_STATUS(SessionGetEpDeviceForInputs, _In_ const OrtSession* session,
6895 _Out_writes_(num_inputs) const OrtEpDevice** inputs_ep_devices,
6896 _In_ size_t num_inputs);
6897
6913 ORT_API2_STATUS(CreateSyncStreamForEpDevice, _In_ const OrtEpDevice* ep_device,
6914 _In_opt_ const OrtKeyValuePairs* stream_options,
6915 _Outptr_ OrtSyncStream** stream);
6916
6927 ORT_API_T(void*, SyncStream_GetHandle, _In_ OrtSyncStream* stream);
6928
6929 ORT_CLASS_RELEASE(SyncStream);
6930
6955 ORT_API2_STATUS(CopyTensors, _In_ const OrtEnv* env,
6956 _In_reads_(num_tensors) const OrtValue* const* src_tensors,
6957 _In_reads_(num_tensors) OrtValue* const* dst_tensors,
6958 _In_opt_ OrtSyncStream* stream,
6959 _In_ size_t num_tensors);
6960
6970 ORT_API2_STATUS(Graph_GetModelMetadata, _In_ const OrtGraph* graph, _Outptr_ OrtModelMetadata** out);
6971
6993 ORT_API2_STATUS(GetModelCompatibilityForEpDevices,
6994 _In_reads_(num_ep_devices) const OrtEpDevice* const* ep_devices,
6995 _In_ size_t num_ep_devices,
6996 _In_ const char* compatibility_info,
6998
7001
7014 ORT_API2_STATUS(CreateExternalInitializerInfo, _In_ const ORTCHAR_T* filepath, _In_ int64_t file_offset,
7015 _In_ size_t byte_size, _Outptr_ OrtExternalInitializerInfo** out);
7016
7018
7024 ORT_API_T(bool, TensorTypeAndShape_HasShape, _In_ const OrtTensorTypeAndShapeInfo* info);
7025
7041 ORT_API2_STATUS(KernelInfo_GetConfigEntries, _In_ const OrtKernelInfo* info, _Outptr_ OrtKeyValuePairs** out);
7042
7064 ORT_API2_STATUS(KernelInfo_GetOperatorDomain, _In_ const OrtKernelInfo* info, _Out_opt_ char* out,
7065 _Inout_ size_t* size);
7066
7088 ORT_API2_STATUS(KernelInfo_GetOperatorType, _In_ const OrtKernelInfo* info, _Out_opt_ char* out,
7089 _Inout_ size_t* size);
7090
7099 ORT_API2_STATUS(KernelInfo_GetOperatorSinceVersion, _In_ const OrtKernelInfo* info,
7100 _Out_ int* since_version);
7101
7112 const OrtInteropApi*(ORT_API_CALL* GetInteropApi)(void);
7113
7135 ORT_API2_STATUS(SessionGetEpDeviceForOutputs, _In_ const OrtSession* session,
7136 _Out_writes_(num_outputs) const OrtEpDevice** outputs_ep_devices,
7137 _In_ size_t num_outputs);
7150 ORT_API2_STATUS(GetNumHardwareDevices, _In_ const OrtEnv* env, _Out_ size_t* num_devices);
7151
7171 ORT_API2_STATUS(GetHardwareDevices, _In_ const OrtEnv* env,
7172 _Out_writes_(num_devices) const OrtHardwareDevice** devices,
7173 _In_ size_t num_devices);
7174
7196 ORT_API2_STATUS(GetHardwareDeviceEpIncompatibilityDetails, _In_ const OrtEnv* env,
7197 _In_ const char* ep_name,
7198 _In_ const OrtHardwareDevice* hw,
7200
7204
7215 _In_ const OrtDeviceEpIncompatibilityDetails* details,
7216 _Out_ uint32_t* reasons_bitmask);
7217
7229 _In_ const OrtDeviceEpIncompatibilityDetails* details,
7230 _Outptr_result_maybenull_ const char** notes);
7231
7245 _In_ const OrtDeviceEpIncompatibilityDetails* details,
7246 _Out_ int32_t* error_code);
7247
7252 ORT_CLASS_RELEASE(DeviceEpIncompatibilityDetails);
7253
7255
7258
7290 ORT_API2_STATUS(GetCompatibilityInfoFromModel,
7291 _In_ const ORTCHAR_T* model_path,
7292 _In_ const char* ep_type,
7293 _Inout_ OrtAllocator* allocator,
7294 _Outptr_result_maybenull_ char** compatibility_info);
7295
7318 ORT_API2_STATUS(GetCompatibilityInfoFromModelBytes,
7319 _In_reads_(model_data_length) const void* model_data,
7320 _In_ size_t model_data_length,
7321 _In_ const char* ep_type,
7322 _Inout_ OrtAllocator* allocator,
7323 _Outptr_result_maybenull_ char** compatibility_info);
7324
7326
7339 ORT_API2_STATUS(CreateEnvWithOptions, _In_ const OrtEnvCreationOptions* options, _Outptr_ OrtEnv** out);
7340
7370 ORT_API2_STATUS(Session_GetEpGraphAssignmentInfo, _In_ const OrtSession* session,
7371 _Outptr_ const OrtEpAssignedSubgraph* const** ep_subgraphs,
7372 _Out_ size_t* num_ep_subgraphs);
7373
7384 ORT_API2_STATUS(EpAssignedSubgraph_GetEpName, _In_ const OrtEpAssignedSubgraph* ep_subgraph,
7385 _Outptr_ const char** out);
7386
7397 ORT_API2_STATUS(EpAssignedSubgraph_GetNodes, _In_ const OrtEpAssignedSubgraph* ep_subgraph,
7398 _Outptr_ const OrtEpAssignedNode* const** ep_nodes, _Out_ size_t* num_ep_nodes);
7399
7410 ORT_API2_STATUS(EpAssignedNode_GetName, _In_ const OrtEpAssignedNode* ep_node, _Outptr_ const char** out);
7411
7422 ORT_API2_STATUS(EpAssignedNode_GetDomain, _In_ const OrtEpAssignedNode* ep_node, _Outptr_ const char** out);
7423
7434 ORT_API2_STATUS(EpAssignedNode_GetOperatorType, _In_ const OrtEpAssignedNode* ep_node, _Outptr_ const char** out);
7435
7447 ORT_API_T(void, RunOptionsSetSyncStream, _Inout_ OrtRunOptions* options, _In_ OrtSyncStream* sync_stream);
7448
7469 ORT_API2_STATUS(GetTensorElementTypeAndShapeDataReference, _In_ const OrtValue* value,
7470 _Out_ ONNXTensorElementDataType* elem_type,
7471 _Outptr_result_maybenull_ const int64_t** shape_data,
7472 _Out_ size_t* shape_data_count);
7473
7484 ORT_API2_STATUS(RunOptionsEnableProfiling, _Inout_ OrtRunOptions* options, _In_ const ORTCHAR_T* profile_file_prefix);
7485
7494 ORT_API2_STATUS(RunOptionsDisableProfiling, _Inout_ OrtRunOptions* options);
7495
7515 ORT_API2_STATUS(KernelInfoGetAttributeArray_string, _In_ const OrtKernelInfo* info, _In_ const char* name,
7516 _Inout_ OrtAllocator* allocator, _Outptr_result_buffer_maybenull_(*size) char*** out, _Out_ size_t* size);
7517
7520
7539 ORT_API2_STATUS(SetPerSessionThreadPoolCallbacks, _Inout_ OrtEnv* env,
7540 _In_ const OrtThreadPoolCallbacksConfig* config);
7541
7543
7555 ORT_API2_STATUS(GetMemPatternEnabled, _In_ const OrtSessionOptions* options, _Out_ int* out);
7556
7568 ORT_API2_STATUS(GetSessionExecutionMode, _In_ const OrtSessionOptions* options, _Out_ ExecutionMode* out);
7569
7583 ORT_API2_STATUS(SessionReleaseCapturedGraph, _In_ OrtSession* session, _In_ int graph_annotation_id);
7584
7600 ORT_API_T(OrtExperimentalFnPtr, GetExperimentalFunction, _In_ const char* name);
7601
7620 ORT_API2_STATUS(KernelContext_GetSyncStream, _In_ const OrtKernelContext* context,
7621 _Outptr_result_maybenull_ OrtSyncStream** out);
7622
7646 ORT_API2_STATUS(SessionOptionsSetWeightlessSourceModelBuffer, _Inout_ OrtSessionOptions* options,
7647 _In_ const void* source_model_data, _In_ size_t source_model_data_length);
7648
7678 ORT_API2_STATUS(KernelContext_GetPreallocatedOutput, _In_ const OrtKernelContext* context, _In_ size_t output_index,
7679 _Outptr_result_maybenull_ OrtValue** output);
7680
7696 ORT_API2_STATUS(SessionOptionsSetEpContextDataReadFunc, _Inout_ OrtSessionOptions* options,
7697 _In_opt_ OrtReadNamedBufferFunc read_func, _In_opt_ void* state);
7698
7708 const OrtModelPackageApi*(ORT_API_CALL* GetModelPackageApi)(void);
7709};
7710
7711/*
7712 * Steps to use a custom op:
7713 * 1 Create an OrtCustomOpDomain with the domain name used by the custom ops
7714 * 2 Create an OrtCustomOp structure for each op and add them to the domain
7715 * 3 Call OrtAddCustomOpDomain to add the custom domain of ops to the session options
7716 */
7717
7718// Specifies some characteristics of inputs/outputs of custom ops:
7719// Specify if the inputs/outputs are one of:
7720// 1) Non-optional (input/output must be present in the node)
7721// 2) Optional (input/output may be absent in the node)
7722// 3) Variadic: A variadic input or output specifies N (i.e., the minimum arity) or more operands.
7723// Only the last input or output of a custom op may be marked as variadic.
7724// The homogeneity of the variadic input or output determines whether all operands must be of the same
7725// tensor element type.
7731
7732/*
7733 * The OrtCustomOp structure defines a custom op's schema and its kernel callbacks. The callbacks are filled in by
7734 * the implementor of the custom op.
7735 */
7737 uint32_t version; // Initialize to ORT_API_VERSION. ORT will cap the API version used to select the OrtApi passed
7738 // to CreateKernel/CreateKernelV2 callbacks, so custom ops compiled against a newer ORT can load
7739 // on an older runtime if they only use APIs available at the runtime version. Newer OrtCustomOp
7740 // function pointers are gated by per-function version checks within ORT.
7741
7742 // This callback creates the kernel, which is a user defined
7743 // parameter that is passed to the Kernel* callbacks below. It is
7744 // recommended to use CreateKernelV2 which allows for a safe error
7745 // propagation by returning an OrtStatusPtr.
7746 void*(ORT_API_CALL* CreateKernel)(_In_ const struct OrtCustomOp* op, _In_ const OrtApi* api,
7747 _In_ const OrtKernelInfo* info);
7748
7749 // Returns the name of the op
7750 const char*(ORT_API_CALL* GetName)(_In_ const struct OrtCustomOp* op);
7751
7752 // Returns the type of the execution provider, return nullptr to use CPU execution provider
7753 const char*(ORT_API_CALL* GetExecutionProviderType)(_In_ const struct OrtCustomOp* op);
7754
7755 // Returns the count and types of the input & output tensors
7756 ONNXTensorElementDataType(ORT_API_CALL* GetInputType)(_In_ const struct OrtCustomOp* op, _In_ size_t index);
7757 size_t(ORT_API_CALL* GetInputTypeCount)(_In_ const struct OrtCustomOp* op);
7758 ONNXTensorElementDataType(ORT_API_CALL* GetOutputType)(_In_ const struct OrtCustomOp* op, _In_ size_t index);
7759 size_t(ORT_API_CALL* GetOutputTypeCount)(_In_ const struct OrtCustomOp* op);
7760
7761 // Perform a computation step. It is recommended to use
7762 // KernelComputeV2 which allows for a safe error propagation by
7763 // returning an OrtStatusPtr.
7764 void(ORT_API_CALL* KernelCompute)(_In_ void* op_kernel, _In_ OrtKernelContext* context);
7765 void(ORT_API_CALL* KernelDestroy)(_In_ void* op_kernel);
7766
7767 // Returns the characteristics of the input & output tensors
7768 OrtCustomOpInputOutputCharacteristic(ORT_API_CALL* GetInputCharacteristic)(_In_ const struct OrtCustomOp* op, _In_ size_t index);
7769 OrtCustomOpInputOutputCharacteristic(ORT_API_CALL* GetOutputCharacteristic)(_In_ const struct OrtCustomOp* op, _In_ size_t index);
7770
7771 // Returns the memory type of the input tensors. This API allows the custom op
7772 // to place the inputs on specific devices. By default, it returns
7773 // OrtMemTypeDefault, which means the input is placed on the default device for
7774 // the execution provider. If the inputs need to be with different memory types,
7775 // this function can be overridden to return the specific memory types.
7776 OrtMemType(ORT_API_CALL* GetInputMemoryType)(_In_ const struct OrtCustomOp* op, _In_ size_t index);
7777
7778 // Returns the minimum number of input arguments expected for the variadic input.
7779 // Applicable only for custom ops that have a variadic input.
7780 int(ORT_API_CALL* GetVariadicInputMinArity)(_In_ const struct OrtCustomOp* op);
7781
7782 // Returns true (non-zero) if all arguments of a variadic input have to be of the same type (homogeneous),
7783 // and false (zero) otherwise.
7784 // Applicable only for custom ops that have a variadic input.
7785 int(ORT_API_CALL* GetVariadicInputHomogeneity)(_In_ const struct OrtCustomOp* op);
7786
7787 // Returns the minimum number of output values expected for the variadic output.
7788 // Applicable only for custom ops that have a variadic output.
7789 int(ORT_API_CALL* GetVariadicOutputMinArity)(_In_ const struct OrtCustomOp* op);
7790
7791 // Returns true (non-zero) if all outputs values of a variadic output have to be of the same type (homogeneous),
7792 // and false (zero) otherwise.
7793 // Applicable only for custom ops that have a variadic output.
7794 int(ORT_API_CALL* GetVariadicOutputHomogeneity)(_In_ const struct OrtCustomOp* op);
7795
7796 // Create the kernel state which is passed to each compute call.
7797 OrtStatusPtr(ORT_API_CALL* CreateKernelV2)(_In_ const struct OrtCustomOp* op, _In_ const OrtApi* api,
7798 _In_ const OrtKernelInfo* info,
7799 _Out_ void** kernel);
7800
7801 // Perform the computation step.
7802 OrtStatusPtr(ORT_API_CALL* KernelComputeV2)(_In_ void* op_kernel, _In_ OrtKernelContext* context);
7803
7804 OrtStatusPtr(ORT_API_CALL* InferOutputShapeFn)(_In_ const struct OrtCustomOp* op, _In_ OrtShapeInferContext*);
7805
7806 // Get start range
7807 int(ORT_API_CALL* GetStartVersion)(_In_ const struct OrtCustomOp* op);
7808 int(ORT_API_CALL* GetEndVersion)(_In_ const struct OrtCustomOp* op);
7809
7810 // Get the inplace_map that defines which output can reuse which input
7811 // Callers will provide 2 raw int* and pass in their address, this function will fill these 2 arrays
7812 // when return, output (*output_index)[i] may reuse the input (*input_index[i]).
7813 // The return value is the size of these 2 arrays.
7814 // Callers are responsible to delete these 2 arrays after use by calling OrtCustomOp::ReleaseMayInplace().
7815 size_t(ORT_API_CALL* GetMayInplace)(_Out_ int** input_index, _Out_ int** output_index);
7816
7817 // Release the pointer input_index and output_index allocated from GetMayInplace() function.
7818 // If GetMayInplace() is defined, this function MUST be defined as well.
7819 void(ORT_API_CALL* ReleaseMayInplace)(_Frees_ptr_opt_ int* input_index, _Frees_ptr_opt_ int* output_index);
7820
7821 // Same as GetMayInplace() and ReleaseMayInplace()
7822 size_t(ORT_API_CALL* GetAliasMap)(_Out_ int** input_index, _Out_ int** output_index);
7823 void(ORT_API_CALL* ReleaseAliasMap)(_Frees_ptr_opt_ int* input_index, _Frees_ptr_opt_ int* output_index);
7824};
7825
7838 // Model building/editing requires a full build. We return nullptr from GetModelEditorApi if this is a minimal
7839 // build, so it doesn't matter if there are no function pointers in this struct as a user will never get an
7840 // OrtModelEditorApi instance. We do however need a dummy field to avoid empty struct warning.
7841#if defined(ORT_MINIMAL_BUILD)
7842 const bool not_defined_in_this_build;
7843#else
7857 ORT_API2_STATUS(CreateTensorTypeInfo, _In_ const OrtTensorTypeAndShapeInfo* tensor_info,
7858 _Outptr_ OrtTypeInfo** type_info);
7859
7873 ORT_API2_STATUS(CreateSparseTensorTypeInfo, _In_ const OrtTensorTypeAndShapeInfo* tensor_info,
7874 _Outptr_ OrtTypeInfo** type_info);
7875
7890 ORT_API2_STATUS(CreateMapTypeInfo, ONNXTensorElementDataType map_key_type, _In_ const OrtTypeInfo* map_value_type,
7891 _Outptr_ OrtTypeInfo** type_info);
7892
7906 ORT_API2_STATUS(CreateSequenceTypeInfo, _In_ const OrtTypeInfo* sequence_type, _Outptr_ OrtTypeInfo** type_info);
7907
7921 ORT_API2_STATUS(CreateOptionalTypeInfo, _In_ const OrtTypeInfo* contained_type, _Outptr_ OrtTypeInfo** type_info);
7922
7933 ORT_API2_STATUS(CreateValueInfo, _In_ const char* name, _In_ const OrtTypeInfo* type_info,
7934 _Outptr_ OrtValueInfo** value_info);
7935
7957 ORT_API2_STATUS(CreateNode, _In_ const char* operator_name, _In_ const char* domain_name, _In_ const char* node_name,
7958 _In_reads_(input_names_len) const char* const* input_names, size_t input_names_len,
7959 _In_reads_(output_names_len) const char* const* output_names, size_t output_names_len,
7960 _In_reads_(attribs_len) _In_opt_ OrtOpAttr** attributes, _In_ size_t attribs_len,
7961 _Outptr_ OrtNode** node);
7962
7967 ORT_API2_STATUS(CreateGraph, _Outptr_ OrtGraph** graph);
7968
7987 ORT_API2_STATUS(SetGraphInputs, _Inout_ OrtGraph* graph,
7988 _In_reads_(inputs_len) _Inout_ OrtValueInfo** inputs, _In_ size_t inputs_len);
7989
8008 ORT_API2_STATUS(SetGraphOutputs, _Inout_ OrtGraph* graph,
8009 _In_reads_(outputs_len) _Inout_ OrtValueInfo** outputs, _In_ size_t outputs_len);
8010
8055 ORT_API2_STATUS(AddInitializerToGraph, _Inout_ OrtGraph* graph, _In_ const char* name, _Inout_ OrtValue* tensor,
8056 bool data_is_external);
8057
8073 ORT_API2_STATUS(AddNodeToGraph, _Inout_ OrtGraph* graph, _Inout_ OrtNode* node);
8074
8093 ORT_API2_STATUS(CreateModel,
8094 _In_reads_(opset_entries_len) const char* const* domain_names,
8095 _In_reads_(opset_entries_len) const int* opset_versions,
8096 size_t opset_entries_len,
8097 _Outptr_ OrtModel** model);
8098
8116 ORT_API2_STATUS(AddGraphToModel, _Inout_ OrtModel* model, _Inout_ OrtGraph* graph);
8117
8136 ORT_API2_STATUS(CreateSessionFromModel, _In_ const OrtEnv* env, _In_ const OrtModel* model,
8137 _In_ const OrtSessionOptions* options, _Outptr_ OrtSession** out);
8138
8161 ORT_API2_STATUS(CreateModelEditorSession, _In_ const OrtEnv* env, _In_ const ORTCHAR_T* model_path,
8162 _In_ const OrtSessionOptions* options,
8163 _Outptr_ OrtSession** out);
8164
8189 ORT_API2_STATUS(CreateModelEditorSessionFromArray, _In_ const OrtEnv* env,
8190 _In_ const void* model_data, size_t model_data_length,
8191 _In_ const OrtSessionOptions* options,
8192 _Outptr_ OrtSession** out);
8193
8208 ORT_API2_STATUS(SessionGetOpsetForDomain, _In_ const OrtSession* session, _In_ const char* domain, _Out_ int* opset);
8209
8228 ORT_API2_STATUS(ApplyModelToModelEditorSession, _Inout_ OrtSession* session, _In_ OrtModel* model);
8229
8243 ORT_API2_STATUS(FinalizeModelEditorSession, _Inout_ OrtSession* session, _In_ const OrtSessionOptions* options,
8244 _In_opt_ OrtPrepackedWeightsContainer* prepacked_weights_container);
8245#endif // !defined(ORT_MINIMAL_BUILD)
8246};
8247
8255 // Default. Do not enable any additional compilation options.
8257
8258 // Force compilation to return an error (ORT_FAIL) if no nodes were compiled.
8259 // Otherwise, a model with basic optimizations (ORT_ENABLE_BASIC) is still generated by default.
8261
8262 // Force compilation to return an error (ORT_FAIL) if a file with the same filename as the output model exists.
8263 // Otherwise, compilation will automatically overwrite the output file if it exists.
8266
8293 ORT_CLASS_RELEASE(ModelCompilationOptions);
8294
8313 ORT_API2_STATUS(CreateModelCompilationOptionsFromSessionOptions, _In_ const OrtEnv* env,
8314 _In_ const OrtSessionOptions* session_options, _Outptr_ OrtModelCompilationOptions** out);
8315
8328 ORT_API2_STATUS(ModelCompilationOptions_SetInputModelPath, _In_ OrtModelCompilationOptions* model_compile_options,
8329 _In_ const ORTCHAR_T* input_model_path);
8330
8345 _In_ OrtModelCompilationOptions* model_compile_options,
8346 _In_ const void* input_model_data,
8347 size_t input_model_data_size);
8348
8366 ORT_API2_STATUS(ModelCompilationOptions_SetOutputModelPath, _In_ OrtModelCompilationOptions* model_compile_options,
8367 _In_ const ORTCHAR_T* output_model_path);
8368
8385 _In_ OrtModelCompilationOptions* model_compile_options,
8386 _In_ const ORTCHAR_T* external_initializers_file_path,
8387 size_t external_initializers_size_threshold);
8388
8411 _In_ OrtModelCompilationOptions* model_compile_options,
8412 _Inout_ OrtAllocator* allocator,
8413 _Outptr_ void** output_model_buffer_ptr,
8414 _Out_ size_t* output_model_buffer_size_ptr);
8415
8438 ORT_API2_STATUS(ModelCompilationOptions_SetEpContextEmbedMode, _In_ OrtModelCompilationOptions* model_compile_options,
8439 bool embed_ep_context_in_model);
8440
8450 ORT_API2_STATUS(CompileModel, _In_ const OrtEnv* env, _In_ const OrtModelCompilationOptions* model_options);
8451
8461 ORT_API2_STATUS(ModelCompilationOptions_SetFlags, _In_ OrtModelCompilationOptions* model_compile_options,
8462 uint32_t flags);
8463
8478 _In_ OrtModelCompilationOptions* model_compile_options,
8479 _In_ const ORTCHAR_T* output_directory,
8480 _In_ const ORTCHAR_T* model_name);
8481
8492 _In_ OrtModelCompilationOptions* model_compile_options,
8493 _In_ GraphOptimizationLevel graph_optimization_level);
8494
8513 _In_ OrtModelCompilationOptions* model_compile_options,
8514 _In_ OrtWriteBufferFunc write_func, _In_ void* state);
8515
8529 _In_ OrtModelCompilationOptions* model_compile_options,
8530 _In_ OrtGetInitializerLocationFunc get_initializer_location_func, _In_ void* state);
8531
8552 _In_ OrtModelCompilationOptions* model_compile_options,
8553 _In_ const OrtModel* model);
8554
8577 _In_ OrtModelCompilationOptions* model_compile_options,
8578 _In_ bool use_weightless);
8579
8596 _In_ OrtModelCompilationOptions* model_compile_options,
8597 _In_opt_ OrtWriteNamedBufferFunc write_func, _In_opt_ void* state);
8598
8629 _In_ OrtModelCompilationOptions* model_compile_options,
8630 _In_ const ORTCHAR_T* logical_file_name,
8631 size_t external_initializers_size_threshold,
8632 _Inout_ OrtAllocator* allocator,
8633 _Outptr_ void** output_buffer_ptr,
8634 _Out_ size_t* output_buffer_size_ptr);
8635
8651 _In_ OrtModelCompilationOptions* model_compile_options,
8652 size_t alignment,
8653 size_t minimum_size);
8654};
8655
8689
8709 _In_ const OrtEpDevice* ep_device,
8710 _Outptr_result_maybenull_ OrtExternalResourceImporter** out_importer);
8711
8718 ORT_CLASS_RELEASE(ExternalResourceImporter);
8719
8723
8734 ORT_API2_STATUS(CanImportMemory,
8735 _In_ const OrtExternalResourceImporter* importer,
8736 _In_ OrtExternalMemoryHandleType handle_type,
8737 _Out_ bool* out_supported);
8738
8750 ORT_API2_STATUS(ImportMemory,
8751 _In_ OrtExternalResourceImporter* importer,
8752 _In_ const OrtExternalMemoryDescriptor* desc,
8753 _Outptr_ OrtExternalMemoryHandle** out_handle);
8754
8761 ORT_CLASS_RELEASE(ExternalMemoryHandle);
8762
8778 ORT_API2_STATUS(CreateTensorFromMemory,
8779 _In_ OrtExternalResourceImporter* importer,
8780 _In_ const OrtExternalMemoryHandle* mem_handle,
8781 _In_ const OrtExternalTensorDescriptor* tensor_desc,
8782 _Outptr_ OrtValue** out_tensor);
8783
8787
8798 ORT_API2_STATUS(CanImportSemaphore,
8799 _In_ const OrtExternalResourceImporter* importer,
8800 _In_ OrtExternalSemaphoreType type,
8801 _Out_ bool* out_supported);
8802
8816 ORT_API2_STATUS(ImportSemaphore,
8817 _In_ OrtExternalResourceImporter* importer,
8818 _In_ const OrtExternalSemaphoreDescriptor* desc,
8819 _Outptr_ OrtExternalSemaphoreHandle** out_handle);
8820
8827 ORT_CLASS_RELEASE(ExternalSemaphoreHandle);
8828
8844 ORT_API2_STATUS(WaitSemaphore,
8845 _In_ OrtExternalResourceImporter* importer,
8846 _In_ OrtExternalSemaphoreHandle* semaphore_handle,
8847 _In_ OrtSyncStream* stream,
8848 _In_ uint64_t value);
8849
8865 ORT_API2_STATUS(SignalSemaphore,
8866 _In_ OrtExternalResourceImporter* importer,
8867 _In_ OrtExternalSemaphoreHandle* semaphore_handle,
8868 _In_ OrtSyncStream* stream,
8869 _In_ uint64_t value);
8870
8874
8896 ORT_API2_STATUS(InitGraphicsInteropForEpDevice, _In_ const OrtEpDevice* ep_device,
8897 _In_ const OrtGraphicsInteropConfig* config);
8898
8915 ORT_API2_STATUS(DeinitGraphicsInteropForEpDevice, _In_ const OrtEpDevice* ep_device);
8916
8918};
8919
8945 _In_ const OrtEnv* env,
8946 _In_ const OrtSessionOptions* session_options,
8947 _Outptr_ OrtModelPackageOptions** out);
8948
8955 ORT_CLASS_RELEASE(ModelPackageOptions);
8956
8968 ORT_API2_STATUS(CreateModelPackageContext,
8969 _In_ const ORTCHAR_T* package_root,
8970 _Outptr_ OrtModelPackageContext** out);
8971
8978 ORT_CLASS_RELEASE(ModelPackageContext);
8979
8989 ORT_API2_STATUS(ModelPackage_GetSchemaVersion,
8990 _In_ const OrtModelPackageContext* ctx,
8991 _Out_ int64_t* out_version);
8992
9002 ORT_API2_STATUS(ModelPackage_GetComponentCount,
9003 _In_ const OrtModelPackageContext* ctx,
9004 _Out_ size_t* out_count);
9005
9018 ORT_API2_STATUS(ModelPackage_GetComponentNames,
9019 _In_ const OrtModelPackageContext* ctx,
9020 _Outptr_result_buffer_maybenull_(*out_count) const char* const** out_names,
9021 _Out_ size_t* out_count);
9022
9033 ORT_API2_STATUS(ModelPackage_GetVariantCount,
9034 _In_ const OrtModelPackageContext* ctx,
9035 _In_ const char* component_name,
9036 _Out_ size_t* out_count);
9037
9051 ORT_API2_STATUS(ModelPackage_GetVariantNames,
9052 _In_ const OrtModelPackageContext* ctx,
9053 _In_ const char* component_name,
9054 _Outptr_result_buffer_maybenull_(*out_count) const char* const** out_variant_names,
9055 _Out_ size_t* out_count);
9056
9071 ORT_API2_STATUS(ModelPackage_GetVariantEpName,
9072 _In_ const OrtModelPackageContext* ctx,
9073 _In_ const char* component_name,
9074 _In_ const char* variant_name,
9075 _Outptr_result_maybenull_ const char** out_ep);
9076
9093 ORT_API2_STATUS(ModelPackage_ResolveStringRef,
9094 _In_ const OrtModelPackageContext* ctx,
9095 _In_opt_ const char* base_dir,
9096 _In_ const char* input,
9097 _In_ int must_exist,
9098 _Outptr_ const char** out_path);
9099
9114 ORT_API2_STATUS(SelectComponent,
9115 _In_ const OrtModelPackageContext* context,
9116 _In_ const char* component_name,
9117 _In_ const OrtModelPackageOptions* options,
9119
9126 ORT_CLASS_RELEASE(ModelPackageComponentContext);
9127
9140 _In_ const OrtModelPackageComponentContext* ctx,
9141 _Outptr_ const char** out_name);
9142
9155 _In_ const OrtModelPackageComponentContext* ctx,
9156 _Outptr_ const ORTCHAR_T** folder_path);
9157
9174 ORT_API2_STATUS(CreateSession,
9175 _In_ const OrtEnv* env,
9176 _In_ OrtModelPackageComponentContext* context,
9177 _In_opt_ const OrtSessionOptions* session_options,
9178 _Outptr_ OrtSession** session);
9179};
9180
9181/*
9182 * This is the old way to add the CUDA provider to the session, please use SessionOptionsAppendExecutionProvider_CUDA above to access the latest functionality
9183 * This function always exists, but will only succeed if Onnxruntime was built with CUDA support and the CUDA provider shared library exists
9184 *
9185 * \param device_id CUDA device id, starts from zero.
9186 */
9187ORT_API_STATUS(OrtSessionOptionsAppendExecutionProvider_CUDA, _In_ OrtSessionOptions* options, int device_id);
9188
9189/*
9190 * This is the old way to add the ROCm provider to the session, please use
9191 * SessionOptionsAppendExecutionProvider_ROCM above to access the latest functionality
9192 * This function always exists, but will only succeed if Onnxruntime was built with
9193 * HIP support and the ROCm provider shared library exists
9194 *
9195 * \param device_id HIP device id, starts from zero.
9196 */
9197ORT_API_STATUS(OrtSessionOptionsAppendExecutionProvider_ROCM, _In_ OrtSessionOptions* options, int device_id);
9198
9199/*
9200 * This is the old way to add the MIGraphX provider to the session, please use
9201 * SessionOptionsAppendExecutionProvider_MIGraphX above to access the latest functionality
9202 * This function always exists, but will only succeed if Onnxruntime was built with
9203 * HIP support and the MIGraphX provider shared library exists
9204 *
9205 * \param device_id HIP device id, starts from zero.
9206 */
9207ORT_API_STATUS(OrtSessionOptionsAppendExecutionProvider_MIGraphX, _In_ OrtSessionOptions* options, int device_id);
9208
9209/*
9210 * This is the old way to add the oneDNN provider to the session, please use
9211 * SessionOptionsAppendExecutionProvider_oneDNN above to access the latest functionality
9212 * This function always exists, but will only succeed if Onnxruntime was built with
9213 * oneDNN support and the oneDNN provider shared library exists
9214 *
9215 * \param use_arena zero: false. non-zero: true.
9216 */
9217ORT_API_STATUS(OrtSessionOptionsAppendExecutionProvider_Dnnl, _In_ OrtSessionOptions* options, int use_arena);
9218
9219/*
9220 * This is the old way to add the TensorRT provider to the session, please use SessionOptionsAppendExecutionProvider_TensorRT_V2 above to access the latest functionality
9221 * This function always exists, but will only succeed if Onnxruntime was built with TensorRT support and the TensorRT provider shared library exists
9222 *
9223 * \param device_id CUDA device id, starts from zero.
9224 */
9225ORT_API_STATUS(OrtSessionOptionsAppendExecutionProvider_Tensorrt, _In_ OrtSessionOptions* options, int device_id);
9226
9227#ifdef __cplusplus
9228}
9229#endif
9231
9232#include "onnxruntime_ep_c_api.h"
OrtStatus * OrtSessionOptionsAppendExecutionProvider_MIGraphX(OrtSessionOptions *options, int device_id)
void(* OrtExperimentalFnPtr)(void)
Generic function pointer type for experimental API lookup.
Definition onnxruntime_c_api.h:360
struct OrtMemoryInfo OrtMemoryInfo
Definition onnxruntime_c_api.h:298
struct OrtLoraAdapter OrtLoraAdapter
Definition onnxruntime_c_api.h:324
struct OrtHardwareDevice OrtHardwareDevice
Definition onnxruntime_c_api.h:331
struct OrtKernelInfo OrtKernelInfo
Definition onnxruntime_c_api.h:488
struct OrtNode OrtNode
Definition onnxruntime_c_api.h:326
OrtStatus * OrtSessionOptionsAppendExecutionProvider_Tensorrt(OrtSessionOptions *options, int device_id)
struct OrtEpAssignedNode OrtEpAssignedNode
Definition onnxruntime_c_api.h:341
OrtLoggingLevel
Logging severity levels.
Definition onnxruntime_c_api.h:266
const struct OrtCustomHandleType * OrtCustomThreadHandle
OrtMemoryInfoDeviceType
This mimics OrtDevice type constants so they can be returned in the API.
Definition onnxruntime_c_api.h:523
struct OrtModelCompilationOptions OrtModelCompilationOptions
Definition onnxruntime_c_api.h:329
struct OrtShapeInferContext OrtShapeInferContext
Definition onnxruntime_c_api.h:323
void(* OrtLoggingFunction)(void *param, OrtLoggingLevel severity, const char *category, const char *logid, const char *code_location, const char *message)
Definition onnxruntime_c_api.h:452
void(* OrtCustomJoinThreadFn)(OrtCustomThreadHandle ort_custom_thread_handle)
Custom thread join function.
Definition onnxruntime_c_api.h:1047
OrtStatus *(* RegisterCustomOpsFn)(OrtSessionOptions *options, const OrtApiBase *api)
Definition onnxruntime_c_api.h:1112
OrtCustomOpInputOutputCharacteristic
Definition onnxruntime_c_api.h:7726
struct OrtTensorRTProviderOptionsV2 OrtTensorRTProviderOptionsV2
Definition onnxruntime_c_api.h:315
struct OrtOpAttr OrtOpAttr
Definition onnxruntime_c_api.h:321
struct OrtThreadingOptions OrtThreadingOptions
Definition onnxruntime_c_api.h:312
struct OrtSequenceTypeInfo OrtSequenceTypeInfo
Definition onnxruntime_c_api.h:306
OrtGraphicsApi
Graphics API type for interop configuration.
Definition onnxruntime_c_api.h:1196
OrtLanguageProjection
Language projection identifiers /see OrtApi::SetLanguageProjection.
Definition onnxruntime_c_api.h:477
struct OrtValueInfo OrtValueInfo
Definition onnxruntime_c_api.h:325
struct OrtDnnlProviderOptions OrtDnnlProviderOptions
Definition onnxruntime_c_api.h:319
OrtSparseIndicesFormat
Definition onnxruntime_c_api.h:255
struct OrtPrepackedWeightsContainer OrtPrepackedWeightsContainer
Definition onnxruntime_c_api.h:314
OrtExternalMemoryHandleType
External memory handle type for importing GPU/NPU resources.
Definition onnxruntime_c_api.h:1129
struct OrtSession OrtSession
Definition onnxruntime_c_api.h:300
OrtCompiledModelCompatibility
Definition onnxruntime_c_api.h:1273
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:577
struct OrtCustomOpDomain OrtCustomOpDomain
Definition onnxruntime_c_api.h:309
OrtExternalSemaphoreType
External semaphore type for GPU synchronization.
Definition onnxruntime_c_api.h:1169
struct OrtIoBinding OrtIoBinding
Definition onnxruntime_c_api.h:299
struct OrtExternalInitializerInfo OrtExternalInitializerInfo
Definition onnxruntime_c_api.h:335
OrtAllocatorType
Definition onnxruntime_c_api.h:494
struct OrtOp OrtOp
Definition onnxruntime_c_api.h:320
struct OrtModelMetadata OrtModelMetadata
Definition onnxruntime_c_api.h:310
OrtDeviceEpIncompatibilityReason
Reasons why an execution provider might not be compatible with a device.
Definition onnxruntime_c_api.h:550
struct OrtTypeInfo OrtTypeInfo
Definition onnxruntime_c_api.h:303
OrtStatus *(* OrtWriteNamedBufferFunc)(void *state, const char *name, const void *buffer, size_t buffer_num_bytes)
Function called to write named binary data.
Definition onnxruntime_c_api.h:614
struct OrtTensorTypeAndShapeInfo OrtTensorTypeAndShapeInfo
Definition onnxruntime_c_api.h:304
struct OrtCUDAProviderOptionsV2 OrtCUDAProviderOptionsV2
Definition onnxruntime_c_api.h:317
void(* OrtThreadPoolWorkStartFn)(void *user_context, void *enqueue_data)
Thread pool work start callback.
Definition onnxruntime_c_api.h:1068
struct OrtKernelContext OrtKernelContext
Definition onnxruntime_c_api.h:490
OrtStatus * OrtSessionOptionsAppendExecutionProvider_Dnnl(OrtSessionOptions *options, int use_arena)
OrtStatus *(* OrtReadNamedBufferFunc)(void *state, const char *name, OrtAllocator *allocator, void **buffer, size_t *data_size)
Function called to read named binary data.
Definition onnxruntime_c_api.h:634
OrtEpContextDataCallbackSupportFlags
Flags describing an execution provider's support for application-managed external EPContext data.
Definition onnxruntime_c_api.h:644
OrtCudnnConvAlgoSearch
Algorithm to use for cuDNN Convolution Op.
Definition onnxruntime_c_api.h:694
struct OrtCANNProviderOptions OrtCANNProviderOptions
Definition onnxruntime_c_api.h:318
struct OrtEpDevice OrtEpDevice
Definition onnxruntime_c_api.h:332
struct OrtExternalResourceImporter OrtExternalResourceImporter
Definition onnxruntime_c_api.h:336
void(* RunAsyncCallbackFn)(void *user_data, OrtValue **outputs, size_t num_outputs, OrtStatusPtr status)
Callback function for RunAsync.
Definition onnxruntime_c_api.h:1121
struct OrtRunOptions OrtRunOptions
Definition onnxruntime_c_api.h:302
OrtHardwareDeviceType
Definition onnxruntime_c_api.h:530
struct OrtModel OrtModel
Definition onnxruntime_c_api.h:328
struct OrtGraph OrtGraph
Definition onnxruntime_c_api.h:327
struct OrtSyncStream OrtSyncStream
Definition onnxruntime_c_api.h:334
void(* OrtThreadWorkerFn)(void *ort_worker_fn_param)
Thread work loop function.
Definition onnxruntime_c_api.h:1029
struct OrtEpAssignedSubgraph OrtEpAssignedSubgraph
Definition onnxruntime_c_api.h:340
OrtStatus * OrtSessionOptionsAppendExecutionProvider_ROCM(OrtSessionOptions *options, int device_id)
struct OrtOptionalTypeInfo OrtOptionalTypeInfo
Definition onnxruntime_c_api.h:307
struct OrtSessionOptions OrtSessionOptions
Definition onnxruntime_c_api.h:308
OrtDeviceMemoryType
This matches OrtDevice::MemoryType values.
Definition onnxruntime_c_api.h:516
struct OrtValue OrtValue
Definition onnxruntime_c_api.h:301
OrtStatus *(* OrtWriteBufferFunc)(void *state, const void *buffer, size_t buffer_num_bytes)
Function called by ORT to write a buffer to a custom destination (e.g., file, stream,...
Definition onnxruntime_c_api.h:596
GraphOptimizationLevel
Graph optimization level.
Definition onnxruntime_c_api.h:461
struct OrtKeyValuePairs OrtKeyValuePairs
Definition onnxruntime_c_api.h:333
OrtStatus * OrtStatusPtr
Definition onnxruntime_c_api.h:349
struct OrtModelPackageComponentContext OrtModelPackageComponentContext
Definition onnxruntime_c_api.h:344
OrtMemType
Memory types for allocated memory, execution provider specific types should be extended in each provi...
Definition onnxruntime_c_api.h:504
OrtSparseFormat
Definition onnxruntime_c_api.h:247
ONNXType
Definition onnxruntime_c_api.h:235
struct OrtEnv OrtEnv
Definition onnxruntime_c_api.h:296
OrtErrorCode
Error codes reported by ONNX Runtime.
Definition onnxruntime_error_code.h:19
struct OrtStatus OrtStatus
Definition onnxruntime_c_api.h:297
struct OrtDeviceEpIncompatibilityDetails OrtDeviceEpIncompatibilityDetails
Definition onnxruntime_c_api.h:339
OrtStatus *(* OrtGetInitializerLocationFunc)(void *state, const char *initializer_name, const OrtValue *initializer_value, const OrtExternalInitializerInfo *external_info, OrtExternalInitializerInfo **new_external_info)
Function called by ORT to allow user to specify how an initializer should be saved,...
Definition onnxruntime_c_api.h:685
struct OrtLogger OrtLogger
Definition onnxruntime_c_api.h:322
struct OrtMapTypeInfo OrtMapTypeInfo
Definition onnxruntime_c_api.h:305
struct OrtArenaCfg OrtArenaCfg
Definition onnxruntime_c_api.h:313
ExecutionMode
Definition onnxruntime_c_api.h:469
OrtStatus * OrtSessionOptionsAppendExecutionProvider_CUDA(OrtSessionOptions *options, int device_id)
struct OrtModelPackageContext OrtModelPackageContext
Definition onnxruntime_c_api.h:343
OrtOpAttrType
Definition onnxruntime_c_api.h:274
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:1040
struct OrtModelPackageOptions OrtModelPackageOptions
Definition onnxruntime_c_api.h:342
ONNXTensorElementDataType
Definition onnxruntime_c_api.h:194
OrtCompileApiFlags
Flags representing options to enable when compiling a model.
Definition onnxruntime_c_api.h:8254
OrtExecutionProviderDevicePolicy
These are the default EP selection policies used by ORT when doing automatic EP selection.
Definition onnxruntime_c_api.h:538
void *(* OrtThreadPoolWorkEnqueueFn)(void *user_context)
Thread pool work enqueue callback.
Definition onnxruntime_c_api.h:1058
void(* OrtThreadPoolWorkStopFn)(void *user_context, void *enqueue_data)
Thread pool work stop callback.
Definition onnxruntime_c_api.h:1079
void(* OrtThreadPoolWorkAbandonFn)(void *user_context, void *enqueue_data)
Thread pool work abandon callback.
Definition onnxruntime_c_api.h:1088
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:267
@ ORT_LOGGING_LEVEL_INFO
Informational messages.
Definition onnxruntime_c_api.h:268
@ ORT_LOGGING_LEVEL_ERROR
Error messages.
Definition onnxruntime_c_api.h:270
@ ORT_LOGGING_LEVEL_WARNING
Warning messages.
Definition onnxruntime_c_api.h:269
@ ORT_LOGGING_LEVEL_FATAL
Fatal error messages (most severe).
Definition onnxruntime_c_api.h:271
@ OrtMemoryInfoDeviceType_GPU
Definition onnxruntime_c_api.h:525
@ OrtMemoryInfoDeviceType_FPGA
Definition onnxruntime_c_api.h:526
@ OrtMemoryInfoDeviceType_CPU
Definition onnxruntime_c_api.h:524
@ OrtMemoryInfoDeviceType_NPU
Definition onnxruntime_c_api.h:527
@ INPUT_OUTPUT_VARIADIC
Definition onnxruntime_c_api.h:7729
@ INPUT_OUTPUT_REQUIRED
Definition onnxruntime_c_api.h:7727
@ INPUT_OUTPUT_OPTIONAL
Definition onnxruntime_c_api.h:7728
@ ORT_GRAPHICS_API_D3D12
Definition onnxruntime_c_api.h:1198
@ ORT_GRAPHICS_API_VULKAN
Definition onnxruntime_c_api.h:1199
@ ORT_GRAPHICS_API_NONE
Definition onnxruntime_c_api.h:1197
@ ORT_PROJECTION_C
Definition onnxruntime_c_api.h:478
@ ORT_PROJECTION_PYTHON
Definition onnxruntime_c_api.h:481
@ ORT_PROJECTION_CPLUSPLUS
Definition onnxruntime_c_api.h:479
@ ORT_PROJECTION_WINML
Definition onnxruntime_c_api.h:483
@ ORT_PROJECTION_CSHARP
Definition onnxruntime_c_api.h:480
@ ORT_PROJECTION_JAVA
Definition onnxruntime_c_api.h:482
@ ORT_PROJECTION_NODEJS
Definition onnxruntime_c_api.h:484
@ ORT_SPARSE_COO_INDICES
Definition onnxruntime_c_api.h:256
@ ORT_SPARSE_BLOCK_SPARSE_INDICES
Definition onnxruntime_c_api.h:259
@ ORT_SPARSE_CSR_OUTER_INDICES
Definition onnxruntime_c_api.h:258
@ ORT_SPARSE_CSR_INNER_INDICES
Definition onnxruntime_c_api.h:257
@ ORT_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE
Definition onnxruntime_c_api.h:1130
@ ORT_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP
Definition onnxruntime_c_api.h:1131
@ ORT_EXTERNAL_MEMORY_HANDLE_TYPE_MEMORY_OPAQUE_FD
Definition onnxruntime_c_api.h:1134
@ ORT_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_ALLOCATION
Definition onnxruntime_c_api.h:1136
@ ORT_EXTERNAL_MEMORY_HANDLE_TYPE_MEMORY_WIN32
Definition onnxruntime_c_api.h:1132
@ OrtCompiledModelCompatibility_EP_SUPPORTED_PREFER_RECOMPILATION
Definition onnxruntime_c_api.h:1276
@ OrtCompiledModelCompatibility_EP_NOT_APPLICABLE
Definition onnxruntime_c_api.h:1274
@ OrtCompiledModelCompatibility_EP_SUPPORTED_OPTIMAL
Definition onnxruntime_c_api.h:1275
@ OrtCompiledModelCompatibility_EP_UNSUPPORTED
Definition onnxruntime_c_api.h:1277
@ ORT_EXTERNAL_SEMAPHORE_VK_TIMELINE_SEMAPHORE_WIN32
Definition onnxruntime_c_api.h:1171
@ ORT_EXTERNAL_SEMAPHORE_VK_TIMELINE_SEMAPHORE_OPAQUE_FD
Definition onnxruntime_c_api.h:1172
@ ORT_EXTERNAL_SEMAPHORE_D3D12_FENCE
Definition onnxruntime_c_api.h:1170
@ OrtDeviceAllocator
Definition onnxruntime_c_api.h:496
@ OrtArenaAllocator
Definition onnxruntime_c_api.h:497
@ OrtReadOnlyAllocator
Definition onnxruntime_c_api.h:498
@ OrtInvalidAllocator
Definition onnxruntime_c_api.h:495
@ OrtDeviceEpIncompatibility_DEVICE_INCOMPATIBLE
Definition onnxruntime_c_api.h:553
@ OrtDeviceEpIncompatibility_MISSING_DEPENDENCY
Definition onnxruntime_c_api.h:554
@ OrtDeviceEpIncompatibility_DRIVER_INCOMPATIBLE
Definition onnxruntime_c_api.h:552
@ OrtDeviceEpIncompatibility_NONE
Definition onnxruntime_c_api.h:551
@ OrtDeviceEpIncompatibility_UNKNOWN
Definition onnxruntime_c_api.h:555
@ OrtEpContextDataCallbackSupportFlags_READ
Definition onnxruntime_c_api.h:649
@ OrtEpContextDataCallbackSupportFlags_WRITE
Definition onnxruntime_c_api.h:652
@ OrtEpContextDataCallbackSupportFlags_NONE
Definition onnxruntime_c_api.h:646
@ OrtCudnnConvAlgoSearchDefault
Definition onnxruntime_c_api.h:697
@ OrtCudnnConvAlgoSearchExhaustive
Definition onnxruntime_c_api.h:695
@ OrtCudnnConvAlgoSearchHeuristic
Definition onnxruntime_c_api.h:696
@ OrtHardwareDeviceType_CPU
Definition onnxruntime_c_api.h:531
@ OrtHardwareDeviceType_NPU
Definition onnxruntime_c_api.h:533
@ OrtHardwareDeviceType_GPU
Definition onnxruntime_c_api.h:532
@ OrtDeviceMemoryType_HOST_ACCESSIBLE
Shared/pinned memory for transferring between CPU and the device.
Definition onnxruntime_c_api.h:518
@ OrtDeviceMemoryType_DEFAULT
Device memory.
Definition onnxruntime_c_api.h:517
@ ORT_ENABLE_BASIC
Definition onnxruntime_c_api.h:463
@ ORT_ENABLE_ALL
Definition onnxruntime_c_api.h:466
@ ORT_ENABLE_LAYOUT
Definition onnxruntime_c_api.h:465
@ ORT_DISABLE_ALL
Definition onnxruntime_c_api.h:462
@ ORT_ENABLE_EXTENDED
Definition onnxruntime_c_api.h:464
@ OrtMemTypeCPUInput
Any CPU memory used by non-CPU execution provider.
Definition onnxruntime_c_api.h:506
@ OrtMemTypeCPU
CPU accessible memory allocated by non-CPU execution provider, i.e. HOST_ACCESSIBLE.
Definition onnxruntime_c_api.h:510
@ OrtMemTypeDefault
The default allocator for execution provider.
Definition onnxruntime_c_api.h:512
@ OrtMemTypeCPUOutput
CPU accessible memory outputted by non-CPU execution provider, i.e. HOST_ACCESSIBLE.
Definition onnxruntime_c_api.h:508
@ ORT_SPARSE_CSRC
Definition onnxruntime_c_api.h:250
@ ORT_SPARSE_COO
Definition onnxruntime_c_api.h:249
@ ORT_SPARSE_BLOCK_SPARSE
Definition onnxruntime_c_api.h:251
@ ORT_SPARSE_UNDEFINED
Definition onnxruntime_c_api.h:248
@ ONNX_TYPE_SEQUENCE
Definition onnxruntime_c_api.h:238
@ ONNX_TYPE_MAP
Definition onnxruntime_c_api.h:239
@ ONNX_TYPE_OPAQUE
Definition onnxruntime_c_api.h:240
@ ONNX_TYPE_UNKNOWN
Definition onnxruntime_c_api.h:236
@ ONNX_TYPE_TENSOR
Definition onnxruntime_c_api.h:237
@ ONNX_TYPE_SPARSETENSOR
Definition onnxruntime_c_api.h:241
@ ONNX_TYPE_OPTIONAL
Definition onnxruntime_c_api.h:242
@ ORT_PARALLEL
Definition onnxruntime_c_api.h:471
@ ORT_SEQUENTIAL
Definition onnxruntime_c_api.h:470
@ ORT_OP_ATTR_INT
Definition onnxruntime_c_api.h:276
@ ORT_OP_ATTR_FLOATS
Definition onnxruntime_c_api.h:279
@ ORT_OP_ATTR_STRINGS
Definition onnxruntime_c_api.h:281
@ ORT_OP_ATTR_UNDEFINED
Definition onnxruntime_c_api.h:275
@ ORT_OP_ATTR_GRAPH
Definition onnxruntime_c_api.h:282
@ ORT_OP_ATTR_TENSOR
Definition onnxruntime_c_api.h:283
@ ORT_OP_ATTR_INTS
Definition onnxruntime_c_api.h:277
@ ORT_OP_ATTR_STRING
Definition onnxruntime_c_api.h:280
@ ORT_OP_ATTR_FLOAT
Definition onnxruntime_c_api.h:278
@ ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT6E2M3
Definition onnxruntime_c_api.h:230
@ ONNX_TENSOR_ELEMENT_DATA_TYPE_STRING
Definition onnxruntime_c_api.h:203
@ ONNX_TENSOR_ELEMENT_DATA_TYPE_INT32
Definition onnxruntime_c_api.h:201
@ ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT32
Definition onnxruntime_c_api.h:207
@ ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT8E8M0
Definition onnxruntime_c_api.h:226
@ ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT2
Definition onnxruntime_c_api.h:223
@ ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT16
Definition onnxruntime_c_api.h:199
@ ONNX_TENSOR_ELEMENT_DATA_TYPE_UNDEFINED
Definition onnxruntime_c_api.h:195
@ ONNX_TENSOR_ELEMENT_DATA_TYPE_COMPLEX128
Definition onnxruntime_c_api.h:210
@ ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT8E5M2FNUZ
Definition onnxruntime_c_api.h:216
@ ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT64
Definition onnxruntime_c_api.h:208
@ ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT4
Definition onnxruntime_c_api.h:218
@ ONNX_TENSOR_ELEMENT_DATA_TYPE_INT64
Definition onnxruntime_c_api.h:202
@ ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT4E2M1
Definition onnxruntime_c_api.h:221
@ ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT8E5M2
Definition onnxruntime_c_api.h:215
@ ONNX_TENSOR_ELEMENT_DATA_TYPE_BOOL
Definition onnxruntime_c_api.h:204
@ ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT6E3M2
Definition onnxruntime_c_api.h:231
@ ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT16
Definition onnxruntime_c_api.h:205
@ ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT8
Definition onnxruntime_c_api.h:197
@ ONNX_TENSOR_ELEMENT_DATA_TYPE_INT16
Definition onnxruntime_c_api.h:200
@ ONNX_TENSOR_ELEMENT_DATA_TYPE_DOUBLE
Definition onnxruntime_c_api.h:206
@ ONNX_TENSOR_ELEMENT_DATA_TYPE_INT8
Definition onnxruntime_c_api.h:198
@ ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT
Definition onnxruntime_c_api.h:196
@ ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT8E4M3FN
Definition onnxruntime_c_api.h:213
@ ONNX_TENSOR_ELEMENT_DATA_TYPE_BFLOAT16
Definition onnxruntime_c_api.h:211
@ ONNX_TENSOR_ELEMENT_DATA_TYPE_INT4
Definition onnxruntime_c_api.h:219
@ ONNX_TENSOR_ELEMENT_DATA_TYPE_COMPLEX64
Definition onnxruntime_c_api.h:209
@ ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT8E4M3FNUZ
Definition onnxruntime_c_api.h:214
@ ONNX_TENSOR_ELEMENT_DATA_TYPE_INT2
Definition onnxruntime_c_api.h:224
@ OrtCompileApiFlags_NONE
Definition onnxruntime_c_api.h:8256
@ OrtCompileApiFlags_ERROR_IF_NO_NODES_COMPILED
Definition onnxruntime_c_api.h:8260
@ OrtCompileApiFlags_ERROR_IF_OUTPUT_FILE_EXISTS
Definition onnxruntime_c_api.h:8264
@ OrtExecutionProviderDevicePolicy_DEFAULT
Definition onnxruntime_c_api.h:539
@ OrtExecutionProviderDevicePolicy_PREFER_CPU
Definition onnxruntime_c_api.h:540
@ OrtExecutionProviderDevicePolicy_MAX_PERFORMANCE
Definition onnxruntime_c_api.h:543
@ OrtExecutionProviderDevicePolicy_PREFER_NPU
Definition onnxruntime_c_api.h:541
@ OrtExecutionProviderDevicePolicy_MAX_EFFICIENCY
Definition onnxruntime_c_api.h:544
@ OrtExecutionProviderDevicePolicy_PREFER_GPU
Definition onnxruntime_c_api.h:542
@ OrtExecutionProviderDevicePolicy_MIN_OVERALL_POWER
Definition onnxruntime_c_api.h:545
Memory allocation interface.
Definition onnxruntime_c_api.h:368
void(* Free)(struct OrtAllocator *this_, void *p)
Free a block of memory previously allocated with OrtAllocator::Alloc.
Definition onnxruntime_c_api.h:375
const struct OrtMemoryInfo *(* Info)(const struct OrtAllocator *this_)
Return a pointer to an OrtMemoryInfo that describes this allocator.
Definition onnxruntime_c_api.h:378
uint32_t version
Must be initialized to ORT_API_VERSION.
Definition onnxruntime_c_api.h:369
OrtStatus * Shrink(struct OrtAllocator *this_)
Release unused memory held by the allocator back to the system.
void *(* Alloc)(struct OrtAllocator *this_, size_t size)
Returns a pointer to an allocated block of size bytes.
Definition onnxruntime_c_api.h:372
void *(* AllocOnStream)(struct OrtAllocator *this_, size_t size, OrtSyncStream *stream)
Allocate using a stream.
Definition onnxruntime_c_api.h:433
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:389
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:997
const char *(* GetVersionString)(void)
Returns a null terminated string of the version of the Onnxruntime library (eg: "1....
Definition onnxruntime_c_api.h:1013
const OrtApi *(* GetApi)(uint32_t version)
Get a pointer to the requested version of the OrtApi.
Definition onnxruntime_c_api.h:1007
The C API.
Definition onnxruntime_c_api.h:1375
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 * Graph_GetNumInputs(const OrtGraph *graph, size_t *num_inputs)
Returns the number of graph inputs.
OrtStatus * Node_GetOperatorType(const OrtNode *node, const char **operator_type)
Returns a node's operator type (e.g., "Conv").
OrtStatus * CreateSessionOptions(OrtSessionOptions **options)
Create an OrtSessionOptions object.
OrtHardwareDeviceType(* HardwareDevice_Type)(const OrtHardwareDevice *device)
Get the hardware device type.
Definition onnxruntime_c_api.h:5766
void(* ReleaseDnnlProviderOptions)(OrtDnnlProviderOptions *input)
Release an OrtDnnlProviderOptions.
Definition onnxruntime_c_api.h:4831
OrtStatus * GetTensorData(const OrtValue *value, const void **out)
Get a const pointer to the raw data inside a tensor.
OrtStatus * TensorAt(OrtValue *value, const int64_t *location_values, size_t location_values_count, void **out)
Direct memory access to a specified tensor element.
const OrtModelPackageApi *(* GetModelPackageApi)(void)
Get the stable model package API table.
Definition onnxruntime_c_api.h:7708
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:5021
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 * ValueInfo_IsFromOuterScope(const OrtValueInfo *value_info, bool *is_from_outer_scope)
Returns a boolean indicating if the given value is defined in an outer scope.
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.
OrtStatus * AddFreeDimensionOverrideByName(OrtSessionOptions *options, const char *dim_name, int64_t dim_value)
OrtStatus * GetSharedAllocator(OrtEnv *env, const OrtMemoryInfo *mem_info, OrtAllocator **allocator)
Get a shared allocator from the OrtEnv.
OrtStatus * KernelInfo_GetInputCount(const OrtKernelInfo *info, size_t *out)
Get the number of inputs from OrtKernelInfo.
OrtStatus * Graph_GetOperatorSets(const OrtGraph *graph, const char **domains, int64_t *opset_versions, size_t num_operator_sets)
Returns the operator sets that the graph's model uses.
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.
const OrtEpApi *(* GetEpApi)(void)
Get the OrtEpApi instance for implementing an execution provider.
Definition onnxruntime_c_api.h:5855
OrtStatus * GetCompatibilityInfoFromModel(const char *model_path, const char *ep_type, OrtAllocator *allocator, char **compatibility_info)
Extract EP compatibility info from a precompiled model file.
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:5784
OrtStatus * Node_GetAttributeByName(const OrtNode *node, const char *attribute_name, const OrtOpAttr **attribute)
Gets the OrtNode's attribute as OrtOpAttr by name.
const OrtTrainingApi *(* GetTrainingApi)(uint32_t version)
Gets the Training C Api struct.
Definition onnxruntime_c_api.h:4429
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:3072
const char *(* GetRunConfigEntry)(const OrtRunOptions *options, const char *config_key)
Get a run configuration entry.
Definition onnxruntime_c_api.h:6719
OrtStatus * KernelInfo_GetInputTypeInfo(const OrtKernelInfo *info, size_t index, OrtTypeInfo **type_info)
Get the type information for a OrtKernelInfo's input.
OrtStatus * Graph_GetOnnxIRVersion(const OrtGraph *graph, int64_t *onnx_ir_version)
Returns the ONNX IR version.
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 * Graph_GetName(const OrtGraph *graph, const char **graph_name)
Returns a graph's name.
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 * CreateExternalInitializerInfo(const char *filepath, int64_t file_offset, size_t byte_size, OrtExternalInitializerInfo **out)
Creates an OrtExternalInitializerInfo instance.
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:5638
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 * KernelContext_GetSyncStream(const OrtKernelContext *context, OrtSyncStream **out)
Get the framework synchronization stream associated with a kernel context.
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:5849
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.
OrtStatus * GetTensorElementTypeAndShapeDataReference(const OrtValue *value, ONNXTensorElementDataType *elem_type, const int64_t **shape_data, size_t *shape_data_count)
Get the element data type and shape for an OrtValue that represents a Tensor (scalar,...
uint32_t(* MemoryInfoGetVendorId)(const OrtMemoryInfo *ptr)
Get the vendor id from OrtMemoryInfo.
Definition onnxruntime_c_api.h:5933
OrtStatus * Node_GetNumOutputs(const OrtNode *node, size_t *num_outputs)
Returns the number of node outputs.
void(* MemoryInfoGetDeviceType)(const OrtMemoryInfo *ptr, OrtMemoryInfoDeviceType *out)
Definition onnxruntime_c_api.h:4501
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 * GetSessionOptionsConfigEntries(const OrtSessionOptions *options, OrtKeyValuePairs **out)
Get Session configuration entries.
OrtStatus * FillStringTensor(OrtValue *value, const char *const *s, size_t s_len)
Set all strings at once in a string tensor.
OrtStatus * KernelInfoGetAttributeArray_string(const OrtKernelInfo *info, const char *name, OrtAllocator *allocator, char ***out, size_t *size)
Fetch an array of strings stored as an attribute in the graph node.
OrtStatus * Node_GetInputs(const OrtNode *node, const OrtValueInfo **inputs, size_t num_inputs)
Returns the node's inputs as OrtValueInfo instances.
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 * SessionGetMemoryInfoForOutputs(const OrtSession *session, const OrtMemoryInfo **outputs_memory_info, size_t num_outputs)
Get the OrtMemoryInfo for each output of the session.
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 device id from OrtMemoryInfo.
const OrtMemoryInfo *(* EpDevice_MemoryInfo)(const OrtEpDevice *ep_device, OrtDeviceMemoryType memory_type)
Get the OrtMemoryInfo for the device.
Definition onnxruntime_c_api.h:6733
OrtStatus * KernelInfo_GetOutputName(const OrtKernelInfo *info, size_t index, char *out, size_t *size)
Get the name of a OrtKernelInfo's output.
OrtStatus * Node_GetAttributes(const OrtNode *node, const OrtOpAttr **attributes, size_t num_attributes)
Returns a node's attributes as OrtOpAttr instances.
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 * Graph_GetInputs(const OrtGraph *graph, const OrtValueInfo **inputs, size_t num_inputs)
Returns the graph's inputs as OrtValueInfo instances.
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...
OrtStatus * KernelContext_GetOutputCount(const OrtKernelContext *context, size_t *out)
Used for custom operators, get the output count of a kernel.
void(* RunOptionsSetSyncStream)(OrtRunOptions *options, OrtSyncStream *sync_stream)
Sets OrtSyncStream for the run options.
Definition onnxruntime_c_api.h:7447
OrtStatus * GetTensorShapeElementCount(const OrtTensorTypeAndShapeInfo *info, size_t *out)
Get total number of elements in a tensor shape from an OrtTensorTypeAndShapeInfo.
OrtStatus * GetModelCompatibilityForEpDevices(const OrtEpDevice *const *ep_devices, size_t num_ep_devices, const char *compatibility_info, OrtCompiledModelCompatibility *out_status)
Validate a compiled model's compatibility information for one or more EP devices.
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 * ValueInfo_GetValueNumConsumers(const OrtValueInfo *value_info, size_t *num_consumers)
Get the number of consumers of a value as a node input.
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 * ValueInfo_IsConstantInitializer(const OrtValueInfo *value_info, bool *is_constant_initializer)
Returns a boolean indicating if the given value is a constant initializer.
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 * Graph_GetModelMetadata(const OrtGraph *graph, OrtModelMetadata **out)
Get OrtModelMetadata from an OrtGraph.
OrtStatus * RunOptionsDisableProfiling(OrtRunOptions *options)
Disable profiling for this run.
OrtStatus * GetTensorRTProviderOptionsAsString(const OrtTensorRTProviderOptionsV2 *tensorrt_options, OrtAllocator *allocator, char **ptr)
Get serialized TensorRT provider options string.
int64_t(* ExternalInitializerInfo_GetFileOffset)(const OrtExternalInitializerInfo *info)
Get the byte offset within the file where the initializer's data is stored.
Definition onnxruntime_c_api.h:6688
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.
OrtStatus * KernelInfo_GetConfigEntries(const OrtKernelInfo *info, OrtKeyValuePairs **out)
Get all config entries from OrtKernelInfo.
OrtStatus * Session_GetEpGraphAssignmentInfo(const OrtSession *session, const OrtEpAssignedSubgraph *const **ep_subgraphs, size_t *num_ep_subgraphs)
Get information about the subgraphs assigned to each execution provider (EP) and the nodes within.
void(* ReleaseROCMProviderOptions)(OrtROCMProviderOptions *input)
Release an OrtROCMProviderOptions.
Definition onnxruntime_c_api.h:5080
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 * GetSessionExecutionMode(const OrtSessionOptions *options, ExecutionMode *out)
Get the current execution mode setting.
OrtStatus * Node_GetNumAttributes(const OrtNode *node, size_t *num_attributes)
Returns the number of node attributes.
OrtStatus * SetCurrentGpuDeviceId(int device_id)
Set current GPU device ID.
OrtStatus * Node_GetNumInputs(const OrtNode *node, size_t *num_inputs)
Returns the number of node inputs.
OrtStatus * GetOnnxTypeFromTypeInfo(const OrtTypeInfo *type_info, enum ONNXType *out)
Get ONNXType from OrtTypeInfo.
OrtStatus * CreateMemoryInfo_V2(const char *name, enum OrtMemoryInfoDeviceType device_type, uint32_t vendor_id, int32_t device_id, enum OrtDeviceMemoryType mem_type, size_t alignment, enum OrtAllocatorType allocator_type, OrtMemoryInfo **out)
Create an OrtMemoryInfo.
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 * DeviceEpIncompatibilityDetails_GetErrorCode(const OrtDeviceEpIncompatibilityDetails *details, int32_t *error_code)
Get the execution provider error code from OrtDeviceEpIncompatibilityDetails.
const OrtInteropApi *(* GetInteropApi)(void)
Get the EP Interop API instance.
Definition onnxruntime_c_api.h:7112
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)
OrtStatus * SessionReleaseCapturedGraph(OrtSession *session, int graph_annotation_id)
Release a previously captured graph and its associated resources.
OrtStatus * RunOptionsEnableProfiling(OrtRunOptions *options, const char *profile_file_prefix)
Enable profiling for this run.
void(* ReleaseCANNProviderOptions)(OrtCANNProviderOptions *input)
Release an OrtCANNProviderOptions.
Definition onnxruntime_c_api.h:4495
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 * ValueInfo_GetInitializerValue(const OrtValueInfo *value_info, const OrtValue **initializer_value)
Get the underlying initializer value, as an OrtValue, from the given OrtValueInfo.
OrtStatus * EnableTelemetryEvents(const OrtEnv *env)
Enable Telemetry.
OrtStatus * OpAttr_GetTensorAttributeAsOrtValue(const OrtOpAttr *attribute, OrtValue **attr_tensor)
Get the OrtNode's 'TENSOR' attribute as an OrtValue.
OrtStatus * EpAssignedNode_GetDomain(const OrtEpAssignedNode *ep_node, const char **out)
Get the domain of the node assigned to an execution provider.
OrtStatus * OpAttr_GetType(const OrtOpAttr *attribute, OrtOpAttrType *type)
Get the attribute type as OrtOpAttrType from an OrtOpAttr.
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.
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 * SessionGetEpDeviceForInputs(const OrtSession *session, const OrtEpDevice **inputs_ep_devices, size_t num_inputs)
Get the OrtEpDevice (if available) for each input of the session.
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 * SessionGetEpDeviceForOutputs(const OrtSession *session, const OrtEpDevice **outputs_ep_devices, size_t num_outputs)
Get the EP device assigned to each session output.
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 * Node_GetGraph(const OrtNode *node, const OrtGraph **graph)
Get the node's parent OrtGraph instance.
OrtStatus * ValueInfo_GetExternalInitializerInfo(const OrtValueInfo *value_info, OrtExternalInitializerInfo **info)
Get information about an external initializer (e.g., filepath, file offset, byte size).
OrtStatus * AddCustomOpDomain(OrtSessionOptions *options, OrtCustomOpDomain *custom_op_domain)
Add custom op domain to a session options.
OrtStatus * Graph_GetGraphView(const OrtGraph *src_graph, const OrtNode **nodes, size_t num_nodes, OrtGraph **dst_graph)
Returns an OrtGraph that contains a subset of nodes in the source OrtGraph.
OrtStatus * KernelInfo_GetOutputTypeInfo(const OrtKernelInfo *info, size_t index, OrtTypeInfo **type_info)
Get the type information for a OrtKernelInfo's output.
OrtStatus * GetHardwareDevices(const OrtEnv *env, const OrtHardwareDevice **devices, size_t num_devices)
Get the list of available hardware devices.
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:5775
OrtStatus * KernelInfo_GetOperatorType(const OrtKernelInfo *info, char *out, size_t *size)
Get the graph node's operator type from OrtKernelInfo.
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 * Graph_GetInitializers(const OrtGraph *graph, const OrtValueInfo **initializers, size_t num_initializers)
Returns the graph's initializers as OrtValueInfo instances.
OrtStatus * GetHardwareDeviceEpIncompatibilityDetails(const OrtEnv *env, const char *ep_name, const OrtHardwareDevice *hw, OrtDeviceEpIncompatibilityDetails **details)
Check for known incompatibility issues between hardware device and a specific execution provider.
OrtStatus * ModelMetadataGetGraphName(const OrtModelMetadata *model_metadata, OrtAllocator *allocator, char **value)
Get graph name from an OrtModelMetadata.
OrtStatus * CreateROCMProviderOptions(OrtROCMProviderOptions **out)
Create an OrtROCMProviderOptions.
OrtStatus * SetPerSessionThreadPoolCallbacks(OrtEnv *env, const OrtThreadPoolCallbacksConfig *config)
Set thread pool work callbacks for per-session thread pools.
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 * EpAssignedNode_GetOperatorType(const OrtEpAssignedNode *ep_node, const char **out)
Get the operator type of the node assigned to an execution provider.
OrtStatus * CopyTensors(const OrtEnv *env, const OrtValue *const *src_tensors, OrtValue *const *dst_tensors, OrtSyncStream *stream, size_t num_tensors)
Copy OrtValue instances containing Tensors between devices.
OrtStatus * KernelContext_GetPreallocatedOutput(const OrtKernelContext *context, size_t output_index, OrtValue **output)
Get a preallocated output tensor without allocating an output.
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 * Node_GetDomain(const OrtNode *node, const char **domain_name)
Returns a node's domain name.
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 * Graph_GetNumOutputs(const OrtGraph *graph, size_t *num_outputs)
Returns the number of graph outputs.
OrtStatus * ValueInfo_IsOptionalGraphInput(const OrtValueInfo *value_info, bool *is_optional_graph_input)
Returns a boolean indicating if the given value is an optional graph input.
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:5616
OrtStatus * CreateRunOptions(OrtRunOptions **out)
Create an OrtRunOptions.
OrtStatus * RunOptionsGetRunTag(const OrtRunOptions *options, const char **run_tag)
Get per-run tag.
size_t(* ExternalInitializerInfo_GetByteSize)(const OrtExternalInitializerInfo *info)
Get the size in bytes of the initializer's data within the file.
Definition onnxruntime_c_api.h:6697
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:1400
OrtStatus * IsTensor(const OrtValue *value, int *out)
Return if an OrtValue is a tensor type.
OrtStatus * Graph_GetNumNodes(const OrtGraph *graph, size_t *num_nodes)
Returns the number of graph nodes.
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 * ValueInfo_GetValueConsumers(const OrtValueInfo *value_info, const OrtNode **nodes, int64_t *input_indices, size_t num_consumers)
Returns information (OrtNode and input index) for all consumer nodes that use the value as an input.
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:5627
OrtStatus * EpAssignedSubgraph_GetEpName(const OrtEpAssignedSubgraph *ep_subgraph, const char **out)
Get the name of the execution provider to which the subgraph was assigned.
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 * SessionOptionsSetWeightlessSourceModelBuffer(OrtSessionOptions *options, const void *source_model_data, size_t source_model_data_length)
Set the source ONNX model as a byte buffer for weightless EPContext sessions.
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:5813
OrtStatus * EnableProfiling(OrtSessionOptions *options, const char *profile_file_prefix)
Enable profiling for a session.
OrtStatus * Node_GetName(const OrtNode *node, const char **node_name)
Returns a node's name. Can be an empty string.
uint32_t(* HardwareDevice_DeviceId)(const OrtHardwareDevice *device)
Get the hardware device's unique identifier.
Definition onnxruntime_c_api.h:5794
OrtStatus * Node_GetId(const OrtNode *node, size_t *node_id)
Returns a node's identifier.
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 * Graph_GetNumOperatorSets(const OrtGraph *graph, size_t *num_operator_sets)
Returns the number of operator sets that the graph's model uses.
OrtStatus * GetTensorTypeAndShape(const OrtValue *value, OrtTensorTypeAndShapeInfo **out)
Get type and shape information from a tensor OrtValue.
OrtStatus * GetMemPatternEnabled(const OrtSessionOptions *options, int *out)
Check if the memory pattern optimization is enabled in the session options.
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:5831
OrtStatus * CreateEnvWithOptions(const OrtEnvCreationOptions *options, OrtEnv **out)
Create an OrtEnv instance with the given options.
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.
OrtDeviceMemoryType(* MemoryInfoGetDeviceMemType)(const OrtMemoryInfo *ptr)
Get the device memory type from OrtMemoryInfo.
Definition onnxruntime_c_api.h:5924
void(* ClearBoundOutputs)(OrtIoBinding *binding_ptr) __attribute__((nonnull))
Clears any previously set Outputs for an OrtIoBinding.
Definition onnxruntime_c_api.h:3076
OrtStatus * KernelInfo_GetOperatorDomain(const OrtKernelInfo *info, char *out, size_t *size)
Get the graph node's operator domain from OrtKernelInfo.
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 * CreateSharedAllocator(OrtEnv *env, const OrtEpDevice *ep_device, OrtDeviceMemoryType mem_type, OrtAllocatorType allocator_type, const OrtKeyValuePairs *allocator_options, OrtAllocator **allocator)
Create/replace a shared allocator for the OrtEpDevice in the OrtEnv.
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 * Graph_GetParentNode(const OrtGraph *graph, const OrtNode **node)
Get the parent node for the given graph, if any exists.
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:5601
OrtStatus *(* CreateStatus)(OrtErrorCode code, const char *msg) __attribute__((nonnull))
Create an OrtStatus from a null terminated string.
Definition onnxruntime_c_api.h:1386
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 * DeviceEpIncompatibilityDetails_GetReasonsBitmask(const OrtDeviceEpIncompatibilityDetails *details, uint32_t *reasons_bitmask)
Get the incompatibility reasons bitmask from OrtDeviceEpIncompatibilityDetails.
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.
const OrtCompileApi *(* GetCompileApi)(void)
Get the Compile API instance.
Definition onnxruntime_c_api.h:5587
OrtStatus * SessionGetModelMetadata(const OrtSession *session, OrtModelMetadata **out)
Get OrtModelMetadata from an OrtSession.
OrtStatus * Node_GetSinceVersion(const OrtNode *node, int *since_version)
Get the opset version in which the given node's operator type was first defined.
OrtStatus * Node_GetNumSubgraphs(const OrtNode *node, size_t *num_subgraphs)
Returns the number of subgraphs contained by the given node.
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 * SessionOptionsSetEpContextDataReadFunc(OrtSessionOptions *options, OrtReadNamedBufferFunc read_func, void *state)
Register a callback that supplies external EPContext binary data during session initialization.
OrtStatus * Graph_GetOutputs(const OrtGraph *graph, const OrtValueInfo **outputs, size_t num_outputs)
Returns the graph's outputs as OrtValueInfo instances.
OrtStatus * EnableOrtCustomOps(OrtSessionOptions *options)
Enable custom operators.
OrtStatus * UpdateEnvWithCustomLogLevel(OrtEnv *ort_env, OrtLoggingLevel log_severity_level)
OrtStatus * Node_GetEpName(const OrtNode *node, const char **out)
Returns the execution provider name that this node is assigned to run on. Returns NULL if the node ha...
OrtStatus * SessionGetMemoryInfoForInputs(const OrtSession *session, const OrtMemoryInfo **inputs_memory_info, size_t num_inputs)
Get the OrtMemoryInfo for each input of the session.
OrtStatus * ReleaseSharedAllocator(OrtEnv *env, const OrtEpDevice *ep_device, OrtDeviceMemoryType mem_type)
Release a shared allocator from the OrtEnv for the OrtEpDevice and memory type.
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.
bool(* TensorTypeAndShape_HasShape)(const OrtTensorTypeAndShapeInfo *info)
Fetch whether the tensor has shape information.
Definition onnxruntime_c_api.h:7024
OrtStatus * GetNumHardwareDevices(const OrtEnv *env, size_t *num_devices)
Get the number of available hardware devices.
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 * Graph_GetModelPath(const OrtGraph *graph, const char **model_path)
Get the filepath to the model from which an OrtGraph is constructed.
OrtStatus * KernelInfo_GetOperatorSinceVersion(const OrtKernelInfo *info, int *since_version)
Get the opset version in which the given node's operator type was first defined from OrtKernelInfo.
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.
OrtExperimentalFnPtr(* GetExperimentalFunction)(const char *name)
Retrieve an experimental function pointer by name.
Definition onnxruntime_c_api.h:7600
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:5840
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 * EpAssignedNode_GetName(const OrtEpAssignedNode *ep_node, const char **out)
Get the name of the node assigned to an execution provider.
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 * ValueInfo_IsGraphOutput(const OrtValueInfo *value_info, bool *is_graph_output)
Returns a boolean indicating if the given value is a graph output.
OrtStatus * GetValueType(const OrtValue *value, enum ONNXType *out)
Get ONNXType of an OrtValue.
OrtStatus * Node_GetImplicitInputs(const OrtNode *node, const OrtValueInfo **implicit_inputs, size_t num_implicit_inputs)
Get the implicit inputs, as OrtValueInfo instances, that are used within the given node's subgraphs.
OrtStatus * Node_GetNumImplicitInputs(const OrtNode *node, size_t *num_implicit_inputs)
Returns the number of node implicit inputs.
OrtStatus * ShapeInferContext_GetInputTypeShape(const OrtShapeInferContext *context, size_t index, OrtTensorTypeAndShapeInfo **info)
OrtStatus * EpAssignedSubgraph_GetNodes(const OrtEpAssignedSubgraph *ep_subgraph, const OrtEpAssignedNode *const **ep_nodes, size_t *num_ep_nodes)
Get the nodes in a subgraph assigned to a specific execution provider.
OrtStatus * CreateSyncStreamForEpDevice(const OrtEpDevice *ep_device, const OrtKeyValuePairs *stream_options, OrtSyncStream **stream)
Create an OrtSyncStream for the given OrtEpDevice.
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:3634
OrtStatus * Graph_GetNodes(const OrtGraph *graph, const OrtNode **nodes, size_t num_nodes)
Returns the graph's nodes as OrtNode instances.
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 ...
const char *(* ExternalInitializerInfo_GetFilePath)(const OrtExternalInitializerInfo *info)
Get the relative path to the file that stores the initializer's data.
Definition onnxruntime_c_api.h:6679
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:5822
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:5804
const OrtModelEditorApi *(* GetModelEditorApi)(void)
Get the Model Editor API instance.
Definition onnxruntime_c_api.h:5529
OrtStatus * ValueInfo_GetValueProducer(const OrtValueInfo *value_info, const OrtNode **producer_node, size_t *producer_output_index)
Get the OrtNode that produces the value represented by the given OrtValueInfo. Optionally returns the...
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 * OpAttr_GetName(const OrtOpAttr *attribute, const char **name)
Get the attribute name from an OrtOpAttr.
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 * ValueInfo_IsRequiredGraphInput(const OrtValueInfo *value_info, bool *is_required_graph_input)
Returns a boolean indicating if the given value is a required graph input.
OrtStatus * Node_GetOutputs(const OrtNode *node, const OrtValueInfo **outputs, size_t num_outputs)
Returns the node's outputs as OrtValueInfo instances.
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 * DeviceEpIncompatibilityDetails_GetNotes(const OrtDeviceEpIncompatibilityDetails *details, const char **notes)
Get the notes from OrtDeviceEpIncompatibilityDetails.
OrtStatus * ModelMetadataGetProducerName(const OrtModelMetadata *model_metadata, OrtAllocator *allocator, char **value)
Get producer name from an OrtModelMetadata.
OrtStatus * GetCompatibilityInfoFromModelBytes(const void *model_data, size_t model_data_length, const char *ep_type, OrtAllocator *allocator, char **compatibility_info)
Extract EP compatibility info from precompiled model bytes in memory.
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 * Node_GetSubgraphs(const OrtNode *node, const OrtGraph **subgraphs, size_t num_subgraphs, const char **attribute_names)
Get the subgraphs, as OrtGraph instances, contained by the given node.
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:5649
void *(* SyncStream_GetHandle)(OrtSyncStream *stream)
Get the native handle of the sync stream.
Definition onnxruntime_c_api.h:6927
OrtStatus * Graph_GetNumInitializers(const OrtGraph *graph, size_t *num_initializers)
Returns the number of graph initializers.
void(* ReleaseCUDAProviderOptions)(OrtCUDAProviderOptionsV2 *input)
Release an OrtCUDAProviderOptionsV2.
Definition onnxruntime_c_api.h:4137
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:1393
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:704
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:783
int has_user_compute_stream
Flag indicating if there is a user provided compute stream Defaults to 0.
Definition onnxruntime_c_api.h:757
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:752
void * user_compute_stream
User provided compute stream. If provided, please set has_user_compute_stream to 1.
Definition onnxruntime_c_api.h:762
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:772
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:735
int arena_extend_strategy
Strategy used to grow the memory arena 0 = kNextPowerOfTwo 1 = kSameAsRequested Defaults to 0.
Definition onnxruntime_c_api.h:743
OrtCUDAProviderOptions()
Definition onnxruntime_c_api.h:706
OrtArenaCfg * default_memory_arena_cfg
CUDA memory arena configuration parameters.
Definition onnxruntime_c_api.h:766
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:778
OrtCudnnConvAlgoSearch cudnn_conv_algo_search
CUDA Convolution algorithm search configuration. See enum OrtCudnnConvAlgoSearch for more details....
Definition onnxruntime_c_api.h:729
int device_id
CUDA device Id Defaults to 0.
Definition onnxruntime_c_api.h:723
The OrtCompileApi struct provides functions to compile ONNX models.
Definition onnxruntime_c_api.h:8290
OrtStatus * ModelCompilationOptions_SetFlags(OrtModelCompilationOptions *model_compile_options, uint32_t flags)
Sets flags from OrtCompileApiFlags that represent one or more boolean options to enable.
OrtStatus * ModelCompilationOptions_SetOutputModelWriteFunc(OrtModelCompilationOptions *model_compile_options, OrtWriteBufferFunc write_func, void *state)
Sets a OrtWriteBufferFunc function that is called by ORT to write out the output model's serialized O...
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_SetWeightlessEnabled(OrtModelCompilationOptions *model_compile_options, bool use_weightless)
Enable or disable weightless mode for model compilation.
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_SetEpContextDataWriteFunc(OrtModelCompilationOptions *model_compile_options, OrtWriteNamedBufferFunc write_func, void *state)
Register a callback that receives external EPContext binary data during model compilation.
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 * ModelCompilationOptions_SetInputModel(OrtModelCompilationOptions *model_compile_options, const OrtModel *model)
Sets the OrtModel to compile.
OrtStatus * ModelCompilationOptions_SetGraphOptimizationLevel(OrtModelCompilationOptions *model_compile_options, GraphOptimizationLevel graph_optimization_level)
OrtStatus * CreateModelCompilationOptionsFromSessionOptions(const OrtEnv *env, const OrtSessionOptions *session_options, OrtModelCompilationOptions **out)
Creates an OrtModelCompilationOptions object from an existing OrtSessionOptions object.
OrtStatus * ModelCompilationOptions_SetOutputModelExternalInitializersBuffer(OrtModelCompilationOptions *model_compile_options, const char *logical_file_name, size_t external_initializers_size_threshold, OrtAllocator *allocator, void **output_buffer_ptr, size_t *output_buffer_size_ptr)
Store external initializers for the compiled model in one caller-owned buffer.
OrtStatus * ModelCompilationOptions_SetOutputModelExternalInitializersAlignment(OrtModelCompilationOptions *model_compile_options, size_t alignment, size_t minimum_size)
Configure additional alignment for externalized initializer offsets.
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 * ModelCompilationOptions_SetOutputModelGetInitializerLocationFunc(OrtModelCompilationOptions *model_compile_options, OrtGetInitializerLocationFunc get_initializer_location_func, void *state)
Sets a OrtGetInitializerLocationFunc function that is called by ORT for every initializer in the gene...
OrtStatus * CompileModel(const OrtEnv *env, const OrtModelCompilationOptions *model_options)
Compiles an input ONNX model with the given compilation options.
OrtStatus * ModelCompilationOptions_SetEpContextBinaryInformation(OrtModelCompilationOptions *model_compile_options, const char *output_directory, const char *model_name)
Definition onnxruntime_c_api.h:1031
char __place_holder
Definition onnxruntime_c_api.h:1032
Definition onnxruntime_c_api.h:7736
int(* GetVariadicInputHomogeneity)(const struct OrtCustomOp *op)
Definition onnxruntime_c_api.h:7785
OrtCustomOpInputOutputCharacteristic(* GetOutputCharacteristic)(const struct OrtCustomOp *op, size_t index)
Definition onnxruntime_c_api.h:7769
size_t(* GetInputTypeCount)(const struct OrtCustomOp *op)
Definition onnxruntime_c_api.h:7757
int(* GetVariadicOutputMinArity)(const struct OrtCustomOp *op)
Definition onnxruntime_c_api.h:7789
size_t(* GetAliasMap)(int **input_index, int **output_index)
Definition onnxruntime_c_api.h:7822
int(* GetStartVersion)(const struct OrtCustomOp *op)
Definition onnxruntime_c_api.h:7807
void(* ReleaseMayInplace)(int *input_index, int *output_index)
Definition onnxruntime_c_api.h:7819
const char *(* GetName)(const struct OrtCustomOp *op)
Definition onnxruntime_c_api.h:7750
size_t(* GetOutputTypeCount)(const struct OrtCustomOp *op)
Definition onnxruntime_c_api.h:7759
void(* KernelDestroy)(void *op_kernel)
Definition onnxruntime_c_api.h:7765
int(* GetVariadicOutputHomogeneity)(const struct OrtCustomOp *op)
Definition onnxruntime_c_api.h:7794
OrtMemType(* GetInputMemoryType)(const struct OrtCustomOp *op, size_t index)
Definition onnxruntime_c_api.h:7776
void *(* CreateKernel)(const struct OrtCustomOp *op, const OrtApi *api, const OrtKernelInfo *info)
Definition onnxruntime_c_api.h:7746
uint32_t version
Definition onnxruntime_c_api.h:7737
ONNXTensorElementDataType(* GetInputType)(const struct OrtCustomOp *op, size_t index)
Definition onnxruntime_c_api.h:7756
void(* ReleaseAliasMap)(int *input_index, int *output_index)
Definition onnxruntime_c_api.h:7823
OrtCustomOpInputOutputCharacteristic(* GetInputCharacteristic)(const struct OrtCustomOp *op, size_t index)
Definition onnxruntime_c_api.h:7768
const char *(* GetExecutionProviderType)(const struct OrtCustomOp *op)
Definition onnxruntime_c_api.h:7753
ONNXTensorElementDataType(* GetOutputType)(const struct OrtCustomOp *op, size_t index)
Definition onnxruntime_c_api.h:7758
int(* GetVariadicInputMinArity)(const struct OrtCustomOp *op)
Definition onnxruntime_c_api.h:7780
OrtStatusPtr(* InferOutputShapeFn)(const struct OrtCustomOp *op, OrtShapeInferContext *)
Definition onnxruntime_c_api.h:7804
int(* GetEndVersion)(const struct OrtCustomOp *op)
Definition onnxruntime_c_api.h:7808
OrtStatusPtr(* CreateKernelV2)(const struct OrtCustomOp *op, const OrtApi *api, const OrtKernelInfo *info, void **kernel)
Definition onnxruntime_c_api.h:7797
size_t(* GetMayInplace)(int **input_index, int **output_index)
Definition onnxruntime_c_api.h:7815
OrtStatusPtr(* KernelComputeV2)(void *op_kernel, OrtKernelContext *context)
Definition onnxruntime_c_api.h:7802
void(* KernelCompute)(void *op_kernel, OrtKernelContext *context)
Definition onnxruntime_c_api.h:7764
Configuration options for creating an OrtEnv.
Definition onnxruntime_c_api.h:1287
uint32_t version
Must be set to ORT_API_VERSION.
Definition onnxruntime_c_api.h:1288
const OrtKeyValuePairs * config_entries
Optional environment configuration entries represented as string key-value pairs. May be set to NULL.
Definition onnxruntime_c_api.h:1360
const OrtThreadingOptions * threading_options
Optional threading options for creating an environment with global thread pools shared across session...
Definition onnxruntime_c_api.h:1340
OrtLoggingFunction custom_logging_function
Optional custom logging function. May be set to NULL.
Definition onnxruntime_c_api.h:1319
void * custom_logging_param
Optional state to pass as the first argument to OrtEnvCreationOptions::custom_logger_function....
Definition onnxruntime_c_api.h:1326
const char * log_id
The log identifier. Must be set to a valid UTF-8 null-terminated string.
Definition onnxruntime_c_api.h:1308
int32_t logging_severity_level
The logging severity level for the environment. Must be set to a value from OrtLoggingLevel.
Definition onnxruntime_c_api.h:1300
The OrtEpApi struct provides functions that are relevant to the implementation of an execution provid...
Definition onnxruntime_ep_c_api.h:1021
Descriptor for importing external memory.
Definition onnxruntime_c_api.h:1156
OrtExternalMemoryHandleType handle_type
Definition onnxruntime_c_api.h:1158
size_t size_bytes
Definition onnxruntime_c_api.h:1160
void * native_handle
Definition onnxruntime_c_api.h:1159
uint32_t version
Definition onnxruntime_c_api.h:1157
size_t offset_bytes
Definition onnxruntime_c_api.h:1161
Base struct for imported external memory handles.
Definition onnxruntime_ep_c_api.h:54
Descriptor for importing external semaphores.
Definition onnxruntime_c_api.h:1182
void * native_handle
Definition onnxruntime_c_api.h:1185
OrtExternalSemaphoreType type
Definition onnxruntime_c_api.h:1184
uint32_t version
Definition onnxruntime_c_api.h:1183
Base struct for imported external semaphore handles.
Definition onnxruntime_ep_c_api.h:81
Descriptor for creating a tensor from imported external memory.
Definition onnxruntime_c_api.h:1260
ONNXTensorElementDataType element_type
Definition onnxruntime_c_api.h:1262
size_t offset_bytes
Definition onnxruntime_c_api.h:1265
uint32_t version
Definition onnxruntime_c_api.h:1261
size_t rank
Definition onnxruntime_c_api.h:1264
const int64_t * shape
Definition onnxruntime_c_api.h:1263
Configuration for initializing graphics interop on an EP factory.
Definition onnxruntime_c_api.h:1228
OrtGraphicsApi graphics_api
Definition onnxruntime_c_api.h:1230
const OrtKeyValuePairs * additional_options
Additional API-specific options (optional).
Definition onnxruntime_c_api.h:1250
uint32_t version
Definition onnxruntime_c_api.h:1229
void * command_queue
Command queue/submission queue for graphics workloads (optional).
Definition onnxruntime_c_api.h:1241
The OrtInteropApi struct provides functions for external resource interop with execution providers.
Definition onnxruntime_c_api.h:8686
OrtStatus * WaitSemaphore(OrtExternalResourceImporter *importer, OrtExternalSemaphoreHandle *semaphore_handle, OrtSyncStream *stream, uint64_t value)
Wait on an external semaphore on the EP's stream.
OrtStatus * CreateTensorFromMemory(OrtExternalResourceImporter *importer, const OrtExternalMemoryHandle *mem_handle, const OrtExternalTensorDescriptor *tensor_desc, OrtValue **out_tensor)
Create a tensor backed by imported external memory.
OrtStatus * InitGraphicsInteropForEpDevice(const OrtEpDevice *ep_device, const OrtGraphicsInteropConfig *config)
Initialize graphics interop for an execution provider device.
OrtStatus * ImportMemory(OrtExternalResourceImporter *importer, const OrtExternalMemoryDescriptor *desc, OrtExternalMemoryHandle **out_handle)
Import external memory into the execution provider.
OrtStatus * SignalSemaphore(OrtExternalResourceImporter *importer, OrtExternalSemaphoreHandle *semaphore_handle, OrtSyncStream *stream, uint64_t value)
Signal an external semaphore from the EP's stream.
OrtStatus * ImportSemaphore(OrtExternalResourceImporter *importer, const OrtExternalSemaphoreDescriptor *desc, OrtExternalSemaphoreHandle **out_handle)
Import an external semaphore into the execution provider.
OrtStatus * CanImportSemaphore(const OrtExternalResourceImporter *importer, OrtExternalSemaphoreType type, bool *out_supported)
Check if the external resource importer can import a specific semaphore type.
OrtStatus * CreateExternalResourceImporterForDevice(const OrtEpDevice *ep_device, OrtExternalResourceImporter **out_importer)
Create an external resource importer for a specific EP device.
OrtStatus * CanImportMemory(const OrtExternalResourceImporter *importer, OrtExternalMemoryHandleType handle_type, bool *out_supported)
Check if the external resource importer can import a specific memory handle type.
OrtStatus * DeinitGraphicsInteropForEpDevice(const OrtEpDevice *ep_device)
Deinitialize graphics interop for an execution provider device.
MIGraphX Provider Options.
Definition onnxruntime_c_api.h:908
bool migraphx_exhaustive_tune
Definition onnxruntime_c_api.h:919
int migraphx_save_compiled_model
Definition onnxruntime_c_api.h:915
int migraphx_fp8_enable
Definition onnxruntime_c_api.h:911
int migraphx_int8_enable
Definition onnxruntime_c_api.h:912
int migraphx_load_compiled_model
Definition onnxruntime_c_api.h:917
int migraphx_fp16_enable
Definition onnxruntime_c_api.h:910
int device_id
Definition onnxruntime_c_api.h:909
int migraphx_use_native_calibration_table
Definition onnxruntime_c_api.h:913
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:925
const char * migraphx_load_model_path
Definition onnxruntime_c_api.h:918
const char * migraphx_save_model_path
Definition onnxruntime_c_api.h:916
int migraphx_arena_extend_strategy
Strategy used to grow the memory arena 0 = kNextPowerOfTwo 1 = kSameAsRequested Defaults to 0.
Definition onnxruntime_c_api.h:933
const char * migraphx_int8_calibration_table_name
Definition onnxruntime_c_api.h:914
The OrtModelEditorApi struct provides functions to create or edit an ONNX model.
Definition onnxruntime_c_api.h:7837
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.
Stable API table for model package workflows.
Definition onnxruntime_c_api.h:8931
OrtStatus * SelectComponent(const OrtModelPackageContext *context, const char *component_name, const OrtModelPackageOptions *options, OrtModelPackageComponentContext **out)
Select a component and resolve its best matching variant.
OrtStatus * ModelPackage_ResolveStringRef(const OrtModelPackageContext *ctx, const char *base_dir, const char *input, int must_exist, const char **out_path)
Resolve a package path reference.
OrtStatus * CreateModelPackageOptionsFromSessionOptions(const OrtEnv *env, const OrtSessionOptions *session_options, OrtModelPackageOptions **out)
Create model package options from session options.
OrtStatus * ModelPackage_GetComponentNames(const OrtModelPackageContext *ctx, const char *const **out_names, size_t *out_count)
Get the component names in a model package.
OrtStatus * ModelPackage_GetVariantEpName(const OrtModelPackageContext *ctx, const char *component_name, const char *variant_name, const char **out_ep)
Get the execution provider name declared by a variant.
OrtStatus * ModelPackageComponent_GetSelectedVariantFolderPath(const OrtModelPackageComponentContext *ctx, const char **folder_path)
Get the selected variant directory.
OrtStatus * CreateModelPackageContext(const char *package_root, OrtModelPackageContext **out)
Open a model package.
OrtStatus * ModelPackage_GetSchemaVersion(const OrtModelPackageContext *ctx, int64_t *out_version)
Get the model package schema version.
OrtStatus * ModelPackage_GetVariantNames(const OrtModelPackageContext *ctx, const char *component_name, const char *const **out_variant_names, size_t *out_count)
Get the variant names for a component.
OrtStatus * ModelPackage_GetComponentCount(const OrtModelPackageContext *ctx, size_t *out_count)
Get the number of components in a model package.
OrtStatus * CreateSession(const OrtEnv *env, OrtModelPackageComponentContext *context, const OrtSessionOptions *session_options, OrtSession **session)
Create a session for the selected component variant.
OrtStatus * ModelPackage_GetVariantCount(const OrtModelPackageContext *ctx, const char *component_name, size_t *out_count)
Get the number of variants for a component.
OrtStatus * ModelPackageComponent_GetSelectedVariantName(const OrtModelPackageComponentContext *ctx, const char **out_name)
Get the selected variant name.
OpenVINO Provider Options.
Definition onnxruntime_c_api.h:947
unsigned char enable_opencl_throttling
0 = disabled, nonzero = enabled
Definition onnxruntime_c_api.h:968
size_t num_of_threads
0 = Use default number of threads
Definition onnxruntime_c_api.h:965
void * context
Definition onnxruntime_c_api.h:967
const char * cache_dir
Definition onnxruntime_c_api.h:966
const char * device_type
Device type string.
Definition onnxruntime_c_api.h:962
const char * device_id
Definition onnxruntime_c_api.h:964
unsigned char enable_npu_fast_compile
0 = disabled, nonzero = enabled
Definition onnxruntime_c_api.h:963
OrtOpenVINOProviderOptions()
Definition onnxruntime_c_api.h:949
unsigned char enable_dynamic_shapes
0 = disabled, nonzero = enabled
Definition onnxruntime_c_api.h:969
ROCM Provider Options.
Definition onnxruntime_c_api.h:791
int device_id
ROCM device Id Defaults to 0.
Definition onnxruntime_c_api.h:811
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:872
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:839
OrtArenaCfg * default_memory_arena_cfg
ROCM memory arena configuration parameters.
Definition onnxruntime_c_api.h:853
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:822
OrtROCMProviderOptions()
Definition onnxruntime_c_api.h:793
int enable_hip_graph
Definition onnxruntime_c_api.h:855
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:861
void * user_compute_stream
User provided compute stream. If provided, please set has_user_compute_stream to 1.
Definition onnxruntime_c_api.h:849
int arena_extend_strategy
Strategy used to grow the memory arena 0 = kNextPowerOfTwo 1 = kSameAsRequested Defaults to 0.
Definition onnxruntime_c_api.h:830
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:867
int has_user_compute_stream
Flag indicating if there is a user provided compute stream Defaults to 0.
Definition onnxruntime_c_api.h:844
int miopen_conv_exhaustive_search
ROCM MIOpen Convolution algorithm exhaustive search option. Defaults to 0 (false).
Definition onnxruntime_c_api.h:816
TensorRT Provider Options.
Definition onnxruntime_c_api.h:880
int trt_engine_cache_enable
Definition onnxruntime_c_api.h:894
void * user_compute_stream
Definition onnxruntime_c_api.h:883
int device_id
CUDA device id (0 = default device)
Definition onnxruntime_c_api.h:881
const char * trt_engine_cache_path
Definition onnxruntime_c_api.h:895
int trt_engine_decryption_enable
Definition onnxruntime_c_api.h:896
int trt_max_partition_iterations
Definition onnxruntime_c_api.h:884
size_t trt_max_workspace_size
Definition onnxruntime_c_api.h:886
int trt_dla_enable
Definition onnxruntime_c_api.h:891
const char * trt_int8_calibration_table_name
Definition onnxruntime_c_api.h:889
int has_user_compute_stream
Definition onnxruntime_c_api.h:882
int trt_dla_core
Definition onnxruntime_c_api.h:892
int trt_int8_use_native_calibration_table
Definition onnxruntime_c_api.h:890
int trt_min_subgraph_size
Definition onnxruntime_c_api.h:885
int trt_force_sequential_engine_build
Definition onnxruntime_c_api.h:898
int trt_dump_subgraphs
Definition onnxruntime_c_api.h:893
int trt_fp16_enable
Definition onnxruntime_c_api.h:887
const char * trt_engine_decryption_lib_path
Definition onnxruntime_c_api.h:897
int trt_int8_enable
Definition onnxruntime_c_api.h:888
Configuration for thread pool work callbacks.
Definition onnxruntime_c_api.h:1100
void * user_context
Definition onnxruntime_c_api.h:1106
uint32_t version
Definition onnxruntime_c_api.h:1101
OrtThreadPoolWorkEnqueueFn on_enqueue
Definition onnxruntime_c_api.h:1102
OrtThreadPoolWorkStartFn on_start_work
Definition onnxruntime_c_api.h:1103
OrtThreadPoolWorkStopFn on_stop_work
Definition onnxruntime_c_api.h:1104
OrtThreadPoolWorkAbandonFn on_abandon
Definition onnxruntime_c_api.h:1105
The Training C API that holds onnxruntime training function pointers.
Definition onnxruntime_training_c_api.h:122