26#include "onnxruntime_c_api.h"
27#include "onnxruntime_float16.h"
36#include <unordered_map>
41#ifdef ORT_NO_EXCEPTIONS
58 const char*
what() const noexcept
override {
return message_.c_str(); }
65#ifdef ORT_NO_EXCEPTIONS
68#ifndef ORT_CXX_API_THROW
69#define ORT_CXX_API_THROW(string, code) \
71 std::cerr << Ort::Exception(string, code) \
78#define ORT_CXX_API_THROW(string, code) \
79 throw Ort::Exception(string, code)
92#ifdef ORT_API_MANUAL_INIT
112#if defined(_MSC_VER) && !defined(__clang__)
116#pragma warning(disable : 26426)
119#if defined(_MSC_VER) && !defined(__clang__)
153 if (api ==
nullptr) {
155 ORT_CXX_API_THROW(
"Model Editor API is not available in this build",
ORT_FAIL);
167 if (api ==
nullptr) {
169 ORT_CXX_API_THROW(
"Compile API is not available in this build",
ORT_FAIL);
181 if (api ==
nullptr) {
183 ORT_CXX_API_THROW(
"EP API is not available in this build",
ORT_FAIL);
207struct Float16_t : onnxruntime_float16::Float16Impl<Float16_t> {
214 constexpr explicit Float16_t(uint16_t v)
noexcept { val = v; }
217 using Base = onnxruntime_float16::Float16Impl<Float16_t>;
235 explicit Float16_t(
float v)
noexcept { val = Base::ToUint16Impl(v); }
241 float ToFloat() const noexcept {
return Base::ToFloatImpl(); }
247 using Base::IsNegative;
259 using Base::IsFinite;
265 using Base::IsPositiveInfinity;
271 using Base::IsNegativeInfinity;
277 using Base::IsInfinity;
283 using Base::IsNaNOrZero;
289 using Base::IsNormal;
295 using Base::IsSubnormal;
322 explicit operator float() const noexcept {
return ToFloat(); }
324 using Base::operator==;
325 using Base::operator!=;
326 using Base::operator<;
207struct Float16_t : onnxruntime_float16::Float16Impl<Float16_t> {
…};
329static_assert(
sizeof(Float16_t) ==
sizeof(uint16_t),
"Sizes must match");
349struct BFloat16_t : onnxruntime_float16::BFloat16Impl<BFloat16_t> {
358 constexpr explicit BFloat16_t(uint16_t v)
noexcept { val = v; }
361 using Base = onnxruntime_float16::BFloat16Impl<BFloat16_t>;
376 explicit BFloat16_t(
float v)
noexcept { val = Base::ToUint16Impl(v); }
382 float ToFloat() const noexcept {
return Base::ToFloatImpl(); }
388 using Base::IsNegative;
400 using Base::IsFinite;
406 using Base::IsPositiveInfinity;
412 using Base::IsNegativeInfinity;
418 using Base::IsInfinity;
424 using Base::IsNaNOrZero;
430 using Base::IsNormal;
436 using Base::IsSubnormal;
463 explicit operator float() const noexcept {
return ToFloat(); }
349struct BFloat16_t : onnxruntime_float16::BFloat16Impl<BFloat16_t> {
…};
472static_assert(
sizeof(
BFloat16_t) ==
sizeof(uint16_t),
"Sizes must match");
483 constexpr operator uint8_t() const noexcept {
return value; }
489static_assert(
sizeof(Float8E4M3FN_t) ==
sizeof(uint8_t),
"Sizes must match");
500 constexpr operator uint8_t() const noexcept {
return value; }
506static_assert(
sizeof(Float8E4M3FNUZ_t) ==
sizeof(uint8_t),
"Sizes must match");
517 constexpr operator uint8_t() const noexcept {
return value; }
523static_assert(
sizeof(Float8E5M2_t) ==
sizeof(uint8_t),
"Sizes must match");
534 constexpr operator uint8_t() const noexcept {
return value; }
540static_assert(
sizeof(Float8E5M2FNUZ_t) ==
sizeof(uint8_t),
"Sizes must match");
545#define ORT_DEFINE_RELEASE(NAME) \
546 inline void OrtRelease(Ort##NAME* ptr) { GetApi().Release##NAME(ptr); }
548#define ORT_DEFINE_RELEASE_FROM_API_STRUCT(NAME, API_GETTER) \
549 inline void OrtRelease(Ort##NAME* ptr) { API_GETTER().Release##NAME(ptr); }
570ORT_DEFINE_RELEASE(
Op);
580#undef ORT_DEFINE_RELEASE
581#undef ORT_DEFINE_RELEASE_FROM_API_STRUCT
692struct AllocatorWithDefaultOptions;
717 explicit Status(std::nullptr_t)
noexcept {}
720 explicit Status(
const std::exception&)
noexcept;
768 void GetKeyValuePairs(std::vector<const char*>& keys, std::vector<const char*>& values)
const;
785 explicit KeyValuePairs(
const std::unordered_map<std::string, std::string>& kv_pairs);
788 void Add(
const char* key,
const char* value);
851 explicit Env(std::nullptr_t) {}
877 const std::unordered_map<std::string, std::string>& options,
1012 std::unordered_map<std::string, std::string> flat_configs_;
1025template <
typename T>
1026struct ConstSessionOptionsImpl : Base<T> {
1032 std::string GetConfigEntry(
const char* config_key)
const;
1033 bool HasConfigEntry(
const char* config_key)
const;
1034 std::string GetConfigEntryOrDefault(
const char* config_key,
const std::string& def)
const;
1037template <
typename T>
1038struct SessionOptionsImpl : ConstSessionOptionsImpl<T> {
1039 using B = ConstSessionOptionsImpl<T>;
1042 SessionOptionsImpl& SetIntraOpNumThreads(
int intra_op_num_threads);
1043 SessionOptionsImpl& SetInterOpNumThreads(
int inter_op_num_threads);
1045 SessionOptionsImpl& SetDeterministicCompute(
bool value);
1047 SessionOptionsImpl& EnableCpuMemArena();
1048 SessionOptionsImpl& DisableCpuMemArena();
1050 SessionOptionsImpl& SetOptimizedModelFilePath(
const ORTCHAR_T* optimized_model_file);
1052 SessionOptionsImpl& EnableProfiling(
const ORTCHAR_T* profile_file_prefix);
1053 SessionOptionsImpl& DisableProfiling();
1055 SessionOptionsImpl& EnableOrtCustomOps();
1057 SessionOptionsImpl& EnableMemPattern();
1058 SessionOptionsImpl& DisableMemPattern();
1060 SessionOptionsImpl& SetExecutionMode(
ExecutionMode execution_mode);
1062 SessionOptionsImpl& SetLoadCancellationFlag(
bool value);
1064 SessionOptionsImpl& SetLogId(
const char* logid);
1065 SessionOptionsImpl& SetLogSeverityLevel(
int level);
1069 SessionOptionsImpl& DisablePerSessionThreads();
1071 SessionOptionsImpl& AddConfigEntry(
const char* config_key,
const char* config_value);
1073 SessionOptionsImpl& AddInitializer(
const char* name,
const OrtValue* ort_val);
1074 SessionOptionsImpl& AddExternalInitializers(
const std::vector<std::string>& names,
const std::vector<Value>& ort_values);
1075 SessionOptionsImpl& AddExternalInitializersFromFilesInMemory(
const std::vector<std::basic_string<ORTCHAR_T>>& external_initializer_file_names,
1076 const std::vector<char*>& external_initializer_file_buffer_array,
1077 const std::vector<size_t>& external_initializer_file_lengths);
1084 SessionOptionsImpl& AppendExecutionProvider_OpenVINO_V2(
const std::unordered_map<std::string, std::string>& provider_options = {});
1093 SessionOptionsImpl& AppendExecutionProvider(
const std::string& provider_name,
1094 const std::unordered_map<std::string, std::string>& provider_options = {});
1098 SessionOptionsImpl& AppendExecutionProvider_V2(Env& env,
const std::vector<ConstEpDevice>& ep_devices,
1099 const KeyValuePairs& ep_options);
1102 SessionOptionsImpl& AppendExecutionProvider_V2(Env& env,
const std::vector<ConstEpDevice>& ep_devices,
1103 const std::unordered_map<std::string, std::string>& ep_options);
1109 SessionOptionsImpl& SetEpSelectionPolicy(
EpSelectionDelegate delegate,
void* state =
nullptr);
1112 SessionOptionsImpl& SetCustomThreadCreationOptions(
void* ort_custom_thread_creation_options);
1118 SessionOptionsImpl& RegisterCustomOpsLibrary(
const ORTCHAR_T* library_name,
const CustomOpConfigs& custom_op_configs = {});
1120 SessionOptionsImpl& RegisterCustomOpsUsingFunction(
const char* function_name);
1123 SessionOptionsImpl& AppendExecutionProvider_VitisAI(
const std::unordered_map<std::string, std::string>& provider_options = {});
1156 size_t input_model_data_size);
1160 size_t initializer_size_threshold);
1162 size_t* output_model_buffer_size_ptr);
1250template <
typename T>
1304template <
typename T>
1326 std::vector<Value>
Run(
const RunOptions& run_options,
const char*
const* input_names,
const Value* input_values,
size_t input_count,
1327 const char*
const* output_names,
size_t output_count);
1332 void Run(
const RunOptions& run_options,
const char*
const* input_names,
const Value* input_values,
size_t input_count,
1333 const char*
const* output_names,
Value* output_values,
size_t output_count);
1357 const char*
const* output_names,
Value* output_values,
size_t output_count,
RunAsyncCallbackFn callback,
void* user_data);
1410#if !defined(ORT_MINIMAL_BUILD)
1427template <
typename T>
1438 template <
typename U>
1458template <
typename T>
1472 [[deprecated(
"use GetShape()")]]
void GetDimensions(int64_t* values,
size_t values_count)
const;
1500 const std::vector<int64_t>& dims,
1501 const std::vector<std::string>* symbolic_dims =
nullptr);
1507template <
typename T>
1531template <
typename T>
1544template <
typename T>
1569template <
typename T>
1601#if !defined(ORT_MINIMAL_BUILD)
1637template <
typename T>
1645 template <
typename R>
1684 template <
typename R>
1741#if !defined(DISABLE_SPARSE_TENSORS)
1775 template <
typename R>
1792 template <
typename R>
1798template <
typename T>
1808 template <
typename R>
1824 template <
typename R>
1825 R&
At(
const std::vector<int64_t>& location);
1855#if !defined(DISABLE_SPARSE_TENSORS)
1876 void UseCsrIndices(int64_t* inner_data,
size_t inner_num, int64_t* outer_data,
size_t outer_num);
1898 const int64_t* indices_data,
size_t indices_num);
1913 const int64_t* inner_indices_data,
size_t inner_indices_num,
1914 const int64_t* outer_indices_data,
size_t outer_indices_num);
1927 const Shape& indices_shape,
1928 const int32_t* indices_data);
1962 template <
typename T>
1964 const int64_t* shape,
size_t shape_len);
1976 const int64_t* shape,
size_t shape_len,
1989 const int64_t* shape,
size_t shape_len,
2003 template <
typename T>
2047 template <
typename T>
2050#if !defined(DISABLE_SPARSE_TENSORS)
2061 template <
typename T>
2063 const Shape& values_shape);
2093 template <
typename T>
2126 void* get() {
return p_; }
2127 size_t size()
const {
return size_; }
2136template <
typename T>
2137struct AllocatorImpl : Base<T> {
2141 void* Alloc(
size_t size);
2142 MemoryAllocation GetAllocation(
size_t size);
2144 ConstMemoryInfo GetInfo()
const;
2168namespace binding_utils {
2168namespace binding_utils {
…}
2174template <
typename T>
2185template <
typename T>
2228 ArenaCfg(
size_t max_mem,
int arena_extend_strategy,
int initial_chunk_size_bytes,
int max_dead_bytes_per_chunk);
2254#define ORT_CXX_LOG(logger, message_severity, message) \
2256 if (message_severity >= logger.GetLoggingSeverityLevel()) { \
2257 Ort::ThrowOnError(logger.LogMessage(message_severity, ORT_FILE, __LINE__, \
2258 static_cast<const char*>(__FUNCTION__), message)); \
2270#define ORT_CXX_LOG_NOEXCEPT(logger, message_severity, message) \
2272 if (message_severity >= logger.GetLoggingSeverityLevel()) { \
2273 static_cast<void>(logger.LogMessage(message_severity, ORT_FILE, __LINE__, \
2274 static_cast<const char*>(__FUNCTION__), message)); \
2289#define ORT_CXX_LOGF(logger, message_severity, ...) \
2291 if (message_severity >= logger.GetLoggingSeverityLevel()) { \
2292 Ort::ThrowOnError(logger.LogFormattedMessage(message_severity, ORT_FILE, __LINE__, \
2293 static_cast<const char*>(__FUNCTION__), __VA_ARGS__)); \
2308#define ORT_CXX_LOGF_NOEXCEPT(logger, message_severity, ...) \
2310 if (message_severity >= logger.GetLoggingSeverityLevel()) { \
2311 static_cast<void>(logger.LogFormattedMessage(message_severity, ORT_FILE, __LINE__, \
2312 static_cast<const char*>(__FUNCTION__), __VA_ARGS__)); \
2373 const
char* func_name, const
char* message) const noexcept;
2389 template <typename... Args>
2391 const
char* func_name, const
char* format, Args&&... args) const noexcept;
2419 void ParallelFor(
void (*fn)(
void*,
size_t),
size_t total,
size_t num_batch,
void* usr_data)
const;
2428namespace attr_utils {
2429void GetAttr(
const OrtKernelInfo* p,
const char* name,
float&);
2430void GetAttr(
const OrtKernelInfo* p,
const char* name, int64_t&);
2431void GetAttr(
const OrtKernelInfo* p,
const char* name, std::string&);
2432void GetAttrs(
const OrtKernelInfo* p,
const char* name, std::vector<float>&);
2433void GetAttrs(
const OrtKernelInfo* p,
const char* name, std::vector<int64_t>&);
2428namespace attr_utils {
…}
2436template <
typename T>
2437struct KernelInfoImpl :
Base<T> {
2443 template <
typename R>
2444 R GetAttribute(
const char* name)
const {
2446 attr_utils::GetAttr(this->p_, name, val);
2450 template <
typename R>
2451 std::vector<R> GetAttributes(
const char* name)
const {
2452 std::vector<R> result;
2453 attr_utils::GetAttrs(this->p_, name, result);
2457 Value GetTensorAttribute(
const char* name,
OrtAllocator* allocator)
const;
2459 size_t GetInputCount()
const;
2460 size_t GetOutputCount()
const;
2462 std::string GetInputName(
size_t index)
const;
2463 std::string GetOutputName(
size_t index)
const;
2465 TypeInfo GetInputTypeInfo(
size_t index)
const;
2466 TypeInfo GetOutputTypeInfo(
size_t index)
const;
2468 ConstValue GetTensorConstantInput(
size_t index,
int* is_constant)
const;
2470 std::string GetNodeName()
const;
2471 Logger GetLogger()
const;
2485 using Base = detail::KernelInfoImpl<OrtKernelInfo>;
2499 explicit Op(std::nullptr_t) {}
2504 int version,
const char** type_constraint_names,
2506 size_t type_constraint_count,
2507 const OpAttr* attr_values,
2509 size_t input_count,
size_t output_count);
2512 const Value* input_values,
2514 Value* output_values,
2515 size_t output_count);
2519 const OrtValue*
const* input_values,
2522 size_t output_count);
2539 if (is_int_ == dim.is_int_) {
2541 return i_ == dim.
i_;
2543 return std::string{s_} == std::string{dim.
s_};
2551 const char*
AsSym()
const {
return s_; }
2553 static constexpr int INVALID_INT_DIM = -2;
2563 using Shape = std::vector<SymbolicInteger>;
2589 const OrtOpAttr* GetAttrHdl(
const char* attr_name)
const;
2592 std::vector<Shape> input_shapes_;
2597#define MAX_CUSTOM_OP_END_VER (1UL << 31) - 1
2599template <
typename TOp,
typename TKernel,
bool WithStatus = false>
2614#if defined(_MSC_VER) && !defined(__clang__)
2615#pragma warning(push)
2616#pragma warning(disable : 26409)
2619#if defined(_MSC_VER) && !defined(__clang__)
2629#ifdef __cpp_if_constexpr
2630 if constexpr (WithStatus) {
2635 return static_cast<const TOp*
>(this_)->CreateKernelV2(*api, info, op_kernel);
2638 return static_cast<TKernel*
>(op_kernel)->ComputeV2(context);
2646 static_cast<TKernel*
>(op_kernel)->Compute(context);
2650 SetShapeInferFn<TOp>(0);
2653 return static_cast<const TOp*
>(this_)->start_ver_;
2657 return static_cast<const TOp*
>(this_)->end_ver_;
2672 return OrtCustomOpInputOutputCharacteristic::INPUT_OUTPUT_REQUIRED;
2676 return OrtCustomOpInputOutputCharacteristic::INPUT_OUTPUT_REQUIRED;
2712 return std::vector<std::string>{};
2718 template <
typename C>
2722 return C::InferOutputShape(ctx);
2727 template <
typename C>
2737 int end_ver_ = MAX_CUSTOM_OP_END_VER;
2741template <
typename T>
2769template <
typename T>
2783#if !defined(ORT_MINIMAL_BUILD)
2784 Node(
const std::string& operator_name,
const std::string& operator_domain,
2785 const std::string& node_name,
2786 const std::vector<std::string>& input_names,
2787 const std::vector<std::string>& output_names);
2792 Node(
const std::string& operator_name,
const std::string& operator_domain,
2793 const std::string& node_name,
2794 const std::vector<std::string>& input_names,
2795 const std::vector<std::string>& output_names,
2796 std::vector<OpAttr>& attributes);
2799 static void Init(
const std::string& operator_name,
const std::string& operator_domain,
2800 const std::string& node_name,
2801 const std::vector<std::string>& input_names,
2802 const std::vector<std::string>& output_names,
2803 std::vector<OpAttr>& attributes,
2809template <
typename T>
2814#if !defined(ORT_MINIMAL_BUILD)
2815 void SetInputs(std::vector<ValueInfo>& inputs);
2816 void SetOutputs(std::vector<ValueInfo>& outputs);
2817 void AddInitializer(
const std::string& name,
Value& initializer,
bool data_is_external);
2818 void AddNode(
Node& node);
2826struct Graph : detail::GraphImpl<OrtGraph> {
2829#if !defined(ORT_MINIMAL_BUILD)
2835template <
typename T>
2840#if !defined(ORT_MINIMAL_BUILD)
2858#if !defined(ORT_MINIMAL_BUILD)
2859 explicit Model(
const std::vector<DomainOpsetPair>& opsets);
2865#include "onnxruntime_cxx_inline.h"
2859 explicit Model(
const std::vector<DomainOpsetPair>& opsets); {
…}
2826struct Graph : detail::GraphImpl<OrtGraph> {
…};
2784 Node(
const std::string& operator_name,
const std::string& operator_domain, {
…}
2228 ArenaCfg(
size_t max_mem,
int arena_extend_strategy,
int initial_chunk_size_bytes,
int max_dead_bytes_per_chunk); {
…}
struct OrtMemoryInfo OrtMemoryInfo
Definition onnxruntime_c_api.h:284
struct OrtKernelInfo OrtKernelInfo
Definition onnxruntime_c_api.h:380
struct OrtNode OrtNode
Definition onnxruntime_c_api.h:312
OrtLoggingLevel
Logging severity levels.
Definition onnxruntime_c_api.h:237
OrtMemoryInfoDeviceType
This mimics OrtDevice type constants so they can be returned in the API.
Definition onnxruntime_c_api.h:404
struct OrtShapeInferContext OrtShapeInferContext
Definition onnxruntime_c_api.h:309
void(* OrtLoggingFunction)(void *param, OrtLoggingLevel severity, const char *category, const char *logid, const char *code_location, const char *message)
Definition onnxruntime_c_api.h:345
void(* OrtCustomJoinThreadFn)(OrtCustomThreadHandle ort_custom_thread_handle)
Custom thread join function.
Definition onnxruntime_c_api.h:788
OrtCustomOpInputOutputCharacteristic
Definition onnxruntime_c_api.h:5271
struct OrtTensorRTProviderOptionsV2 OrtTensorRTProviderOptionsV2
Definition onnxruntime_c_api.h:301
struct OrtOpAttr OrtOpAttr
Definition onnxruntime_c_api.h:307
struct OrtThreadingOptions OrtThreadingOptions
Definition onnxruntime_c_api.h:298
struct OrtSequenceTypeInfo OrtSequenceTypeInfo
Definition onnxruntime_c_api.h:292
struct OrtValueInfo OrtValueInfo
Definition onnxruntime_c_api.h:311
struct OrtDnnlProviderOptions OrtDnnlProviderOptions
Definition onnxruntime_c_api.h:305
OrtSparseIndicesFormat
Definition onnxruntime_c_api.h:226
struct OrtPrepackedWeightsContainer OrtPrepackedWeightsContainer
Definition onnxruntime_c_api.h:300
struct OrtSession OrtSession
Definition onnxruntime_c_api.h:286
OrtStatus *(* EpSelectionDelegate)(const OrtEpDevice **ep_devices, size_t num_devices, const OrtKeyValuePairs *model_metadata, const OrtKeyValuePairs *runtime_metadata, const OrtEpDevice **selected, size_t max_selected, size_t *num_selected, void *state)
Delegate to allow providing custom OrtEpDevice selection logic.
Definition onnxruntime_c_api.h:447
struct OrtCustomOpDomain OrtCustomOpDomain
Definition onnxruntime_c_api.h:295
struct OrtIoBinding OrtIoBinding
Definition onnxruntime_c_api.h:285
OrtAllocatorType
Definition onnxruntime_c_api.h:386
struct OrtOp OrtOp
Definition onnxruntime_c_api.h:306
struct OrtTypeInfo OrtTypeInfo
Definition onnxruntime_c_api.h:289
struct OrtTensorTypeAndShapeInfo OrtTensorTypeAndShapeInfo
Definition onnxruntime_c_api.h:290
struct OrtCUDAProviderOptionsV2 OrtCUDAProviderOptionsV2
Definition onnxruntime_c_api.h:303
struct OrtKernelContext OrtKernelContext
Definition onnxruntime_c_api.h:382
struct OrtCANNProviderOptions OrtCANNProviderOptions
Definition onnxruntime_c_api.h:304
struct OrtEpDevice OrtEpDevice
Definition onnxruntime_c_api.h:317
void(* RunAsyncCallbackFn)(void *user_data, OrtValue **outputs, size_t num_outputs, OrtStatusPtr status)
Callback function for RunAsync.
Definition onnxruntime_c_api.h:799
OrtHardwareDeviceType
Definition onnxruntime_c_api.h:410
struct OrtModel OrtModel
Definition onnxruntime_c_api.h:314
struct OrtGraph OrtGraph
Definition onnxruntime_c_api.h:313
struct OrtSessionOptions OrtSessionOptions
Definition onnxruntime_c_api.h:294
struct OrtValue OrtValue
Definition onnxruntime_c_api.h:287
GraphOptimizationLevel
Graph optimization level.
Definition onnxruntime_c_api.h:354
struct OrtKeyValuePairs OrtKeyValuePairs
Definition onnxruntime_c_api.h:318
OrtStatus * OrtStatusPtr
Definition onnxruntime_c_api.h:323
OrtMemType
Memory types for allocated memory, execution provider specific types should be extended in each provi...
Definition onnxruntime_c_api.h:395
OrtSparseFormat
Definition onnxruntime_c_api.h:218
ONNXType
Definition onnxruntime_c_api.h:206
struct OrtEnv OrtEnv
Definition onnxruntime_c_api.h:282
OrtErrorCode
Definition onnxruntime_c_api.h:245
struct OrtStatus OrtStatus
Definition onnxruntime_c_api.h:283
#define ORT_API_VERSION
The API version defined in this header.
Definition onnxruntime_c_api.h:41
struct OrtLogger OrtLogger
Definition onnxruntime_c_api.h:308
struct OrtMapTypeInfo OrtMapTypeInfo
Definition onnxruntime_c_api.h:291
struct OrtArenaCfg OrtArenaCfg
Definition onnxruntime_c_api.h:299
ExecutionMode
Definition onnxruntime_c_api.h:361
OrtOpAttrType
Definition onnxruntime_c_api.h:262
OrtCustomThreadHandle(* OrtCustomCreateThreadFn)(void *ort_custom_thread_creation_options, OrtThreadWorkerFn ort_thread_worker_fn, void *ort_worker_fn_param)
Ort custom thread creation function.
Definition onnxruntime_c_api.h:781
ONNXTensorElementDataType
Definition onnxruntime_c_api.h:177
OrtExecutionProviderDevicePolicy
These are the default EP selection policies used by ORT when doing automatic EP selection.
Definition onnxruntime_c_api.h:418
const OrtApiBase * OrtGetApiBase(void)
The Onnxruntime library's entry point to access the C API.
@ ORT_LOGGING_LEVEL_WARNING
Warning messages.
Definition onnxruntime_c_api.h:240
@ OrtMemTypeDefault
The default allocator for execution provider.
Definition onnxruntime_c_api.h:399
@ ORT_FAIL
Definition onnxruntime_c_api.h:247
@ ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT
Definition onnxruntime_c_api.h:179
std::vector< Value > GetOutputValuesHelper(const OrtIoBinding *binding, OrtAllocator *)
std::vector< std::string > GetOutputNamesHelper(const OrtIoBinding *binding, OrtAllocator *)
void OrtRelease(OrtAllocator *ptr)
Definition onnxruntime_cxx_api.h:551
std::string MakeCustomOpConfigEntryKey(const char *custom_op_name, const char *config)
All C++ Onnxruntime APIs are defined inside this namespace.
Definition onnxruntime_cxx_api.h:48
const OrtModelEditorApi & GetModelEditorApi()
This returns a reference to the ORT C Model Editor API. Used if building or augmenting a model at run...
Definition onnxruntime_cxx_api.h:151
std::unique_ptr< char, detail::AllocatedFree > AllocatedStringPtr
unique_ptr typedef used to own strings allocated by OrtAllocators and release them at the end of the ...
Definition onnxruntime_cxx_api.h:707
detail::ConstSessionOptionsImpl< detail::Unowned< const OrtSessionOptions > > ConstSessionOptions
Definition onnxruntime_cxx_api.h:1128
detail::KernelInfoImpl< detail::Unowned< const OrtKernelInfo > > ConstKernelInfo
Definition onnxruntime_cxx_api.h:2476
const OrtApi & GetApi() noexcept
This returns a reference to the ORT C API.
Definition onnxruntime_cxx_api.h:125
const OrtCompileApi & GetCompileApi()
This returns a reference to the ORT C Compile API. Used if compiling a model at runtime.
Definition onnxruntime_cxx_api.h:165
detail::AllocatorImpl< detail::Unowned< OrtAllocator > > UnownedAllocator
Definition onnxruntime_cxx_api.h:2165
detail::SessionOptionsImpl< detail::Unowned< OrtSessionOptions > > UnownedSessionOptions
Definition onnxruntime_cxx_api.h:1127
std::string GetBuildInfoString()
This function returns the onnxruntime build information: including git branch, git commit id,...
const OrtEpApi & GetEpApi()
This returns a reference to the ORT C EP API. Used if authoring a plugin execution provider.
Definition onnxruntime_cxx_api.h:179
std::string GetVersionString()
This function returns the onnxruntime version string.
std::vector< std::string > GetAvailableProviders()
This is a C++ wrapper for OrtApi::GetAvailableProviders() and returns a vector of strings representin...
Ort::Status(*)(Ort::ShapeInferContext &) ShapeInferFn
Definition onnxruntime_cxx_api.h:2595
Status CompileModel(const Env &env, const ModelCompilationOptions &model_compilation_options)
Compiles an input model to generate a model with EPContext nodes that execute EP-specific kernels....
Wrapper around OrtAllocator.
Definition onnxruntime_cxx_api.h:2160
Allocator(const Session &session, const OrtMemoryInfo *)
Allocator(std::nullptr_t)
Convenience to create a class member and then replace with an instance.
Definition onnxruntime_cxx_api.h:2161
Wrapper around OrtAllocator default instance that is owned by Onnxruntime.
Definition onnxruntime_cxx_api.h:2152
AllocatorWithDefaultOptions(std::nullptr_t)
Convenience to create a class member and then replace with an instance.
Definition onnxruntime_cxx_api.h:2153
AllocatorWithDefaultOptions()
it is a structure that represents the configuration of an arena based allocator
Definition onnxruntime_cxx_api.h:2218
ArenaCfg(std::nullptr_t)
Create an empty ArenaCfg object, must be assigned a valid one to be used.
Definition onnxruntime_cxx_api.h:2219
ArenaCfg(size_t max_mem, int arena_extend_strategy, int initial_chunk_size_bytes, int max_dead_bytes_per_chunk)
bfloat16 (Brain Floating Point) data type
Definition onnxruntime_cxx_api.h:349
bool operator==(const BFloat16_t &rhs) const noexcept
onnxruntime_float16::BFloat16Impl< BFloat16_t > Base
Definition onnxruntime_cxx_api.h:361
static constexpr BFloat16_t FromBits(uint16_t v) noexcept
Explicit conversion to uint16_t representation of bfloat16.
Definition onnxruntime_cxx_api.h:370
bool operator!=(const BFloat16_t &rhs) const noexcept
Definition onnxruntime_cxx_api.h:468
BFloat16_t(float v) noexcept
__ctor from float. Float is converted into bfloat16 16-bit representation.
Definition onnxruntime_cxx_api.h:376
float ToFloat() const noexcept
Converts bfloat16 to float.
Definition onnxruntime_cxx_api.h:382
bool operator<(const BFloat16_t &rhs) const noexcept
Definition onnxruntime_cxx_api.h:2600
OrtCustomOpInputOutputCharacteristic GetOutputCharacteristic(size_t) const
Definition onnxruntime_cxx_api.h:2675
OrtCustomOpInputOutputCharacteristic GetInputCharacteristic(size_t) const
Definition onnxruntime_cxx_api.h:2671
OrtMemType GetInputMemoryType(size_t) const
Definition onnxruntime_cxx_api.h:2680
std::vector< std::string > GetSessionConfigKeys() const
Definition onnxruntime_cxx_api.h:2711
bool GetVariadicInputHomogeneity() const
Definition onnxruntime_cxx_api.h:2692
int GetVariadicInputMinArity() const
Definition onnxruntime_cxx_api.h:2686
void SetShapeInferFn(...)
Definition onnxruntime_cxx_api.h:2728
CustomOpBase()
Definition onnxruntime_cxx_api.h:2601
bool GetVariadicOutputHomogeneity() const
Definition onnxruntime_cxx_api.h:2704
int GetVariadicOutputMinArity() const
Definition onnxruntime_cxx_api.h:2698
decltype(&C::InferOutputShape) SetShapeInferFn(decltype(&C::InferOutputShape))
Definition onnxruntime_cxx_api.h:2719
const char * GetExecutionProviderType() const
Definition onnxruntime_cxx_api.h:2667
void GetSessionConfigs(std::unordered_map< std::string, std::string > &out, ConstSessionOptions options) const
Class that represents session configuration entries for one or more custom operators.
Definition onnxruntime_cxx_api.h:983
~CustomOpConfigs()=default
CustomOpConfigs & AddConfig(const char *custom_op_name, const char *config_key, const char *config_value)
Adds a session configuration entry/value for a specific custom operator.
CustomOpConfigs & operator=(CustomOpConfigs &&o)=default
CustomOpConfigs(CustomOpConfigs &&o)=default
CustomOpConfigs()=default
const std::unordered_map< std::string, std::string > & GetFlattenedConfigs() const
Returns a flattened map of custom operator configuration entries and their values.
CustomOpConfigs(const CustomOpConfigs &)=default
CustomOpConfigs & operator=(const CustomOpConfigs &)=default
Custom Op Domain.
Definition onnxruntime_cxx_api.h:889
CustomOpDomain(std::nullptr_t)
Create an empty CustomOpDomain object, must be assigned a valid one to be used.
Definition onnxruntime_cxx_api.h:893
CustomOpDomain(const char *domain)
Wraps OrtApi::CreateCustomOpDomain.
void Add(const OrtCustomOp *op)
Wraps CustomOpDomain_Add.
The Env (Environment)
Definition onnxruntime_cxx_api.h:850
Env & EnableTelemetryEvents()
Wraps OrtApi::EnableTelemetryEvents.
Env(OrtEnv *p)
C Interop Helper.
Definition onnxruntime_cxx_api.h:867
Env & CreateAndRegisterAllocatorV2(const std::string &provider_type, const OrtMemoryInfo *mem_info, const std::unordered_map< std::string, std::string > &options, const OrtArenaCfg *arena_cfg)
Wraps OrtApi::CreateAndRegisterAllocatorV2.
Env & UnregisterExecutionProviderLibrary(const char *registration_name)
Wraps OrtApi::UnregisterExecutionProviderLibrary.
std::vector< ConstEpDevice > GetEpDevices() const
Env(std::nullptr_t)
Create an empty Env object, must be assigned a valid one to be used.
Definition onnxruntime_cxx_api.h:851
Env(OrtLoggingLevel logging_level=ORT_LOGGING_LEVEL_WARNING, const char *logid="")
Wraps OrtApi::CreateEnv.
Env(const OrtThreadingOptions *tp_options, OrtLoggingLevel logging_level=ORT_LOGGING_LEVEL_WARNING, const char *logid="")
Wraps OrtApi::CreateEnvWithGlobalThreadPools.
Env(const OrtThreadingOptions *tp_options, OrtLoggingFunction logging_function, void *logger_param, OrtLoggingLevel logging_level=ORT_LOGGING_LEVEL_WARNING, const char *logid="")
Wraps OrtApi::CreateEnvWithCustomLoggerAndGlobalThreadPools.
Env(OrtLoggingLevel logging_level, const char *logid, OrtLoggingFunction logging_function, void *logger_param)
Wraps OrtApi::CreateEnvWithCustomLogger.
Env & CreateAndRegisterAllocator(const OrtMemoryInfo *mem_info, const OrtArenaCfg *arena_cfg)
Wraps OrtApi::CreateAndRegisterAllocator.
Env & RegisterExecutionProviderLibrary(const char *registration_name, const std::basic_string< char > &path)
Wraps OrtApi::RegisterExecutionProviderLibrary.
Env & UpdateEnvWithCustomLogLevel(OrtLoggingLevel log_severity_level)
Wraps OrtApi::UpdateEnvWithCustomLogLevel.
Env & DisableTelemetryEvents()
Wraps OrtApi::DisableTelemetryEvents.
Mutable EpDevice that is created by EpApi users.
Definition onnxruntime_cxx_api.h:836
EpDevice(OrtEpDevice *p)
Take ownership of a pointer created by C API.
Definition onnxruntime_cxx_api.h:838
EpDevice(OrtEpFactory &ep_factory, ConstHardwareDevice &hardware_device, ConstKeyValuePairs ep_metadata={}, ConstKeyValuePairs ep_options={})
Wraps OrtEpApi::CreateEpDevice.
EpDevice(std::nullptr_t)
No instance is created.
Definition onnxruntime_cxx_api.h:837
All C++ methods that can fail will throw an exception of this type.
Definition onnxruntime_cxx_api.h:54
const char * what() const noexcept override
Definition onnxruntime_cxx_api.h:58
OrtErrorCode GetOrtErrorCode() const
Definition onnxruntime_cxx_api.h:57
Exception(std::string &&string, OrtErrorCode code)
Definition onnxruntime_cxx_api.h:55
IEEE 754 half-precision floating point data type.
Definition onnxruntime_cxx_api.h:207
Float16_t()=default
Default constructor.
Float16_t(float v) noexcept
__ctor from float. Float is converted into float16 16-bit representation.
Definition onnxruntime_cxx_api.h:235
onnxruntime_float16::Float16Impl< Float16_t > Base
Definition onnxruntime_cxx_api.h:217
float ToFloat() const noexcept
Converts float16 to float.
Definition onnxruntime_cxx_api.h:241
static constexpr Float16_t FromBits(uint16_t v) noexcept
Explicit conversion to uint16_t representation of float16.
Definition onnxruntime_cxx_api.h:229
float8e4m3fn (Float8 Floating Point) data type
Definition onnxruntime_cxx_api.h:479
uint8_t value
Definition onnxruntime_cxx_api.h:480
constexpr Float8E4M3FN_t(uint8_t v) noexcept
Definition onnxruntime_cxx_api.h:482
constexpr bool operator==(const Float8E4M3FN_t &rhs) const noexcept
Definition onnxruntime_cxx_api.h:485
constexpr Float8E4M3FN_t() noexcept
Definition onnxruntime_cxx_api.h:481
constexpr bool operator!=(const Float8E4M3FN_t &rhs) const noexcept
Definition onnxruntime_cxx_api.h:486
float8e4m3fnuz (Float8 Floating Point) data type
Definition onnxruntime_cxx_api.h:496
constexpr bool operator==(const Float8E4M3FNUZ_t &rhs) const noexcept
Definition onnxruntime_cxx_api.h:502
uint8_t value
Definition onnxruntime_cxx_api.h:497
constexpr Float8E4M3FNUZ_t() noexcept
Definition onnxruntime_cxx_api.h:498
constexpr bool operator!=(const Float8E4M3FNUZ_t &rhs) const noexcept
Definition onnxruntime_cxx_api.h:503
constexpr Float8E4M3FNUZ_t(uint8_t v) noexcept
Definition onnxruntime_cxx_api.h:499
float8e5m2 (Float8 Floating Point) data type
Definition onnxruntime_cxx_api.h:513
constexpr Float8E5M2_t(uint8_t v) noexcept
Definition onnxruntime_cxx_api.h:516
uint8_t value
Definition onnxruntime_cxx_api.h:514
constexpr bool operator!=(const Float8E5M2_t &rhs) const noexcept
Definition onnxruntime_cxx_api.h:520
constexpr Float8E5M2_t() noexcept
Definition onnxruntime_cxx_api.h:515
constexpr bool operator==(const Float8E5M2_t &rhs) const noexcept
Definition onnxruntime_cxx_api.h:519
float8e5m2fnuz (Float8 Floating Point) data type
Definition onnxruntime_cxx_api.h:530
constexpr Float8E5M2FNUZ_t() noexcept
Definition onnxruntime_cxx_api.h:532
constexpr Float8E5M2FNUZ_t(uint8_t v) noexcept
Definition onnxruntime_cxx_api.h:533
constexpr bool operator!=(const Float8E5M2FNUZ_t &rhs) const noexcept
Definition onnxruntime_cxx_api.h:537
constexpr bool operator==(const Float8E5M2FNUZ_t &rhs) const noexcept
Definition onnxruntime_cxx_api.h:536
uint8_t value
Definition onnxruntime_cxx_api.h:531
Definition onnxruntime_cxx_api.h:86
static const OrtApi * api_
Definition onnxruntime_cxx_api.h:87
Wrapper around OrtGraph.
Definition onnxruntime_cxx_api.h:2826
Graph(OrtGraph *p)
Take ownership of a pointer created by C API.
Definition onnxruntime_cxx_api.h:2828
Graph(std::nullptr_t)
No instance is created.
Definition onnxruntime_cxx_api.h:2827
Wrapper around OrtIoBinding.
Definition onnxruntime_cxx_api.h:2207
UnownedIoBinding GetUnowned() const
Definition onnxruntime_cxx_api.h:2211
ConstIoBinding GetConst() const
Definition onnxruntime_cxx_api.h:2210
IoBinding(Session &session)
IoBinding(std::nullptr_t)
Create an empty object for convenience. Sometimes, we want to initialize members later.
Definition onnxruntime_cxx_api.h:2208
This class wraps a raw pointer OrtKernelContext* that is being passed to the custom kernel Compute() ...
Definition onnxruntime_cxx_api.h:2404
KernelContext(OrtKernelContext *context)
ConstValue GetInput(size_t index) const
OrtKernelContext * GetOrtKernelContext() const
Definition onnxruntime_cxx_api.h:2418
void ParallelFor(void(*fn)(void *, size_t), size_t total, size_t num_batch, void *usr_data) const
OrtAllocator * GetAllocator(const OrtMemoryInfo &memory_info) const
void * GetGPUComputeStream() const
size_t GetInputCount() const
size_t GetOutputCount() const
UnownedValue GetOutput(size_t index, const std::vector< int64_t > &dims) const
UnownedValue GetOutput(size_t index, const int64_t *dim_values, size_t dim_count) const
This struct owns the OrtKernInfo* pointer when a copy is made. For convenient wrapping of OrtKernelIn...
Definition onnxruntime_cxx_api.h:2484
KernelInfo(OrtKernelInfo *info)
Take ownership of the instance.
ConstKernelInfo GetConst() const
Definition onnxruntime_cxx_api.h:2489
detail::KernelInfoImpl< OrtKernelInfo > Base
Definition onnxruntime_cxx_api.h:2485
KernelInfo(std::nullptr_t)
Create an empty instance to initialize later.
Definition onnxruntime_cxx_api.h:2487
Wrapper around OrtKeyValuePairs.
Definition onnxruntime_cxx_api.h:776
KeyValuePairs()
Wraps OrtApi::CreateKeyValuePairs.
void Add(const char *key, const char *value)
Wraps OrtApi::AddKeyValuePair.
KeyValuePairs(const std::unordered_map< std::string, std::string > &kv_pairs)
Wraps OrtApi::CreateKeyValuePairs and OrtApi::AddKeyValuePair.
void Remove(const char *key)
Wraps OrtApi::RemoveKeyValuePair.
KeyValuePairs(std::nullptr_t)
Definition onnxruntime_cxx_api.h:777
ConstKeyValuePairs GetConst() const
Definition onnxruntime_cxx_api.h:793
KeyValuePairs(OrtKeyValuePairs *p)
Take ownership of a pointer created by C API.
Definition onnxruntime_cxx_api.h:779
This class represents an ONNX Runtime logger that can be used to log information with an associated s...
Definition onnxruntime_cxx_api.h:2326
Logger(Logger &&v) noexcept=default
Logger & operator=(Logger &&v) noexcept=default
Logger & operator=(const Logger &)=default
Logger(const Logger &)=default
Logger(std::nullptr_t)
Definition onnxruntime_cxx_api.h:2335
Logger(const OrtLogger *logger)
OrtLoggingLevel GetLoggingSeverityLevel() const noexcept
LoraAdapter holds a set of Lora Parameters loaded from a single file.
Definition onnxruntime_cxx_api.h:903
static LoraAdapter CreateLoraAdapter(const std::basic_string< char > &adapter_path, OrtAllocator *allocator)
Wraps OrtApi::CreateLoraAdapter.
LoraAdapter(std::nullptr_t)
Definition onnxruntime_cxx_api.h:907
static LoraAdapter CreateLoraAdapterFromArray(const void *bytes, size_t num_bytes, OrtAllocator *allocator)
Wraps OrtApi::CreateLoraAdapterFromArray.
Wrapper around OrtMapTypeInfo.
Definition onnxruntime_cxx_api.h:1559
ConstMapTypeInfo GetConst() const
Definition onnxruntime_cxx_api.h:1565
MapTypeInfo(OrtMapTypeInfo *p)
Used for interop with the C API.
Definition onnxruntime_cxx_api.h:1564
MapTypeInfo(std::nullptr_t)
Create an empty MapTypeInfo object, must be assigned a valid one to be used.
Definition onnxruntime_cxx_api.h:1563
Represents native memory allocation coming from one of the OrtAllocators registered with OnnxRuntime....
Definition onnxruntime_cxx_api.h:2118
MemoryAllocation(MemoryAllocation &&) noexcept
MemoryAllocation & operator=(const MemoryAllocation &)=delete
MemoryAllocation(const MemoryAllocation &)=delete
MemoryAllocation(OrtAllocator *allocator, void *p, size_t size)
size_t size() const
Definition onnxruntime_cxx_api.h:2127
Wrapper around OrtMemoryInfo.
Definition onnxruntime_cxx_api.h:1449
MemoryInfo(const char *name, OrtAllocatorType type, int id, OrtMemType mem_type)
MemoryInfo(std::nullptr_t)
No instance is created.
Definition onnxruntime_cxx_api.h:1451
MemoryInfo(OrtMemoryInfo *p)
Take ownership of a pointer created by C API.
Definition onnxruntime_cxx_api.h:1452
static MemoryInfo CreateCpu(OrtAllocatorType type, OrtMemType mem_type1)
ConstMemoryInfo GetConst() const
Definition onnxruntime_cxx_api.h:1454
Options object used when compiling a model.
Definition onnxruntime_cxx_api.h:1145
ModelCompilationOptions & SetEpContextEmbedMode(bool embed_ep_context_in_model)
Wraps OrtApi::ModelCompilationOptions_SetEpContextEmbedMode.
ModelCompilationOptions & SetInputModelFromBuffer(const void *input_model_data, size_t input_model_data_size)
Wraps OrtApi::ModelCompilationOptions_SetInputModelFromBuffer.
ModelCompilationOptions & SetOutputModelBuffer(OrtAllocator *allocator, void **output_model_buffer_ptr, size_t *output_model_buffer_size_ptr)
Wraps OrtApi::ModelCompilationOptions_SetOutputModelBuffer.
ModelCompilationOptions & SetOutputModelExternalInitializersFile(const char *file_path, size_t initializer_size_threshold)
Wraps OrtApi::ModelCompilationOptions_SetOutputModelExternalInitializersFile.
ModelCompilationOptions(std::nullptr_t)
Create an empty ModelCompilationOptions object, must be assigned a valid one to be used.
Definition onnxruntime_cxx_api.h:1149
ModelCompilationOptions(const Env &env, ConstSessionOptions session_options)
Wraps OrtApi::CreateModelCompilationOptionsFromSessionOptions.
ModelCompilationOptions & SetOutputModelPath(const char *output_model_path)
Wraps OrtApi::ModelCompilationOptions_SetOutputModelPath.
ModelCompilationOptions & SetInputModelPath(const char *input_model_path)
Wraps OrtApi::ModelCompilationOptions_SetInputModelPath.
ModelCompilationOptions(const Env &env, const SessionOptions &session_options)
Wraps OrtApi::CreateModelCompilationOptionsFromSessionOptions.
Wrapper around OrtModel.
Definition onnxruntime_cxx_api.h:2852
Model(const std::vector< DomainOpsetPair > &opsets)
Model(OrtModel *p)
Take ownership of a pointer created by C API.
Definition onnxruntime_cxx_api.h:2856
std::pair< std::string, int > DomainOpsetPair
Definition onnxruntime_cxx_api.h:2853
Model(std::nullptr_t)
No instance is created.
Definition onnxruntime_cxx_api.h:2855
ConstModel GetConst() const
Definition onnxruntime_cxx_api.h:2862
Wrapper around OrtNode.
Definition onnxruntime_cxx_api.h:2779
Node(const std::string &operator_name, const std::string &operator_domain, const std::string &node_name, const std::vector< std::string > &input_names, const std::vector< std::string > &output_names)
Node(std::nullptr_t)
No instance is created.
Definition onnxruntime_cxx_api.h:2780
Node(const std::string &operator_name, const std::string &operator_domain, const std::string &node_name, const std::vector< std::string > &input_names, const std::vector< std::string > &output_names, std::vector< OpAttr > &attributes)
Wraps CreateNode. Node takes ownership of attributes on success and updates the OpAttr in attributes ...
Node(OrtNode *p)
Take ownership of a pointer created by C API.
Definition onnxruntime_cxx_api.h:2781
This struct provides life time management for custom op attribute.
Definition onnxruntime_cxx_api.h:2238
OpAttr(const char *name, const void *data, int len, OrtOpAttrType type)
OpAttr(std::nullptr_t)
Definition onnxruntime_cxx_api.h:2242
Create and own custom defined operation.
Definition onnxruntime_cxx_api.h:2495
Op(OrtOp *)
Take ownership of the OrtOp.
static Op Create(const OrtKernelInfo *info, const char *op_name, const char *domain, int version, const char **type_constraint_names, const ONNXTensorElementDataType *type_constraint_values, size_t type_constraint_count, const OpAttr *attr_values, size_t attr_count, size_t input_count, size_t output_count)
Op(std::nullptr_t)
Create an empty Operator object, must be assigned a valid one to be used.
Definition onnxruntime_cxx_api.h:2499
void Invoke(const OrtKernelContext *context, const OrtValue *const *input_values, size_t input_count, OrtValue *const *output_values, size_t output_count)
void Invoke(const OrtKernelContext *context, const Value *input_values, size_t input_count, Value *output_values, size_t output_count)
RunOptions.
Definition onnxruntime_cxx_api.h:931
int GetRunLogSeverityLevel() const
Wraps OrtApi::RunOptionsGetRunLogSeverityLevel.
RunOptions & SetTerminate()
Terminates all currently executing Session::Run calls that were made using this RunOptions instance.
RunOptions & SetRunTag(const char *run_tag)
wraps OrtApi::RunOptionsSetRunTag
RunOptions & AddActiveLoraAdapter(const LoraAdapter &adapter)
Add the LoraAdapter to the list of active adapters. The setting does not affect RunWithBinding() call...
RunOptions & UnsetTerminate()
Clears the terminate flag so this RunOptions instance can be used in a new Session::Run call without ...
int GetRunLogVerbosityLevel() const
Wraps OrtApi::RunOptionsGetRunLogVerbosityLevel.
RunOptions(std::nullptr_t)
Create an empty RunOptions object, must be assigned a valid one to be used.
Definition onnxruntime_cxx_api.h:932
RunOptions & SetRunLogVerbosityLevel(int)
Wraps OrtApi::RunOptionsSetRunLogVerbosityLevel.
RunOptions & SetRunLogSeverityLevel(int)
Wraps OrtApi::RunOptionsSetRunLogSeverityLevel.
RunOptions & AddConfigEntry(const char *config_key, const char *config_value)
Wraps OrtApi::AddRunConfigEntry.
const char * GetRunTag() const
Wraps OrtApi::RunOptionsGetRunTag.
RunOptions()
Wraps OrtApi::CreateRunOptions.
Wrapper around OrtSequenceTypeInfo.
Definition onnxruntime_cxx_api.h:1521
SequenceTypeInfo(std::nullptr_t)
Create an empty SequenceTypeInfo object, must be assigned a valid one to be used.
Definition onnxruntime_cxx_api.h:1525
ConstSequenceTypeInfo GetConst() const
Definition onnxruntime_cxx_api.h:1527
SequenceTypeInfo(OrtSequenceTypeInfo *p)
Used for interop with the C API.
Definition onnxruntime_cxx_api.h:1526
Wrapper around OrtSession.
Definition onnxruntime_cxx_api.h:1392
Session(std::nullptr_t)
Create an empty Session object, must be assigned a valid one to be used. Wraps OrtApi::CreateSession.
Definition onnxruntime_cxx_api.h:1394
static Session CreateModelEditorSession(const Env &env, const void *model_data, size_t model_data_length, const SessionOptions &options)
Wraps OrtModelEditorApi::CreateModelEditorSession.
UnownedSession GetUnowned() const
Definition onnxruntime_cxx_api.h:1423
Session(const Env &env, const char *model_path, const SessionOptions &options, OrtPrepackedWeightsContainer *prepacked_weights_container)
Wraps OrtApi::CreateSessionWithPrepackedWeightsContainer.
Session(const Env &env, const void *model_data, size_t model_data_length, const SessionOptions &options, OrtPrepackedWeightsContainer *prepacked_weights_container)
Wraps OrtApi::CreateSessionFromArrayWithPrepackedWeightsContainer.
Session(const Env &env, const Model &model, const SessionOptions &options)
Wraps OrtModelEditorApi::CreateSessionFromModel.
Session(OrtSession *p)
C API Interop.
Definition onnxruntime_cxx_api.h:1395
static Session CreateModelEditorSession(const Env &env, const char *model_path, const SessionOptions &options)
Wraps OrtModelEditorApi::CreateModelEditorSession.
Session(const Env &env, const char *model_path, const SessionOptions &options)
ConstSession GetConst() const
Definition onnxruntime_cxx_api.h:1422
Session(const Env &env, const void *model_data, size_t model_data_length, const SessionOptions &options)
Wraps OrtApi::CreateSessionFromArray.
Wrapper around OrtSessionOptions.
Definition onnxruntime_cxx_api.h:1133
SessionOptions(std::nullptr_t)
Create an empty SessionOptions object, must be assigned a valid one to be used.
Definition onnxruntime_cxx_api.h:1134
UnownedSessionOptions GetUnowned() const
Definition onnxruntime_cxx_api.h:1137
SessionOptions()
Wraps OrtApi::CreateSessionOptions.
ConstSessionOptions GetConst() const
Definition onnxruntime_cxx_api.h:1138
SessionOptions(OrtSessionOptions *p)
Used for interop with the C API.
Definition onnxruntime_cxx_api.h:1136
Definition onnxruntime_cxx_api.h:2529
SymbolicInteger & operator=(const SymbolicInteger &)=default
SymbolicInteger(const SymbolicInteger &)=default
int64_t AsInt() const
Definition onnxruntime_cxx_api.h:2550
int64_t i_
Definition onnxruntime_cxx_api.h:2557
const char * s_
Definition onnxruntime_cxx_api.h:2558
bool operator==(const SymbolicInteger &dim) const
Definition onnxruntime_cxx_api.h:2538
SymbolicInteger & operator=(SymbolicInteger &&)=default
SymbolicInteger(SymbolicInteger &&)=default
const char * AsSym() const
Definition onnxruntime_cxx_api.h:2551
SymbolicInteger(int64_t i)
Definition onnxruntime_cxx_api.h:2530
SymbolicInteger(const char *s)
Definition onnxruntime_cxx_api.h:2531
bool IsInt() const
Definition onnxruntime_cxx_api.h:2549
Provide access to per-node attributes and input shapes, so one could compute and set output shapes.
Definition onnxruntime_cxx_api.h:2528
Ints GetAttrInts(const char *attr_name)
Strings GetAttrStrings(const char *attr_name)
Status SetOutputShape(size_t indice, const Shape &shape, ONNXTensorElementDataType type=ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT)
std::vector< SymbolicInteger > Shape
Definition onnxruntime_cxx_api.h:2563
std::vector< float > Floats
Definition onnxruntime_cxx_api.h:2580
std::string GetAttrString(const char *attr_name)
std::vector< int64_t > Ints
Definition onnxruntime_cxx_api.h:2575
ShapeInferContext(const OrtApi *ort_api, OrtShapeInferContext *ctx)
int64_t GetAttrInt(const char *attr_name)
size_t GetInputCount() const
Definition onnxruntime_cxx_api.h:2569
std::vector< std::string > Strings
Definition onnxruntime_cxx_api.h:2585
Floats GetAttrFloats(const char *attr_name)
const Shape & GetInputShape(size_t indice) const
Definition onnxruntime_cxx_api.h:2567
float GetAttrFloat(const char *attr_name)
The Status that holds ownership of OrtStatus received from C API Use it to safely destroy OrtStatus* ...
Definition onnxruntime_cxx_api.h:713
OrtErrorCode GetErrorCode() const
Status(const char *message, OrtErrorCode code) noexcept
Creates status instance out of null-terminated string message.
bool IsOK() const noexcept
Returns true if instance represents an OK (non-error) status.
Status(OrtStatus *status) noexcept
Takes ownership of OrtStatus instance returned from the C API.
std::string GetErrorMessage() const
Status(const Exception &) noexcept
Creates status instance out of exception.
Status(const std::exception &) noexcept
Creates status instance out of exception.
detail::Base< OrtStatus > Base
Definition onnxruntime_cxx_api.h:714
Status(std::nullptr_t) noexcept
Create an empty object, must be assigned a valid one to be used.
Definition onnxruntime_cxx_api.h:717
Wrapper around OrtTensorTypeAndShapeInfo.
Definition onnxruntime_cxx_api.h:1487
TensorTypeAndShapeInfo(std::nullptr_t)
Create an empty TensorTypeAndShapeInfo object, must be assigned a valid one to be used.
Definition onnxruntime_cxx_api.h:1492
ConstTensorTypeAndShapeInfo GetConst() const
Definition onnxruntime_cxx_api.h:1503
TensorTypeAndShapeInfo(OrtTensorTypeAndShapeInfo *p)
Used for interop with the C API.
Definition onnxruntime_cxx_api.h:1494
TensorTypeAndShapeInfo(ONNXTensorElementDataType element_type, const std::vector< int64_t > &dims, const std::vector< std::string > *symbolic_dims=nullptr)
The ThreadingOptions.
Definition onnxruntime_cxx_api.h:731
ThreadingOptions & SetGlobalCustomThreadCreationOptions(void *ort_custom_thread_creation_options)
Wraps OrtApi::SetGlobalCustomThreadCreationOptions.
ThreadingOptions()
Wraps OrtApi::CreateThreadingOptions.
ThreadingOptions & SetGlobalInterOpNumThreads(int inter_op_num_threads)
Wraps OrtApi::SetGlobalInterOpNumThreads.
ThreadingOptions & SetGlobalCustomCreateThreadFn(OrtCustomCreateThreadFn ort_custom_create_thread_fn)
Wraps OrtApi::SetGlobalCustomCreateThreadFn.
ThreadingOptions & SetGlobalCustomJoinThreadFn(OrtCustomJoinThreadFn ort_custom_join_thread_fn)
Wraps OrtApi::SetGlobalCustomJoinThreadFn.
ThreadingOptions & SetGlobalSpinControl(int allow_spinning)
Wraps OrtApi::SetGlobalSpinControl.
ThreadingOptions & SetGlobalDenormalAsZero()
Wraps OrtApi::SetGlobalDenormalAsZero.
ThreadingOptions & SetGlobalIntraOpNumThreads(int intra_op_num_threads)
Wraps OrtApi::SetGlobalIntraOpNumThreads.
Type information that may contain either TensorTypeAndShapeInfo or the information about contained se...
Definition onnxruntime_cxx_api.h:1593
static TypeInfo CreateOptionalTypeInfo(ConstTypeInfo contained_type)
static TypeInfo CreateSequenceTypeInfo(ConstTypeInfo sequence_type)
static TypeInfo CreateTensorInfo(ConstTensorTypeAndShapeInfo tensor_info)
static TypeInfo CreateSparseTensorInfo(ConstTensorTypeAndShapeInfo sparse_tensor_info)
TypeInfo(std::nullptr_t)
Create an empty TypeInfo object, must be assigned a valid one to be used.
Definition onnxruntime_cxx_api.h:1598
static TypeInfo CreateMapTypeInfo(ONNXTensorElementDataType key_type, ConstTypeInfo value_type)
ConstTypeInfo GetConst() const
Definition onnxruntime_cxx_api.h:1609
TypeInfo(OrtTypeInfo *p)
C API Interop.
Definition onnxruntime_cxx_api.h:1599
Wrapper around OrtValue.
Definition onnxruntime_cxx_api.h:1941
static Value CreateSparseTensor(const OrtMemoryInfo *info, void *p_data, const Shape &dense_shape, const Shape &values_shape, ONNXTensorElementDataType type)
Creates an OrtValue instance containing SparseTensor. This constructs a sparse tensor that makes use ...
static Value CreateSparseTensor(const OrtMemoryInfo *info, T *p_data, const Shape &dense_shape, const Shape &values_shape)
This is a simple forwarding method to the other overload that helps deducing data type enum value fro...
Value & operator=(Value &&)=default
static Value CreateSparseTensor(OrtAllocator *allocator, const Shape &dense_shape, ONNXTensorElementDataType type)
Creates an instance of OrtValue containing sparse tensor. The created instance has no data....
Value(std::nullptr_t)
Create an empty Value object, must be assigned a valid one to be used.
Definition onnxruntime_cxx_api.h:1947
static Value CreateTensor(const OrtMemoryInfo *info, T *p_data, size_t p_data_element_count, const int64_t *shape, size_t shape_len)
Creates a tensor with a user supplied buffer. Wraps OrtApi::CreateTensorWithDataAsOrtValue.
static Value CreateSparseTensor(OrtAllocator *allocator, const Shape &dense_shape)
This is a simple forwarding method to the below CreateSparseTensor. This helps to specify data type e...
static Value CreateTensor(OrtAllocator *allocator, const int64_t *shape, size_t shape_len, ONNXTensorElementDataType type)
Creates an OrtValue with a tensor using the supplied OrtAllocator. Wraps OrtApi::CreateTensorAsOrtVal...
UnownedValue GetUnowned() const
Definition onnxruntime_cxx_api.h:1952
static Value CreateSequence(const std::vector< Value > &values)
Creates an OrtValue with a Sequence Onnx type representation. The API would ref-count the supplied Or...
static Value CreateMap(const Value &keys, const Value &values)
Creates an OrtValue with a Map Onnx type representation. The API would ref-count the supplied OrtValu...
static Value CreateTensor(const OrtMemoryInfo *info, void *p_data, size_t p_data_byte_count, const int64_t *shape, size_t shape_len, ONNXTensorElementDataType type)
Creates a tensor with a user supplied buffer. Wraps OrtApi::CreateTensorWithDataAsOrtValue.
static Value CreateTensor(OrtAllocator *allocator, const int64_t *shape, size_t shape_len)
Creates an OrtValue with a tensor using a supplied OrtAllocator. Wraps OrtApi::CreateTensorAsOrtValue...
static Value CreateOpaque(const char *domain, const char *type_name, const T &value)
Creates an OrtValue wrapping an Opaque type. This is used for experimental support of non-tensor type...
static Value CreateTensor(OrtAllocator *deleter, void *p_data, size_t p_data_byte_count, const int64_t *shape, size_t shape_len, ONNXTensorElementDataType type)
Creates a tensor with a user supplied buffer. Wraps OrtApi::CreateTensorWithDataAndDeleterAsOrtValue.
ConstValue GetConst() const
Definition onnxruntime_cxx_api.h:1951
Wrapper around OrtValueInfo.
Definition onnxruntime_cxx_api.h:2757
ConstValueInfo GetConst() const
Definition onnxruntime_cxx_api.h:2765
ValueInfo(std::nullptr_t)
Definition onnxruntime_cxx_api.h:2758
ValueInfo(const std::string &name, const ConstTypeInfo &type_info)
ValueInfo(OrtValueInfo *p)
Take ownership of a pointer created by C API.
Definition onnxruntime_cxx_api.h:2760
Definition onnxruntime_cxx_api.h:681
AllocatedFree(OrtAllocator *allocator)
Definition onnxruntime_cxx_api.h:683
OrtAllocator * allocator_
Definition onnxruntime_cxx_api.h:682
void operator()(void *ptr) const
Definition onnxruntime_cxx_api.h:685
Base & operator=(Base &&v) noexcept
Definition onnxruntime_cxx_api.h:668
typename Unowned< T >::Type contained_type
Definition onnxruntime_cxx_api.h:657
Base(Base &&v) noexcept
Definition onnxruntime_cxx_api.h:667
Base(const Base &)=default
constexpr Base(contained_type *p) noexcept
Definition onnxruntime_cxx_api.h:660
Base & operator=(const Base &)=default
Used internally by the C++ API. C++ wrapper types inherit from this. This is a zero cost abstraction ...
Definition onnxruntime_cxx_api.h:611
Base(Base &&v) noexcept
Definition onnxruntime_cxx_api.h:623
contained_type * release()
Relinquishes ownership of the contained C object pointer The underlying object is not destroyed.
Definition onnxruntime_cxx_api.h:634
Base(const Base &)=delete
constexpr Base(contained_type *p) noexcept
Definition onnxruntime_cxx_api.h:615
Base & operator=(const Base &)=delete
Base & operator=(Base &&v) noexcept
Definition onnxruntime_cxx_api.h:624
contained_type * p_
Definition onnxruntime_cxx_api.h:641
~Base()
Definition onnxruntime_cxx_api.h:616
T contained_type
Definition onnxruntime_cxx_api.h:612
Definition onnxruntime_cxx_api.h:2175
std::vector< Value > GetOutputValues(OrtAllocator *) const
std::vector< std::string > GetOutputNames(OrtAllocator *) const
std::vector< Value > GetOutputValues() const
std::vector< std::string > GetOutputNames() const
Definition onnxruntime_cxx_api.h:1251
std::vector< std::string > GetOutputNames() const
TypeInfo GetInputTypeInfo(size_t index) const
Wraps OrtApi::SessionGetInputTypeInfo.
size_t GetOutputCount() const
Returns the number of model outputs.
std::vector< ValueInfo > GetOutputs() const
int GetOpset(const std::string &domain) const
Wraps OrtApi::SessionGetOpsetForDomain.
uint64_t GetProfilingStartTimeNs() const
Wraps OrtApi::SessionGetProfilingStartTimeNs.
std::vector< std::string > GetOverridableInitializerNames() const
ModelMetadata GetModelMetadata() const
Wraps OrtApi::SessionGetModelMetadata.
size_t GetInputCount() const
Returns the number of model inputs.
TypeInfo GetOutputTypeInfo(size_t index) const
Wraps OrtApi::SessionGetOutputTypeInfo.
std::vector< std::string > GetInputNames() const
AllocatedStringPtr GetOverridableInitializerNameAllocated(size_t index, OrtAllocator *allocator) const
Returns a copy of the overridable initializer name at then specified index.
AllocatedStringPtr GetOutputNameAllocated(size_t index, OrtAllocator *allocator) const
Returns a copy of output name at then specified index.
size_t GetOverridableInitializerCount() const
Returns the number of inputs that have defaults that can be overridden.
AllocatedStringPtr GetInputNameAllocated(size_t index, OrtAllocator *allocator) const
Returns a copy of input name at the specified index.
std::vector< ValueInfo > GetInputs() const
TypeInfo GetOverridableInitializerTypeInfo(size_t index) const
Wraps OrtApi::SessionGetOverridableInitializerTypeInfo.
Definition onnxruntime_cxx_api.h:1638
void GetStringTensorContent(void *buffer, size_t buffer_length, size_t *offsets, size_t offsets_count) const
The API copies all of the UTF-8 encoded string data contained within a tensor or a sparse tensor into...
void GetStringTensorElement(size_t buffer_length, size_t element_index, void *buffer) const
The API copies UTF-8 encoded bytes for the requested string element contained within a tensor or a sp...
TensorTypeAndShapeInfo GetSparseTensorIndicesTypeShapeInfo(OrtSparseIndicesFormat format) const
The API returns type and shape information for the specified indices. Each supported indices have the...
const void * GetTensorRawData() const
Returns a non-typed pointer to a tensor contained data.
std::string GetStringTensorElement(size_t element_index) const
Returns string tensor UTF-8 encoded string element. Use of this API is recommended over GetStringTens...
size_t GetStringTensorElementLength(size_t element_index) const
The API returns a byte length of UTF-8 encoded string element contained in either a tensor or a spare...
size_t GetStringTensorDataLength() const
This API returns a full length of string data contained within either a tensor or a sparse Tensor....
bool IsSparseTensor() const
Returns true if the OrtValue contains a sparse tensor.
TypeInfo GetTypeInfo() const
The API returns type information for data contained in a tensor. For sparse tensors it returns type i...
const R * GetSparseTensorIndicesData(OrtSparseIndicesFormat indices_format, size_t &num_indices) const
The API retrieves a pointer to the internal indices buffer. The API merely performs a convenience dat...
bool IsTensor() const
Returns true if Value is a tensor, false for other types like map/sequence/etc.
ConstMemoryInfo GetTensorMemoryInfo() const
This API returns information about the memory allocation used to hold data.
const R * GetSparseTensorValues() const
The API returns a pointer to an internal buffer of the sparse tensor containing non-zero values....
TensorTypeAndShapeInfo GetTensorTypeAndShapeInfo() const
The API returns type information for data contained in a tensor. For sparse tensors it returns type i...
Value GetValue(int index, OrtAllocator *allocator) const
size_t GetCount() const
< Return true if OrtValue contains data and returns false if the OrtValue is a None
void GetOpaqueData(const char *domain, const char *type_name, R &) const
Obtains a pointer to a user defined data for experimental purposes.
TensorTypeAndShapeInfo GetSparseTensorValuesTypeAndShapeInfo() const
The API returns type and shape information for stored non-zero values of the sparse tensor....
const R * GetTensorData() const
Returns a const typed pointer to the tensor contained data. No type checking is performed,...
OrtSparseFormat GetSparseFormat() const
The API returns the sparse data format this OrtValue holds in a sparse tensor. If the sparse tensor w...
Definition onnxruntime_cxx_api.h:817
const char * EpName() const
const char * EpVendor() const
ConstKeyValuePairs EpOptions() const
ConstHardwareDevice Device() const
ConstKeyValuePairs EpMetadata() const
Definition onnxruntime_cxx_api.h:798
uint32_t DeviceId() const
OrtHardwareDeviceType Type() const
const char * Vendor() const
ConstKeyValuePairs Metadata() const
uint32_t VendorId() const
Definition onnxruntime_cxx_api.h:2186
void BindOutput(const char *name, const Value &)
void BindInput(const char *name, const Value &)
void SynchronizeOutputs()
void BindOutput(const char *name, const OrtMemoryInfo *)
Definition onnxruntime_cxx_api.h:759
void GetKeyValuePairs(std::vector< const char * > &keys, std::vector< const char * > &values) const
std::unordered_map< std::string, std::string > GetKeyValuePairs() const
const char * GetValue(const char *key) const
Definition onnxruntime_cxx_api.h:1545
ONNXTensorElementDataType GetMapKeyType() const
Wraps OrtApi::GetMapKeyType.
TypeInfo GetMapValueType() const
Wraps OrtApi::GetMapValueType.
Definition onnxruntime_cxx_api.h:1428
std::string GetAllocatorName() const
OrtMemType GetMemoryType() const
OrtMemoryInfoDeviceType GetDeviceType() const
OrtAllocatorType GetAllocatorType() const
bool operator==(const MemoryInfoImpl< U > &o) const
Definition onnxruntime_cxx_api.h:2836
void AddGraph(Graph &graph)
Definition onnxruntime_cxx_api.h:2770
Definition onnxruntime_cxx_api.h:1532
TypeInfo GetOptionalElementType() const
Wraps OrtApi::CastOptionalTypeToContainedTypeInfo.
Definition onnxruntime_cxx_api.h:1621
const char ** str
Definition onnxruntime_cxx_api.h:1626
const int64_t * values_shape
Definition onnxruntime_cxx_api.h:1622
size_t values_shape_len
Definition onnxruntime_cxx_api.h:1623
const void * p_data
Definition onnxruntime_cxx_api.h:1625
Definition onnxruntime_cxx_api.h:1508
TypeInfo GetSequenceElementType() const
Wraps OrtApi::GetSequenceElementType.
Definition onnxruntime_cxx_api.h:1305
void SetEpDynamicOptions(const char *const *keys, const char *const *values, size_t kv_len)
Set DynamicOptions for EPs (Execution Providers)
AllocatedStringPtr EndProfilingAllocated(OrtAllocator *allocator)
End profiling and return a copy of the profiling file name.
void FinalizeModelEditorSession(const Model &model, const SessionOptions &options, OrtPrepackedWeightsContainer *prepacked_weights_container=nullptr)
void Run(const RunOptions &run_options, const IoBinding &)
Wraps OrtApi::RunWithBinding.
void RunAsync(const RunOptions &run_options, const char *const *input_names, const Value *input_values, size_t input_count, const char *const *output_names, Value *output_values, size_t output_count, RunAsyncCallbackFn callback, void *user_data)
Run the model asynchronously in a thread owned by intra op thread pool.
std::vector< Value > Run(const RunOptions &run_options, const char *const *input_names, const Value *input_values, size_t input_count, const char *const *output_names, size_t output_count)
Run the model returning results in an Ort allocated vector.
void Run(const RunOptions &run_options, const char *const *input_names, const Value *input_values, size_t input_count, const char *const *output_names, Value *output_values, size_t output_count)
Run the model returning results in user provided outputs Same as Run(const RunOptions&,...
Definition onnxruntime_cxx_api.h:1632
const int64_t * shape
Definition onnxruntime_cxx_api.h:1633
size_t shape_len
Definition onnxruntime_cxx_api.h:1634
Definition onnxruntime_cxx_api.h:1459
size_t GetElementCount() const
Wraps OrtApi::GetTensorShapeElementCount.
void GetDimensions(int64_t *values, size_t values_count) const
Wraps OrtApi::GetDimensions.
std::vector< int64_t > GetShape() const
Uses GetDimensionsCount & GetDimensions to return a std::vector of the shape.
std::vector< const char * > GetSymbolicDimensions() const
void GetSymbolicDimensions(const char **values, size_t values_count) const
Wraps OrtApi::GetSymbolicDimensions.
size_t GetDimensionsCount() const
Wraps OrtApi::GetDimensionsCount.
ONNXTensorElementDataType GetElementType() const
Wraps OrtApi::GetTensorElementType.
Definition onnxruntime_cxx_api.h:1570
ONNXType GetONNXType() const
ConstSequenceTypeInfo GetSequenceTypeInfo() const
Wraps OrtApi::CastTypeInfoToSequenceTypeInfo.
ConstMapTypeInfo GetMapTypeInfo() const
Wraps OrtApi::CastTypeInfoToMapTypeInfo.
ConstOptionalTypeInfo GetOptionalTypeInfo() const
wraps OrtApi::CastTypeInfoToOptionalTypeInfo
ConstTensorTypeAndShapeInfo GetTensorTypeAndShapeInfo() const
Wraps OrtApi::CastTypeInfoToTensorInfo.
This is a tagging template type. Use it with Base<T> to indicate that the C++ interface object has no...
Definition onnxruntime_cxx_api.h:587
T Type
Definition onnxruntime_cxx_api.h:588
Definition onnxruntime_cxx_api.h:1799
void FillStringTensorElement(const char *s, size_t index)
Set a single string in a string tensor.
R * GetTensorMutableData()
Returns a non-const typed pointer to an OrtValue/Tensor contained buffer No type checking is performe...
R & At(const std::vector< int64_t > &location)
void UseBlockSparseIndices(const Shape &indices_shape, int32_t *indices_data)
Supplies BlockSparse format specific indices and marks the contained sparse tensor as being a BlockSp...
void FillSparseTensorBlockSparse(const OrtMemoryInfo *data_mem_info, const OrtSparseValuesParam &values, const Shape &indices_shape, const int32_t *indices_data)
The API will allocate memory using the allocator instance supplied to the CreateSparseTensor() API an...
void * GetTensorMutableRawData()
Returns a non-typed non-const pointer to a tensor contained data.
void UseCooIndices(int64_t *indices_data, size_t indices_num)
Supplies COO format specific indices and marks the contained sparse tensor as being a COO format tens...
void FillSparseTensorCoo(const OrtMemoryInfo *data_mem_info, const OrtSparseValuesParam &values_param, const int64_t *indices_data, size_t indices_num)
The API will allocate memory using the allocator instance supplied to the CreateSparseTensor() API an...
void FillStringTensor(const char *const *s, size_t s_len)
Set all strings at once in a string tensor.
void UseCsrIndices(int64_t *inner_data, size_t inner_num, int64_t *outer_data, size_t outer_num)
Supplies CSR format specific indices and marks the contained sparse tensor as being a CSR format tens...
void FillSparseTensorCsr(const OrtMemoryInfo *data_mem_info, const OrtSparseValuesParam &values, const int64_t *inner_indices_data, size_t inner_indices_num, const int64_t *outer_indices_data, size_t outer_indices_num)
The API will allocate memory using the allocator instance supplied to the CreateSparseTensor() API an...
char * GetResizedStringTensorElementBuffer(size_t index, size_t buffer_length)
Allocate if necessary and obtain a pointer to a UTF-8 encoded string element buffer indexed by the fl...
Definition onnxruntime_cxx_api.h:2742
ConstTypeInfo TypeInfo() const
Memory allocation interface.
Definition onnxruntime_c_api.h:332
void(* Free)(struct OrtAllocator *this_, void *p)
Free a block of memory previously allocated with OrtAllocator::Alloc.
Definition onnxruntime_c_api.h:335
const OrtApi *(* GetApi)(uint32_t version)
Get a pointer to the requested version of the OrtApi.
Definition onnxruntime_c_api.h:748
The C API.
Definition onnxruntime_c_api.h:808
const OrtCompileApi *(* GetCompileApi)()
Get the Compile API instance.
Definition onnxruntime_c_api.h:4987
const OrtModelEditorApi *(* GetModelEditorApi)()
Get the Model Editor API instance.
Definition onnxruntime_c_api.h:4929
const OrtEpApi *(* GetEpApi)()
Get the OrtEpApi instance for implementing an execution provider.
Definition onnxruntime_c_api.h:5253
CUDA Provider Options.
Definition onnxruntime_c_api.h:468
The OrtCompileApi struct provides functions to compile ONNX models.
Definition onnxruntime_c_api.h:5793
Definition onnxruntime_c_api.h:5281
int(* GetVariadicInputHomogeneity)(const struct OrtCustomOp *op)
Definition onnxruntime_c_api.h:5327
OrtCustomOpInputOutputCharacteristic(* GetOutputCharacteristic)(const struct OrtCustomOp *op, size_t index)
Definition onnxruntime_c_api.h:5311
size_t(* GetInputTypeCount)(const struct OrtCustomOp *op)
Definition onnxruntime_c_api.h:5299
int(* GetVariadicOutputMinArity)(const struct OrtCustomOp *op)
Definition onnxruntime_c_api.h:5331
size_t(* GetAliasMap)(int **input_index, int **output_index)
Definition onnxruntime_c_api.h:5364
int(* GetStartVersion)(const struct OrtCustomOp *op)
Definition onnxruntime_c_api.h:5349
void(* ReleaseMayInplace)(int *input_index, int *output_index)
Definition onnxruntime_c_api.h:5361
const char *(* GetName)(const struct OrtCustomOp *op)
Definition onnxruntime_c_api.h:5292
size_t(* GetOutputTypeCount)(const struct OrtCustomOp *op)
Definition onnxruntime_c_api.h:5301
void(* KernelDestroy)(void *op_kernel)
Definition onnxruntime_c_api.h:5307
int(* GetVariadicOutputHomogeneity)(const struct OrtCustomOp *op)
Definition onnxruntime_c_api.h:5336
OrtMemType(* GetInputMemoryType)(const struct OrtCustomOp *op, size_t index)
Definition onnxruntime_c_api.h:5318
void *(* CreateKernel)(const struct OrtCustomOp *op, const OrtApi *api, const OrtKernelInfo *info)
Definition onnxruntime_c_api.h:5288
uint32_t version
Definition onnxruntime_c_api.h:5282
ONNXTensorElementDataType(* GetInputType)(const struct OrtCustomOp *op, size_t index)
Definition onnxruntime_c_api.h:5298
void(* ReleaseAliasMap)(int *input_index, int *output_index)
Definition onnxruntime_c_api.h:5365
OrtCustomOpInputOutputCharacteristic(* GetInputCharacteristic)(const struct OrtCustomOp *op, size_t index)
Definition onnxruntime_c_api.h:5310
const char *(* GetExecutionProviderType)(const struct OrtCustomOp *op)
Definition onnxruntime_c_api.h:5295
ONNXTensorElementDataType(* GetOutputType)(const struct OrtCustomOp *op, size_t index)
Definition onnxruntime_c_api.h:5300
int(* GetVariadicInputMinArity)(const struct OrtCustomOp *op)
Definition onnxruntime_c_api.h:5322
OrtStatusPtr(* InferOutputShapeFn)(const struct OrtCustomOp *op, OrtShapeInferContext *)
Definition onnxruntime_c_api.h:5346
int(* GetEndVersion)(const struct OrtCustomOp *op)
Definition onnxruntime_c_api.h:5350
OrtStatusPtr(* CreateKernelV2)(const struct OrtCustomOp *op, const OrtApi *api, const OrtKernelInfo *info, void **kernel)
Definition onnxruntime_c_api.h:5339
size_t(* GetMayInplace)(int **input_index, int **output_index)
Definition onnxruntime_c_api.h:5357
OrtStatusPtr(* KernelComputeV2)(void *op_kernel, OrtKernelContext *context)
Definition onnxruntime_c_api.h:5344
void(* KernelCompute)(void *op_kernel, OrtKernelContext *context)
Definition onnxruntime_c_api.h:5306
Definition onnxruntime_c_api.h:5957
The OrtEpFactory provides functions to create and manage execution providers.
Definition onnxruntime_c_api.h:6053
MIGraphX Provider Options.
Definition onnxruntime_c_api.h:672
The OrtModelEditorApi struct provides functions to create or edit an ONNX model.
Definition onnxruntime_c_api.h:5379
OpenVINO Provider Options.
Definition onnxruntime_c_api.h:694
ROCM Provider Options.
Definition onnxruntime_c_api.h:555
TensorRT Provider Options.
Definition onnxruntime_c_api.h:644