26#include "onnxruntime_c_api.h"
27#include "onnxruntime_float16.h"
36#include <unordered_map>
41#ifdef ORT_NO_EXCEPTIONS
59 const char*
what() const noexcept
override {
return message_.c_str(); }
66#ifdef ORT_NO_EXCEPTIONS
69#ifndef ORT_CXX_API_THROW
70#define ORT_CXX_API_THROW(string, code) \
72 std::cerr << Ort::Exception(string, code) \
79#define ORT_CXX_API_THROW(string, code) \
80 throw Ort::Exception(string, code)
83#ifdef ORT_API_MANUAL_INIT
91inline void InitApi() noexcept;
108inline
void InitApi(const
OrtApi* api) noexcept;
115 static const OrtApi* Api(
const OrtApi* newValue =
nullptr)
noexcept {
132 static const OrtApi* api = DefaultInit();
143 static const OrtApi* DefaultInit()
noexcept;
145#ifdef ORT_API_MANUAL_INIT
147 friend void ::Ort::InitApi()
noexcept;
148 friend void ::Ort::InitApi(
const OrtApi*)
noexcept;
153#ifdef ORT_API_MANUAL_INIT
156inline void InitApi(
const OrtApi* api)
noexcept { detail::Global::Api(api); }
164#pragma detect_mismatch("ORT_API_MANUAL_INIT", "enabled")
167inline const OrtApi* detail::Global::DefaultInit() noexcept {
180#pragma detect_mismatch("ORT_API_MANUAL_INIT", "disabled")
183inline const OrtApi* detail::Global::DefaultInit() noexcept {
189inline const OrtApi&
GetApi() noexcept {
return *detail::Global::Api(); }
217 if (api ==
nullptr) {
219 ORT_CXX_API_THROW(
"Model Editor API is not available in this build",
ORT_FAIL);
231 if (api ==
nullptr) {
233 ORT_CXX_API_THROW(
"Compile API is not available in this build",
ORT_FAIL);
245 if (api ==
nullptr) {
247 ORT_CXX_API_THROW(
"Interop API is not available in this build",
ORT_FAIL);
259 if (api ==
nullptr) {
260 ORT_CXX_API_THROW(
"Model Package API is not available in this build",
ORT_FAIL);
272 if (api ==
nullptr) {
274 ORT_CXX_API_THROW(
"EP API is not available in this build",
ORT_FAIL);
298struct Float16_t : onnxruntime_float16::Float16Impl<Float16_t> {
305 constexpr explicit Float16_t(uint16_t v)
noexcept { val = v; }
308 using Base = onnxruntime_float16::Float16Impl<Float16_t>;
326 explicit Float16_t(
float v)
noexcept { val = Base::ToUint16Impl(v); }
332 float ToFloat() const noexcept {
return Base::ToFloatImpl(); }
338 using Base::IsNegative;
350 using Base::IsFinite;
356 using Base::IsPositiveInfinity;
362 using Base::IsNegativeInfinity;
368 using Base::IsInfinity;
374 using Base::IsNaNOrZero;
380 using Base::IsNormal;
386 using Base::IsSubnormal;
413 explicit operator float() const noexcept {
return ToFloat(); }
415 using Base::operator==;
416 using Base::operator!=;
417 using Base::operator<;
420static_assert(
sizeof(Float16_t) ==
sizeof(uint16_t),
"Sizes must match");
440struct BFloat16_t : onnxruntime_float16::BFloat16Impl<BFloat16_t> {
449 constexpr explicit BFloat16_t(uint16_t v)
noexcept { val = v; }
452 using Base = onnxruntime_float16::BFloat16Impl<BFloat16_t>;
467 explicit BFloat16_t(
float v)
noexcept { val = Base::ToUint16Impl(v); }
473 float ToFloat() const noexcept {
return Base::ToFloatImpl(); }
479 using Base::IsNegative;
491 using Base::IsFinite;
497 using Base::IsPositiveInfinity;
503 using Base::IsNegativeInfinity;
509 using Base::IsInfinity;
515 using Base::IsNaNOrZero;
521 using Base::IsNormal;
527 using Base::IsSubnormal;
554 explicit operator float() const noexcept {
return ToFloat(); }
563static_assert(
sizeof(
BFloat16_t) ==
sizeof(uint16_t),
"Sizes must match");
574 constexpr operator uint8_t() const noexcept {
return value; }
580static_assert(
sizeof(Float8E4M3FN_t) ==
sizeof(uint8_t),
"Sizes must match");
591 constexpr operator uint8_t() const noexcept {
return value; }
597static_assert(
sizeof(Float8E4M3FNUZ_t) ==
sizeof(uint8_t),
"Sizes must match");
608 constexpr operator uint8_t() const noexcept {
return value; }
614static_assert(
sizeof(Float8E5M2_t) ==
sizeof(uint8_t),
"Sizes must match");
625 constexpr operator uint8_t() const noexcept {
return value; }
631static_assert(
sizeof(Float8E5M2FNUZ_t) ==
sizeof(uint8_t),
"Sizes must match");
636#define ORT_DEFINE_RELEASE(NAME) \
637 inline void OrtRelease(Ort##NAME* ptr) { GetApi().Release##NAME(ptr); }
639#define ORT_DEFINE_RELEASE_FROM_API_STRUCT(NAME, API_GETTER) \
640 inline void OrtRelease(Ort##NAME* ptr) { API_GETTER().Release##NAME(ptr); }
658ORT_DEFINE_RELEASE(
Op);
690#undef ORT_DEFINE_RELEASE
691#undef ORT_DEFINE_RELEASE_FROM_API_STRUCT
804struct AllocatorWithDefaultOptions;
806struct EpContextConfig;
808struct ExternalInitializerInfo;
811struct ModelPackageOptions;
812struct ModelPackageContext;
813struct ModelPackageComponentContext;
817struct PrepackedWeightsContainer;
819struct SessionOptions;
821struct TensorRTProviderOptions;
837 explicit Status(std::nullptr_t)
noexcept {}
886 void Update(
const std::unordered_map<std::string, std::string>& options);
905 void Update(
const std::unordered_map<std::string, std::string>& options);
965 static Status Create(
const ORTCHAR_T* filepath, int64_t file_offset,
size_t byte_size,
980 void GetKeyValuePairs(std::vector<const char*>& keys, std::vector<const char*>& values)
const;
997 explicit KeyValuePairs(
const std::unordered_map<std::string, std::string>& kv_pairs);
1000 void Add(
const char* key,
const char* value);
1009template <
typename T>
1022 template <
typename U>
1057 void* get() {
return p_; }
1058 size_t size()
const {
return size_; }
1067template <
typename T>
1068struct AllocatorImpl : Base<T> {
1072 void* Alloc(
size_t size);
1073 void* Reserve(
size_t size);
1074 MemoryAllocation GetAllocation(
size_t size);
1076 ConstMemoryInfo GetInfo()
const;
1082 KeyValuePairs GetStats()
const;
1119template <
typename T>
1138template <
typename T>
1157template <
typename T>
1178template <
typename T>
1222 const std::vector<ConstEpDevice>& ep_devices,
1223 const char* compatibility_info);
1259template <
typename T>
1276template <
typename T>
1292template <
typename T>
1341 const char* event_name,
1342 int64_t timestamp_us,
1343 int64_t duration_us,
1344 const std::unordered_map<std::string, std::string>& args = {});
1350 const char* event_name,
1351 int64_t timestamp_us,
1352 int64_t duration_us,
1353 const char*
const* arg_keys,
1354 const char*
const* arg_values,
1361template <
typename T>
1386 explicit Env(std::nullptr_t) {}
1415 const std::unordered_map<std::string, std::string>& options,
1467 const std::vector<Value>& dst_tensors,
1632 std::unordered_map<std::string, std::string> flat_configs_;
1643template <
typename T>
1644struct ConstSessionOptionsImpl : Base<T> {
1650 std::string GetConfigEntry(
const char* config_key)
const;
1651 bool HasConfigEntry(
const char* config_key)
const;
1652 std::string GetConfigEntryOrDefault(
const char* config_key,
const std::string& def)
const;
1654 bool GetMemPatternEnabled()
const;
1658template <
typename T>
1659struct SessionOptionsImpl : ConstSessionOptionsImpl<T> {
1660 using B = ConstSessionOptionsImpl<T>;
1663 SessionOptionsImpl& SetIntraOpNumThreads(
int intra_op_num_threads);
1664 SessionOptionsImpl& SetInterOpNumThreads(
int inter_op_num_threads);
1666 SessionOptionsImpl& SetDeterministicCompute(
bool value);
1668 SessionOptionsImpl& EnableCpuMemArena();
1669 SessionOptionsImpl& DisableCpuMemArena();
1671 SessionOptionsImpl& SetOptimizedModelFilePath(
const ORTCHAR_T* optimized_model_file);
1673 SessionOptionsImpl& EnableProfiling(
const ORTCHAR_T* profile_file_prefix);
1674 SessionOptionsImpl& DisableProfiling();
1676 SessionOptionsImpl& EnableOrtCustomOps();
1678 SessionOptionsImpl& EnableMemPattern();
1679 SessionOptionsImpl& DisableMemPattern();
1681 SessionOptionsImpl& SetExecutionMode(
ExecutionMode execution_mode);
1683 SessionOptionsImpl& SetLoadCancellationFlag(
bool value);
1685 SessionOptionsImpl& SetLogId(
const char* logid);
1686 SessionOptionsImpl& SetLogSeverityLevel(
int level);
1690 SessionOptionsImpl& DisablePerSessionThreads();
1692 SessionOptionsImpl& AddConfigEntry(
const char* config_key,
const char* config_value);
1697 SessionOptionsImpl& ClearEpContextDataReadFunc();
1699 SessionOptionsImpl& AddInitializer(
const char* name,
const OrtValue* ort_val);
1700 SessionOptionsImpl& AddExternalInitializers(
const std::vector<std::string>& names,
const std::vector<Value>& ort_values);
1701 SessionOptionsImpl& AddExternalInitializersFromFilesInMemory(
const std::vector<std::basic_string<ORTCHAR_T>>& external_initializer_file_names,
1702 const std::vector<char*>& external_initializer_file_buffer_array,
1703 const std::vector<size_t>& external_initializer_file_lengths);
1705 SessionOptionsImpl& AppendExecutionProvider_CPU(
int use_arena);
1711 SessionOptionsImpl& AppendExecutionProvider_OpenVINO_V2(
const std::unordered_map<std::string, std::string>& provider_options = {});
1720 SessionOptionsImpl& AppendExecutionProvider(
const std::string& provider_name,
1721 const std::unordered_map<std::string, std::string>& provider_options = {});
1725 SessionOptionsImpl& AppendExecutionProvider_V2(Env& env,
const std::vector<ConstEpDevice>& ep_devices,
1726 const KeyValuePairs& ep_options);
1729 SessionOptionsImpl& AppendExecutionProvider_V2(Env& env,
const std::vector<ConstEpDevice>& ep_devices,
1730 const std::unordered_map<std::string, std::string>& ep_options);
1736 SessionOptionsImpl& SetEpSelectionPolicy(
EpSelectionDelegate delegate,
void* state =
nullptr);
1739 SessionOptionsImpl& SetCustomThreadCreationOptions(
void* ort_custom_thread_creation_options);
1745 SessionOptionsImpl& RegisterCustomOpsLibrary(
const ORTCHAR_T* library_name,
const CustomOpConfigs& custom_op_configs = {});
1747 SessionOptionsImpl& RegisterCustomOpsUsingFunction(
const char* function_name);
1750 SessionOptionsImpl& AppendExecutionProvider_VitisAI(
const std::unordered_map<std::string, std::string>& provider_options = {});
1753 SessionOptionsImpl& AddFreeDimensionOverride(
const char* dim_denotation, int64_t dim_value);
1756 SessionOptionsImpl& AddFreeDimensionOverrideByName(
const char* dim_name, int64_t dim_value);
1807 size_t input_model_data_size);
1811 size_t initializer_size_threshold);
1813 size_t initializer_size_threshold,
1815 void** output_buffer_ptr,
1816 size_t* output_buffer_size_ptr);
1825 size_t* output_model_buffer_size_ptr);
1834 const ORTCHAR_T* model_name);
1974template <
typename T>
2038template <
typename T>
2060 std::vector<Value>
Run(
const RunOptions& run_options,
const char*
const* input_names,
const Value* input_values,
size_t input_count,
2061 const char*
const* output_names,
size_t output_count);
2066 void Run(
const RunOptions& run_options,
const char*
const* input_names,
const Value* input_values,
size_t input_count,
2067 const char*
const* output_names,
Value* output_values,
size_t output_count);
2091 const char*
const* output_names,
Value* output_values,
size_t output_count,
RunAsyncCallbackFn callback,
void* user_data);
2152#if !defined(ORT_MINIMAL_BUILD)
2169template <
typename T>
2188 [[deprecated(
"use GetShape()")]]
void GetDimensions(int64_t* values,
size_t values_count)
const;
2217 const std::vector<int64_t>& dims,
2218 const std::vector<std::string>* symbolic_dims =
nullptr);
2224template <
typename T>
2248template <
typename T>
2261template <
typename T>
2286template <
typename T>
2318#if !defined(ORT_MINIMAL_BUILD)
2354template <
typename T>
2362 template <
typename R>
2401 template <
typename R>
2470#if !defined(DISABLE_SPARSE_TENSORS)
2504 template <
typename R>
2521 template <
typename R>
2540template <
typename T>
2550 template <
typename R>
2566 template <
typename R>
2567 R&
At(
const std::vector<int64_t>& location);
2597#if !defined(DISABLE_SPARSE_TENSORS)
2618 void UseCsrIndices(int64_t* inner_data,
size_t inner_num, int64_t* outer_data,
size_t outer_num);
2640 const int64_t* indices_data,
size_t indices_num);
2655 const int64_t* inner_indices_data,
size_t inner_indices_num,
2656 const int64_t* outer_indices_data,
size_t outer_indices_num);
2669 const Shape& indices_shape,
2670 const int32_t* indices_data);
2704 template <
typename T>
2706 const int64_t* shape,
size_t shape_len);
2718 const int64_t* shape,
size_t shape_len,
2731 const int64_t* shape,
size_t shape_len,
2745 template <
typename T>
2789 template <
typename T>
2792#if !defined(DISABLE_SPARSE_TENSORS)
2803 template <
typename T>
2805 const Shape& values_shape);
2835 template <
typename T>
2855namespace binding_utils {
2861template <
typename T>
2872template <
typename T>
2915 ArenaCfg(
size_t max_mem,
int arena_extend_strategy,
int initial_chunk_size_bytes,
int max_dead_bytes_per_chunk);
2921 explicit ArenaCfg(
const std::unordered_map<std::string, size_t>& arena_config);
2930template <
typename T>
2943 template <
typename R>
2947 template <
typename R>
2978#define ORT_CXX_LOG(logger, message_severity, message) \
2980 if (message_severity >= logger.GetLoggingSeverityLevel()) { \
2981 Ort::ThrowOnError(logger.LogMessage(message_severity, ORT_FILE, __LINE__, \
2982 static_cast<const char*>(__FUNCTION__), message)); \
2994#define ORT_CXX_LOG_NOEXCEPT(logger, message_severity, message) \
2996 if (message_severity >= logger.GetLoggingSeverityLevel()) { \
2997 static_cast<void>(logger.LogMessage(message_severity, ORT_FILE, __LINE__, \
2998 static_cast<const char*>(__FUNCTION__), message)); \
3013#define ORT_CXX_LOGF(logger, message_severity, ...) \
3015 if (message_severity >= logger.GetLoggingSeverityLevel()) { \
3016 Ort::ThrowOnError(logger.LogFormattedMessage(message_severity, ORT_FILE, __LINE__, \
3017 static_cast<const char*>(__FUNCTION__), __VA_ARGS__)); \
3032#define ORT_CXX_LOGF_NOEXCEPT(logger, message_severity, ...) \
3034 if (message_severity >= logger.GetLoggingSeverityLevel()) { \
3035 static_cast<void>(logger.LogFormattedMessage(message_severity, ORT_FILE, __LINE__, \
3036 static_cast<const char*>(__FUNCTION__), __VA_ARGS__)); \
3097 const
char* func_name, const
char* message) const noexcept;
3113 template <typename... Args>
3115 const
char* func_name, const
char* format, Args&&... args) const noexcept;
3145 void ParallelFor(
void (*fn)(
void*,
size_t),
size_t total,
size_t num_batch,
void* usr_data)
const;
3154namespace attr_utils {
3155void GetAttr(
const OrtKernelInfo* p,
const char* name,
float&);
3156void GetAttr(
const OrtKernelInfo* p,
const char* name, int64_t&);
3157void GetAttr(
const OrtKernelInfo* p,
const char* name, std::string&);
3158void GetAttrs(
const OrtKernelInfo* p,
const char* name, std::vector<float>&);
3159void GetAttrs(
const OrtKernelInfo* p,
const char* name, std::vector<int64_t>&);
3160void GetAttrs(
const OrtKernelInfo* p,
const char* name, std::vector<std::string>&);
3163template <
typename T>
3164struct KernelInfoImpl :
Base<T> {
3170 template <
typename R>
3171 R GetAttribute(
const char* name)
const {
3173 attr_utils::GetAttr(this->p_, name, val);
3177 template <
typename R>
3178 std::vector<R> GetAttributes(
const char* name)
const {
3179 std::vector<R> result;
3180 attr_utils::GetAttrs(this->p_, name, result);
3184 Value GetTensorAttribute(
const char* name,
OrtAllocator* allocator)
const;
3186 size_t GetInputCount()
const;
3187 size_t GetOutputCount()
const;
3189 std::string GetInputName(
size_t index)
const;
3190 std::string GetOutputName(
size_t index)
const;
3192 TypeInfo GetInputTypeInfo(
size_t index)
const;
3193 TypeInfo GetOutputTypeInfo(
size_t index)
const;
3195 ConstValue GetTensorConstantInput(
size_t index,
int* is_constant)
const;
3197 std::string GetNodeName()
const;
3198 Logger GetLogger()
const;
3200 KeyValuePairs GetConfigEntries()
const;
3202 std::string GetOperatorDomain()
const;
3203 std::string GetOperatorType()
const;
3204 int GetOperatorSinceVersion()
const;
3205 const OrtEp* GetEp()
const;
3219 using Base = detail::KernelInfoImpl<OrtKernelInfo>;
3233 explicit Op(std::nullptr_t) {}
3238 int version,
const char** type_constraint_names,
3240 size_t type_constraint_count,
3241 const OpAttr* attr_values,
3243 size_t input_count,
size_t output_count);
3246 const Value* input_values,
3248 Value* output_values,
3249 size_t output_count);
3253 const OrtValue*
const* input_values,
3256 size_t output_count);
3273 if (is_int_ == dim.is_int_) {
3275 return i_ == dim.
i_;
3277 return std::string{s_} == std::string{dim.
s_};
3285 const char*
AsSym()
const {
return s_; }
3287 static constexpr int INVALID_INT_DIM = -2;
3297 using Shape = std::vector<SymbolicInteger>;
3323 ConstOpAttr GetAttrHdl(
const char* attr_name)
const;
3326 std::vector<Shape> input_shapes_;
3331#define MAX_CUSTOM_OP_END_VER (1UL << 31) - 1
3333template <
typename TOp,
typename TKernel,
bool WithStatus = false>
3348#if defined(_MSC_VER) && !defined(__clang__)
3349#pragma warning(push)
3350#pragma warning(disable : 26409)
3353#if defined(_MSC_VER) && !defined(__clang__)
3363#ifdef __cpp_if_constexpr
3364 if constexpr (WithStatus) {
3369 return static_cast<const TOp*
>(this_)->CreateKernelV2(*api, info, op_kernel);
3372 return static_cast<TKernel*
>(op_kernel)->ComputeV2(context);
3380 static_cast<TKernel*
>(op_kernel)->Compute(context);
3384 SetShapeInferFn<TOp>(0);
3387 return static_cast<const TOp*
>(this_)->start_ver_;
3391 return static_cast<const TOp*
>(this_)->end_ver_;
3406 return OrtCustomOpInputOutputCharacteristic::INPUT_OUTPUT_REQUIRED;
3410 return OrtCustomOpInputOutputCharacteristic::INPUT_OUTPUT_REQUIRED;
3446 return std::vector<std::string>{};
3452 template <
typename C>
3456 return C::InferOutputShape(ctx);
3461 template <
typename C>
3471 int end_ver_ = MAX_CUSTOM_OP_END_VER;
3479template <
typename T>
3521#if !defined(ORT_MINIMAL_BUILD)
3529struct AttrNameSubgraph;
3533template <
typename T>
3534struct ConstGraphImpl;
3536template <
typename T>
3583#if !defined(ORT_MINIMAL_BUILD)
3584 Node(
const std::string& operator_name,
const std::string& operator_domain,
3585 const std::string& node_name,
3586 const std::vector<std::string>& input_names,
3587 const std::vector<std::string>& output_names);
3592 Node(
const std::string& operator_name,
const std::string& operator_domain,
3593 const std::string& node_name,
3594 const std::vector<std::string>& input_names,
3595 const std::vector<std::string>& output_names,
3596 std::vector<OpAttr>& attributes);
3599 static void Init(
const std::string& operator_name,
const std::string& operator_domain,
3600 const std::string& node_name,
3601 const std::vector<std::string>& input_names,
3602 const std::vector<std::string>& output_names,
3603 std::vector<OpAttr>& attributes,
3624template <
typename T>
3653template <
typename T>
3658#if !defined(ORT_MINIMAL_BUILD)
3694#if !defined(ORT_MINIMAL_BUILD)
3701template <
typename T>
3706#if !defined(ORT_MINIMAL_BUILD)
3727#if !defined(ORT_MINIMAL_BUILD)
3729 explicit Model(
const std::vector<DomainOpsetPair>& opsets);
3734template <
typename T>
3766 explicit KernelDef(OrtKernelDef* p) : detail::ConstKernelDefImpl<OrtKernelDef>{p} {}
3790 const std::vector<int>& output_indices);
3793 const std::vector<int>& output_indices);
3814 void* kernel_create_func_state);
3818template <
typename T>
3843template <
typename T>
3893template <
typename T>
3925#include "onnxruntime_cxx_inline.h"
struct OrtMemoryInfo OrtMemoryInfo
Definition onnxruntime_c_api.h:298
struct OrtKernelInfo OrtKernelInfo
Definition onnxruntime_c_api.h:488
struct OrtNode OrtNode
Definition onnxruntime_c_api.h:326
OrtLoggingLevel
Logging severity levels.
Definition onnxruntime_c_api.h:266
OrtMemoryInfoDeviceType
This mimics OrtDevice type constants so they can be returned in the API.
Definition onnxruntime_c_api.h:523
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
OrtCustomOpInputOutputCharacteristic
Definition onnxruntime_c_api.h:7726
struct OrtTensorRTProviderOptionsV2 OrtTensorRTProviderOptionsV2
Definition onnxruntime_c_api.h:315
struct OrtThreadingOptions OrtThreadingOptions
Definition onnxruntime_c_api.h:312
struct OrtSequenceTypeInfo OrtSequenceTypeInfo
Definition onnxruntime_c_api.h:306
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
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
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 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
struct OrtProfilingEvent OrtProfilingEvent
Definition onnxruntime_ep_c_api.h:35
struct OrtKernelContext OrtKernelContext
Definition onnxruntime_c_api.h:490
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
struct OrtCANNProviderOptions OrtCANNProviderOptions
Definition onnxruntime_c_api.h:318
struct OrtEpDevice OrtEpDevice
Definition onnxruntime_c_api.h:332
void(* RunAsyncCallbackFn)(void *user_data, OrtValue **outputs, size_t num_outputs, OrtStatusPtr status)
Callback function for RunAsync.
Definition onnxruntime_c_api.h:1121
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
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
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
#define ORT_API_VERSION
The API version defined in this header.
Definition onnxruntime_c_api.h:43
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
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
ONNXTensorElementDataType
Definition onnxruntime_c_api.h:194
OrtExecutionProviderDevicePolicy
These are the default EP selection policies used by ORT when doing automatic EP selection.
Definition onnxruntime_c_api.h:538
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:269
@ OrtMemTypeDefault
The default allocator for execution provider.
Definition onnxruntime_c_api.h:512
@ ORT_FAIL
Definition onnxruntime_error_code.h:27
@ ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT
Definition onnxruntime_c_api.h:196
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:642
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
Ort::KeyValuePairs GetEnvConfigEntries()
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:215
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:829
detail::ConstSessionOptionsImpl< detail::Unowned< const OrtSessionOptions > > ConstSessionOptions
Definition onnxruntime_cxx_api.h:1761
detail::KernelInfoImpl< detail::Unowned< const OrtKernelInfo > > ConstKernelInfo
Definition onnxruntime_cxx_api.h:3210
const OrtApi & GetApi() noexcept
This returns a reference to the ORT C API.
Definition onnxruntime_cxx_api.h:189
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:229
AllocatedStringPtr GetCompatibilityInfoFromModelAllocated(const char *model_path, const char *ep_type, OrtAllocator *allocator)
Extract EP compatibility info from a precompiled model file.
AllocatedStringPtr GetCompatibilityInfoFromModelBytesAllocated(const void *model_data, size_t model_data_length, const char *ep_type, OrtAllocator *allocator)
Extract EP compatibility info from precompiled model bytes in memory.
detail::AllocatorImpl< detail::Unowned< OrtAllocator > > UnownedAllocator
Definition onnxruntime_cxx_api.h:1112
OrtCompiledModelCompatibility GetModelCompatibilityForEpDevices(const std::vector< ConstEpDevice > &ep_devices, const char *compatibility_info)
Validate a compiled model's compatibility for one or more EP devices.
const OrtInteropApi & GetInteropApi()
This returns a reference to the ORT C Interop API. Used for external resource import with EPs.
Definition onnxruntime_cxx_api.h:243
OpSchema GetOpSchema(const char *name, int max_inclusive_version, const char *domain)
Get an operator schema from the global schema registry.
detail::SessionOptionsImpl< detail::Unowned< OrtSessionOptions > > UnownedSessionOptions
Definition onnxruntime_cxx_api.h:1760
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:270
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:3329
const OrtModelPackageApi & GetModelPackageApi()
This returns a reference to the stable ORT Model Package API.
Definition onnxruntime_cxx_api.h:257
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:1104
Allocator(const Session &session, const OrtMemoryInfo *)
Take ownership of a pointer created by C API.
Allocator(std::nullptr_t)
Convenience to create a class member and then replace with an instance.
Definition onnxruntime_cxx_api.h:1105
Allocator(OrtAllocator *p)
Definition onnxruntime_cxx_api.h:1109
Wrapper around OrtAllocator default instance that is owned by Onnxruntime.
Definition onnxruntime_cxx_api.h:1095
AllocatorWithDefaultOptions(std::nullptr_t)
Convenience to create a class member and then replace with an instance.
Definition onnxruntime_cxx_api.h:1096
AllocatorWithDefaultOptions()
it is a structure that represents the configuration of an arena based allocator
Definition onnxruntime_cxx_api.h:2905
ArenaCfg(std::nullptr_t)
Create an empty ArenaCfg object, must be assigned a valid one to be used.
Definition onnxruntime_cxx_api.h:2906
ArenaCfg(const std::unordered_map< std::string, size_t > &arena_config)
ArenaCfg(size_t max_mem, int arena_extend_strategy, int initial_chunk_size_bytes, int max_dead_bytes_per_chunk)
Definition onnxruntime_cxx_api.h:3683
ConstGraph sub_graph
Definition onnxruntime_cxx_api.h:3685
std::string attr_name
Definition onnxruntime_cxx_api.h:3684
bfloat16 (Brain Floating Point) data type
Definition onnxruntime_cxx_api.h:440
bool operator==(const BFloat16_t &rhs) const noexcept
onnxruntime_float16::BFloat16Impl< BFloat16_t > Base
Definition onnxruntime_cxx_api.h:452
static constexpr BFloat16_t FromBits(uint16_t v) noexcept
Explicit conversion to uint16_t representation of bfloat16.
Definition onnxruntime_cxx_api.h:461
bool operator!=(const BFloat16_t &rhs) const noexcept
Definition onnxruntime_cxx_api.h:559
BFloat16_t(float v) noexcept
__ctor from float. Float is converted into bfloat16 16-bit representation.
Definition onnxruntime_cxx_api.h:467
float ToFloat() const noexcept
Converts bfloat16 to float.
Definition onnxruntime_cxx_api.h:473
bool operator<(const BFloat16_t &rhs) const noexcept
The CUDAProviderOptions (V2)
Definition onnxruntime_cxx_api.h:900
CUDAProviderOptions()
Wraps OrtApi::CreateCUDAProviderOptions.
CUDAProviderOptions(std::nullptr_t)
Definition onnxruntime_cxx_api.h:901
void UpdateWithValue(const char *key, void *value)
Wrapper around OrtApi::GetCUDAProviderOptionsByName.
std::string GetCUDAProviderOptionsAsString() const
Wrapper around OrtApi::UpdateCUDAProviderOptionsWithValue.
void Update(const std::unordered_map< std::string, std::string > &options)
Wrapper around OrtApi::GetCUDAProviderOptionsAsString.
void * GetOptionByName(const char *name) const
Definition onnxruntime_cxx_api.h:3334
OrtCustomOpInputOutputCharacteristic GetOutputCharacteristic(size_t) const
Definition onnxruntime_cxx_api.h:3409
OrtCustomOpInputOutputCharacteristic GetInputCharacteristic(size_t) const
Definition onnxruntime_cxx_api.h:3405
OrtMemType GetInputMemoryType(size_t) const
Definition onnxruntime_cxx_api.h:3414
std::vector< std::string > GetSessionConfigKeys() const
Definition onnxruntime_cxx_api.h:3445
bool GetVariadicInputHomogeneity() const
Definition onnxruntime_cxx_api.h:3426
int GetVariadicInputMinArity() const
Definition onnxruntime_cxx_api.h:3420
void SetShapeInferFn(...)
Definition onnxruntime_cxx_api.h:3462
CustomOpBase()
Definition onnxruntime_cxx_api.h:3335
bool GetVariadicOutputHomogeneity() const
Definition onnxruntime_cxx_api.h:3438
int GetVariadicOutputMinArity() const
Definition onnxruntime_cxx_api.h:3432
decltype(&C::InferOutputShape) SetShapeInferFn(decltype(&C::InferOutputShape))
Definition onnxruntime_cxx_api.h:3453
const char * GetExecutionProviderType() const
Definition onnxruntime_cxx_api.h:3401
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:1603
~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:1484
CustomOpDomain(std::nullptr_t)
Create an empty CustomOpDomain object, must be assigned a valid one to be used.
Definition onnxruntime_cxx_api.h:1488
CustomOpDomain(const char *domain)
Wraps OrtApi::CreateCustomOpDomain.
void Add(const OrtCustomOp *op)
Wraps CustomOpDomain_Add.
Wrapper around OrtDeviceEpIncompatibilityDetails.
Definition onnxruntime_cxx_api.h:1171
DeviceEpIncompatibilityDetails(OrtDeviceEpIncompatibilityDetails *p)
Take ownership of a pointer created by C API.
Definition onnxruntime_cxx_api.h:1173
DeviceEpIncompatibilityDetails(std::nullptr_t)
No instance is created.
Definition onnxruntime_cxx_api.h:1172
The Env (Environment)
Definition onnxruntime_cxx_api.h:1385
std::vector< ConstHardwareDevice > GetHardwareDevices() const
Get the list of available hardware devices.
Env & EnableTelemetryEvents()
Wraps OrtApi::EnableTelemetryEvents.
Env(OrtEnv *p)
C Interop Helper.
Definition onnxruntime_cxx_api.h:1405
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.
Env & SetPerSessionThreadPoolCallbacks(const OrtThreadPoolCallbacksConfig &config)
Wraps OrtApi::SetPerSessionThreadPoolCallbacks Stores work callbacks on the Env for per-session threa...
std::vector< ConstEpDevice > GetEpDevices() const
DeviceEpIncompatibilityDetails GetHardwareDeviceEpIncompatibilityDetails(const char *ep_name, ConstHardwareDevice hw) const
Check for known incompatibility issues between hardware device and a specific execution provider.
Env & UnregisterAllocator(const OrtMemoryInfo *mem_info)
Wraps OrtApi::UnregisterAllocator.
Env(std::nullptr_t)
Create an empty Env object, must be assigned a valid one to be used.
Definition onnxruntime_cxx_api.h:1386
Status CopyTensor(const OrtValue *src_tensor, OrtValue *dst_tensor, OrtSyncStream *stream) const
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 & RegisterAllocator(OrtAllocator *allocator)
Wraps OrtApi::RegisterAllocator.
UnownedAllocator CreateSharedAllocator(const OrtEpDevice *ep_device, OrtDeviceMemoryType mem_type, OrtAllocatorType allocator_type, const OrtKeyValuePairs *allocator_options)
Wraps OrtApi::CreateSharedAllocator.
size_t GetNumHardwareDevices() const
Get the number of available hardware devices.
Env(OrtLoggingLevel logging_level, const char *logid, OrtLoggingFunction logging_function, void *logger_param)
Wraps OrtApi::CreateEnvWithCustomLogger.
Env(const OrtEnvCreationOptions *options)
Wraps OrtApi::CreateEnvWithOptions.
Env & CreateAndRegisterAllocator(const OrtMemoryInfo *mem_info, const OrtArenaCfg *arena_cfg)
Wraps OrtApi::CreateAndRegisterAllocator.
UnownedAllocator GetSharedAllocator(const OrtMemoryInfo *mem_info)
Wraps OrtApi::GetSharedAllocator.
Env & RegisterExecutionProviderLibrary(const char *registration_name, const std::basic_string< char > &path)
Wraps OrtApi::RegisterExecutionProviderLibrary.
Env & UpdateEnvWithCustomLogLevel(OrtLoggingLevel log_severity_level)
Wraps OrtApi::UpdateEnvWithCustomLogLevel.
Status CopyTensors(const std::vector< Value > &src_tensors, const std::vector< Value > &dst_tensors, OrtSyncStream *stream) const
Wraps OrtApi::CopyTensors.
void ReleaseSharedAllocator(const OrtEpDevice *ep_device, OrtDeviceMemoryType mem_type)
Wraps OrtApi::ReleaseSharedAllocator.
Env & DisableTelemetryEvents()
Wraps OrtApi::DisableTelemetryEvents.
Move-only owner for the EPContext callback configuration used by plugin EPs.
Definition onnxruntime_cxx_api.h:1779
EpContextConfig(const SessionOptions &session_options)
Wraps OrtEpApi::SessionOptionsGetEpContextConfig.
EpContextConfig(ConstSessionOptions session_options)
Wraps OrtEpApi::SessionOptionsGetEpContextConfig.
void GetWriteFunc(OrtWriteNamedBufferFunc &write_func, void *&state) const
Wraps OrtEpApi::EpContextConfigGetEpContextDataWriteFunc.
EpContextConfig(std::nullptr_t) noexcept
Definition onnxruntime_cxx_api.h:1783
void GetReadFunc(OrtReadNamedBufferFunc &read_func, void *&state) const
Wraps OrtEpApi::EpContextConfigGetEpContextDataReadFunc.
Mutable EpDevice that is created by EpApi users.
Definition onnxruntime_cxx_api.h:1200
EpDevice(OrtEpDevice *p)
Take ownership of a pointer created by C API.
Definition onnxruntime_cxx_api.h:1202
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:1201
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:59
Exception(const std::string &string, OrtErrorCode code)
Definition onnxruntime_cxx_api.h:55
OrtErrorCode GetOrtErrorCode() const
Definition onnxruntime_cxx_api.h:58
Exception(std::string &&string, OrtErrorCode code)
Definition onnxruntime_cxx_api.h:56
Wrapper around OrtExternalInitializerInfo.
Definition onnxruntime_cxx_api.h:951
ConstExternalInitializerInfo GetConst() const
Wraps OrtApi::CreateExternalInitializerInfo.
Definition onnxruntime_cxx_api.h:959
ExternalInitializerInfo(const char *filepath, int64_t file_offset, size_t byte_size)
Wrapper around CreateExternalInitializerInfo that does not throw an exception.
ExternalInitializerInfo(std::nullptr_t)
Definition onnxruntime_cxx_api.h:955
ExternalInitializerInfo(OrtExternalInitializerInfo *p)
Definition onnxruntime_cxx_api.h:956
static Status Create(const char *filepath, int64_t file_offset, size_t byte_size, ExternalInitializerInfo &out)
IEEE 754 half-precision floating point data type.
Definition onnxruntime_cxx_api.h:298
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:326
onnxruntime_float16::Float16Impl< Float16_t > Base
Definition onnxruntime_cxx_api.h:308
float ToFloat() const noexcept
Converts float16 to float.
Definition onnxruntime_cxx_api.h:332
static constexpr Float16_t FromBits(uint16_t v) noexcept
Explicit conversion to uint16_t representation of float16.
Definition onnxruntime_cxx_api.h:320
float8e4m3fn (Float8 Floating Point) data type
Definition onnxruntime_cxx_api.h:570
uint8_t value
Definition onnxruntime_cxx_api.h:571
constexpr Float8E4M3FN_t(uint8_t v) noexcept
Definition onnxruntime_cxx_api.h:573
constexpr bool operator==(const Float8E4M3FN_t &rhs) const noexcept
Definition onnxruntime_cxx_api.h:576
constexpr Float8E4M3FN_t() noexcept
Definition onnxruntime_cxx_api.h:572
constexpr bool operator!=(const Float8E4M3FN_t &rhs) const noexcept
Definition onnxruntime_cxx_api.h:577
float8e4m3fnuz (Float8 Floating Point) data type
Definition onnxruntime_cxx_api.h:587
constexpr bool operator==(const Float8E4M3FNUZ_t &rhs) const noexcept
Definition onnxruntime_cxx_api.h:593
uint8_t value
Definition onnxruntime_cxx_api.h:588
constexpr Float8E4M3FNUZ_t() noexcept
Definition onnxruntime_cxx_api.h:589
constexpr bool operator!=(const Float8E4M3FNUZ_t &rhs) const noexcept
Definition onnxruntime_cxx_api.h:594
constexpr Float8E4M3FNUZ_t(uint8_t v) noexcept
Definition onnxruntime_cxx_api.h:590
float8e5m2 (Float8 Floating Point) data type
Definition onnxruntime_cxx_api.h:604
constexpr Float8E5M2_t(uint8_t v) noexcept
Definition onnxruntime_cxx_api.h:607
uint8_t value
Definition onnxruntime_cxx_api.h:605
constexpr bool operator!=(const Float8E5M2_t &rhs) const noexcept
Definition onnxruntime_cxx_api.h:611
constexpr Float8E5M2_t() noexcept
Definition onnxruntime_cxx_api.h:606
constexpr bool operator==(const Float8E5M2_t &rhs) const noexcept
Definition onnxruntime_cxx_api.h:610
float8e5m2fnuz (Float8 Floating Point) data type
Definition onnxruntime_cxx_api.h:621
constexpr Float8E5M2FNUZ_t() noexcept
Definition onnxruntime_cxx_api.h:623
constexpr Float8E5M2FNUZ_t(uint8_t v) noexcept
Definition onnxruntime_cxx_api.h:624
constexpr bool operator!=(const Float8E5M2FNUZ_t &rhs) const noexcept
Definition onnxruntime_cxx_api.h:628
constexpr bool operator==(const Float8E5M2FNUZ_t &rhs) const noexcept
Definition onnxruntime_cxx_api.h:627
uint8_t value
Definition onnxruntime_cxx_api.h:622
Wrapper around OrtGraph.
Definition onnxruntime_cxx_api.h:3691
Graph(OrtGraph *p)
Take ownership of a pointer created by C API.
Definition onnxruntime_cxx_api.h:3693
Graph(std::nullptr_t)
No instance is created.
Definition onnxruntime_cxx_api.h:3692
Wrapper around OrtIoBinding.
Definition onnxruntime_cxx_api.h:2894
UnownedIoBinding GetUnowned() const
Definition onnxruntime_cxx_api.h:2898
ConstIoBinding GetConst() const
Definition onnxruntime_cxx_api.h:2897
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:2895
This class wraps a raw pointer OrtKernelContext* that is being passed to the custom kernel Compute() ...
Definition onnxruntime_cxx_api.h:3128
KernelContext(OrtKernelContext *context)
OrtSyncStream * GetSyncStream() const
ConstValue GetInput(size_t index) const
OrtKernelContext * GetOrtKernelContext() const
Definition onnxruntime_cxx_api.h:3144
void ParallelFor(void(*fn)(void *, size_t), size_t total, size_t num_batch, void *usr_data) const
UnownedValue GetPreallocatedOutput(size_t index) const
void * GetGPUComputeStream() const
size_t GetInputCount() const
Ort::Allocator GetAllocator(const OrtMemoryInfo &memory_info) 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
Builder for OrtKernelDef.
Definition onnxruntime_cxx_api.h:3775
KernelDefBuilder & AddTypeConstraint(const char *arg_name, const OrtDataType *data_type)
KernelDefBuilder & SetOutputMemType(size_t output_index, OrtMemType mem_type)
KernelDefBuilder & AddInputOutputMutableAliases(const std::vector< int > &input_indices, const std::vector< int > &output_indices)
KernelDefBuilder & SetInputMemType(size_t input_index, OrtMemType mem_type)
KernelDefBuilder & SetDomain(const char *domain)
KernelDefBuilder & AddInputOutputAliases(const std::vector< int > &input_indices, const std::vector< int > &output_indices)
KernelDefBuilder & AddInputOutputAlias(int input_index, int output_index)
KernelDefBuilder & SetExecutionProvider(const char *ep_name)
KernelDefBuilder & SetOperatorType(const char *op_type)
KernelDefBuilder & AddInputOutputMutableAlias(int input_index, int output_index)
KernelDefBuilder()
Wraps OrtEpApi::CreateKernelDefBuilder.
KernelDefBuilder & AddTypeConstraint(const char *arg_name, const std::vector< const OrtDataType * > &data_types)
KernelDefBuilder(std::nullptr_t)
Create an empty object, must be assigned a valid one to be used.
Definition onnxruntime_cxx_api.h:3777
KernelDefBuilder(OrtKernelDefBuilder *ort_kernel_def_builder)
KernelDefBuilder & SetSinceVersion(int since_version_start, int since_version_end)
Definition onnxruntime_cxx_api.h:3761
KernelDef(OrtKernelDef *p)
Definition onnxruntime_cxx_api.h:3766
KernelDef(std::nullptr_t)
Definition onnxruntime_cxx_api.h:3765
ConstKernelDef GetConst() const
Definition onnxruntime_cxx_api.h:3768
This struct owns the OrtKernInfo* pointer when a copy is made. For convenient wrapping of OrtKernelIn...
Definition onnxruntime_cxx_api.h:3218
KernelInfo(OrtKernelInfo *info)
Take ownership of the instance.
ConstKernelInfo GetConst() const
Definition onnxruntime_cxx_api.h:3223
detail::KernelInfoImpl< OrtKernelInfo > Base
Definition onnxruntime_cxx_api.h:3219
KernelInfo(std::nullptr_t)
Create an empty instance to initialize later.
Definition onnxruntime_cxx_api.h:3221
Registry for kernels supported by an EP.
Definition onnxruntime_cxx_api.h:3802
KernelRegistry()
< Wrapper around OrtEpApi::CreateKernelRegistry
KernelRegistry(std::nullptr_t)
Take ownership of a pointer created with the C API.
Definition onnxruntime_cxx_api.h:3807
Status AddKernel(const OrtKernelDef *kernel_def, OrtKernelCreateFunc kernel_create_func, void *kernel_create_func_state)
KernelRegistry(OrtKernelRegistry *ort_kernel_registry)
Wraps KernelRegistry_AddKernel.
Wrapper around OrtKeyValuePairs.
Definition onnxruntime_cxx_api.h:988
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:989
ConstKeyValuePairs GetConst() const
Definition onnxruntime_cxx_api.h:1005
KeyValuePairs(OrtKeyValuePairs *p)
Take ownership of a pointer created by C API.
Definition onnxruntime_cxx_api.h:991
This class represents an ONNX Runtime logger that can be used to log information with an associated s...
Definition onnxruntime_cxx_api.h:3050
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:3059
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:1498
static LoraAdapter CreateLoraAdapter(const std::basic_string< char > &adapter_path, OrtAllocator *allocator)
Wraps OrtApi::CreateLoraAdapter.
LoraAdapter(std::nullptr_t)
Definition onnxruntime_cxx_api.h:1502
static LoraAdapter CreateLoraAdapterFromArray(const void *bytes, size_t num_bytes, OrtAllocator *allocator)
Wraps OrtApi::CreateLoraAdapterFromArray.
Wrapper around OrtMapTypeInfo.
Definition onnxruntime_cxx_api.h:2276
ConstMapTypeInfo GetConst() const
Definition onnxruntime_cxx_api.h:2282
MapTypeInfo(OrtMapTypeInfo *p)
Used for interop with the C API.
Definition onnxruntime_cxx_api.h:2281
MapTypeInfo(std::nullptr_t)
Create an empty MapTypeInfo object, must be assigned a valid one to be used.
Definition onnxruntime_cxx_api.h:2280
Represents native memory allocation coming from one of the OrtAllocators registered with OnnxRuntime....
Definition onnxruntime_cxx_api.h:1049
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:1058
Wrapper around OrtMemoryInfo.
Definition onnxruntime_cxx_api.h:1033
MemoryInfo(const char *name, OrtAllocatorType type, int id, OrtMemType mem_type)
MemoryInfo(std::nullptr_t)
No instance is created.
Definition onnxruntime_cxx_api.h:1035
MemoryInfo(OrtMemoryInfo *p)
Take ownership of a pointer created by C API.
Definition onnxruntime_cxx_api.h:1036
static MemoryInfo CreateCpu(OrtAllocatorType type, OrtMemType mem_type1)
ConstMemoryInfo GetConst() const
Definition onnxruntime_cxx_api.h:1040
MemoryInfo(const char *name, OrtMemoryInfoDeviceType device_type, uint32_t vendor_id, uint32_t device_id, OrtDeviceMemoryType mem_type, size_t alignment, OrtAllocatorType allocator_type)
Wrapper around CreateMemoryInfo_V2.
Options object used when compiling a model.
Definition onnxruntime_cxx_api.h:1796
ModelCompilationOptions & SetOutputModelWriteFunc(OrtWriteBufferFunc write_func, void *state)
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 & SetFlags(uint32_t flags)
Wraps OrtApi::ModelCompilationOptions_SetFlags.
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:1800
ModelCompilationOptions & SetEpContextDataWriteFunc(OrtWriteNamedBufferFunc write_func, void *state=nullptr)
Register or clear the external EPContext write callback. Wraps OrtCompileApi::ModelCompilationOptions...
ModelCompilationOptions(const Env &env, ConstSessionOptions session_options)
Wraps OrtApi::CreateModelCompilationOptionsFromSessionOptions.
ModelCompilationOptions & SetOutputModelPath(const char *output_model_path)
Wraps OrtApi::ModelCompilationOptions_SetOutputModelPath.
ModelCompilationOptions & SetOutputModelExternalInitializersBuffer(const char *logical_file_name, size_t initializer_size_threshold, OrtAllocator *allocator, void **output_buffer_ptr, size_t *output_buffer_size_ptr)
ModelCompilationOptions & SetInputModelPath(const char *input_model_path)
Wraps OrtApi::ModelCompilationOptions_SetInputModelPath.
ModelCompilationOptions & SetOutputModelGetInitializerLocationFunc(OrtGetInitializerLocationFunc get_initializer_location_func, void *state)
ModelCompilationOptions & SetEpContextBinaryInformation(const char *output_directory, const char *model_name)
Wraps OrtApi::ModelCompilationOptions_SetEpContextBinaryInformation.
ModelCompilationOptions & SetOutputModelExternalInitializersAlignment(size_t alignment, size_t minimum_size)
Wraps OrtApi::ModelCompilationOptions_SetOutputModelGetInitializerLocationFunc.
ModelCompilationOptions & SetGraphOptimizationLevel(GraphOptimizationLevel graph_optimization_level)
Wraps OrtApi::ModelCompilationOptions_SetGraphOptimizationLevel.
ModelCompilationOptions(const Env &env, const SessionOptions &session_options)
Wraps OrtApi::CreateModelCompilationOptionsFromSessionOptions.
ModelCompilationOptions & SetInputModel(const OrtModel *model)
Wraps OrtCompileApi::ModelCompilationOptions_SetInputModel.
ModelCompilationOptions & SetWeightlessEnabled(bool use_weightless)
Wraps OrtCompileApi::ModelCompilationOptions_SetWeightlessEnabled.
Wrapper around OrtModel.
Definition onnxruntime_cxx_api.h:3721
Model(const std::vector< DomainOpsetPair > &opsets)
Model(OrtModel *p)
Take ownership of a pointer created by C API.
Definition onnxruntime_cxx_api.h:3725
std::pair< std::string, int > DomainOpsetPair
Definition onnxruntime_cxx_api.h:3722
Model(std::nullptr_t)
No instance is created.
Definition onnxruntime_cxx_api.h:3724
Context for a selected model package component and variant.
Definition onnxruntime_cxx_api.h:1884
Session CreateSession(const Env &env, ConstSessionOptions session_options)
Session CreateSession(const Env &env, const SessionOptions &session_options)
ModelPackageComponentContext(std::nullptr_t)
Definition onnxruntime_cxx_api.h:1888
Session CreateSession(const Env &env)
std::string GetSelectedVariantName() const
std::basic_string< char > GetSelectedVariantFolderPath() const
Context used to inspect a model package and select one of its components.
Definition onnxruntime_cxx_api.h:1865
ModelPackageContext(const char *package_root)
std::vector< std::string > GetComponentNames() const
int64_t GetSchemaVersion() const
const char * GetVariantEpName(const char *component_name, const char *variant_name) const
std::string ResolveStringRef(const char *base_dir, const char *input, bool must_exist) const
size_t GetVariantCount(const char *component_name) const
size_t GetComponentCount() const
std::vector< std::string > GetVariantNames(const char *component_name) const
ModelPackageContext(std::nullptr_t)
Definition onnxruntime_cxx_api.h:1869
ModelPackageComponentContext SelectComponent(const char *component_name, const ModelPackageOptions &options) const
Options used to select a component variant from a model package.
Definition onnxruntime_cxx_api.h:1855
ModelPackageOptions(const Env &env, ConstSessionOptions session_options)
ModelPackageOptions(std::nullptr_t)
Definition onnxruntime_cxx_api.h:1859
ModelPackageOptions(const Env &env, const SessionOptions &session_options)
Wrapper around OrtNode.
Definition onnxruntime_cxx_api.h:3578
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:3580
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:3581
This struct provides life time management for custom op attribute.
Definition onnxruntime_cxx_api.h:2959
OpAttr(const char *name, const void *data, int len, OrtOpAttrType type)
OpAttr(std::nullptr_t)
Definition onnxruntime_cxx_api.h:2964
ConstOpAttr GetConst() const
Definition onnxruntime_cxx_api.h:2967
Create and own custom defined operation.
Definition onnxruntime_cxx_api.h:3229
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:3233
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)
Definition onnxruntime_cxx_api.h:3618
std::string domain
Definition onnxruntime_cxx_api.h:3619
int64_t version
Definition onnxruntime_cxx_api.h:3620
The PrepackedWeightsContainer.
Definition onnxruntime_cxx_api.h:919
PrepackedWeightsContainer()
Wraps OrtApi::CreatePrepackedWeightsContainer.
PrepackedWeightsContainer(OrtPrepackedWeightsContainer *p)
Definition onnxruntime_cxx_api.h:924
PrepackedWeightsContainer(std::nullptr_t)
Take ownership of a pointer created by C API.
Definition onnxruntime_cxx_api.h:922
Owning wrapper around OrtProfilingEvent.
Definition onnxruntime_cxx_api.h:1332
ProfilingEvent(std::nullptr_t)
No instance is created.
Definition onnxruntime_cxx_api.h:1333
ConstProfilingEvent GetConst() const
Definition onnxruntime_cxx_api.h:1357
ProfilingEvent(OrtProfilingEventCategory category, int32_t process_id, int32_t thread_id, const char *event_name, int64_t timestamp_us, int64_t duration_us, const std::unordered_map< std::string, std::string > &args={})
Wraps OrtEpApi::CreateProfilingEvent.
ProfilingEvent(OrtProfilingEvent *p)
Take ownership.
Definition onnxruntime_cxx_api.h:1334
ProfilingEvent(OrtProfilingEventCategory category, int32_t process_id, int32_t thread_id, const char *event_name, int64_t timestamp_us, int64_t duration_us, const char *const *arg_keys, const char *const *arg_values, size_t num_args)
Wraps OrtEpApi::CreateProfilingEvent.
RunOptions.
Definition onnxruntime_cxx_api.h:1528
int GetRunLogSeverityLevel() const
Wraps OrtApi::RunOptionsGetRunLogSeverityLevel.
RunOptions & SetTerminate()
Terminates all currently executing Session::Run calls that were made using this RunOptions instance.
RunOptions & DisableProfiling()
Disable profiling for this run.
RunOptions & SetSyncStream(OrtSyncStream *stream)
Associate a sync stream with the run options.
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:1529
RunOptions & SetRunLogVerbosityLevel(int)
Wraps OrtApi::RunOptionsSetRunLogVerbosityLevel.
RunOptions & SetRunLogSeverityLevel(int)
Wraps OrtApi::RunOptionsSetRunLogSeverityLevel.
RunOptions & EnableProfiling(const char *profile_file_prefix)
Enable profiling for this run.
RunOptions & AddConfigEntry(const char *config_key, const char *config_value)
Wraps OrtApi::AddRunConfigEntry.
const char * GetRunTag() const
Wraps OrtApi::RunOptionsGetRunTag.
RunOptions()
Wraps OrtApi::CreateRunOptions.
const char * GetConfigEntry(const char *config_key)
Wraps OrtApi::GetRunConfigEntry.
Wrapper around OrtSequenceTypeInfo.
Definition onnxruntime_cxx_api.h:2238
SequenceTypeInfo(std::nullptr_t)
Create an empty SequenceTypeInfo object, must be assigned a valid one to be used.
Definition onnxruntime_cxx_api.h:2242
ConstSequenceTypeInfo GetConst() const
Definition onnxruntime_cxx_api.h:2244
SequenceTypeInfo(OrtSequenceTypeInfo *p)
Used for interop with the C API.
Definition onnxruntime_cxx_api.h:2243
Wrapper around OrtSession.
Definition onnxruntime_cxx_api.h:2134
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:2136
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:2165
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:2137
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:2164
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:1766
SessionOptions(std::nullptr_t)
Create an empty SessionOptions object, must be assigned a valid one to be used.
Definition onnxruntime_cxx_api.h:1767
UnownedSessionOptions GetUnowned() const
Definition onnxruntime_cxx_api.h:1770
SessionOptions()
Wraps OrtApi::CreateSessionOptions.
ConstSessionOptions GetConst() const
Definition onnxruntime_cxx_api.h:1771
SessionOptions(OrtSessionOptions *p)
Used for interop with the C API.
Definition onnxruntime_cxx_api.h:1769
Definition onnxruntime_cxx_api.h:3263
SymbolicInteger & operator=(const SymbolicInteger &)=default
SymbolicInteger(const SymbolicInteger &)=default
int64_t AsInt() const
Definition onnxruntime_cxx_api.h:3284
int64_t i_
Definition onnxruntime_cxx_api.h:3291
const char * s_
Definition onnxruntime_cxx_api.h:3292
bool operator==(const SymbolicInteger &dim) const
Definition onnxruntime_cxx_api.h:3272
SymbolicInteger & operator=(SymbolicInteger &&)=default
SymbolicInteger(SymbolicInteger &&)=default
const char * AsSym() const
Definition onnxruntime_cxx_api.h:3285
SymbolicInteger(int64_t i)
Definition onnxruntime_cxx_api.h:3264
SymbolicInteger(const char *s)
Definition onnxruntime_cxx_api.h:3265
bool IsInt() const
Definition onnxruntime_cxx_api.h:3283
Provide access to per-node attributes and input shapes, so one could compute and set output shapes.
Definition onnxruntime_cxx_api.h:3262
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:3297
std::vector< float > Floats
Definition onnxruntime_cxx_api.h:3314
std::string GetAttrString(const char *attr_name)
std::vector< int64_t > Ints
Definition onnxruntime_cxx_api.h:3309
ShapeInferContext(const OrtApi *ort_api, OrtShapeInferContext *ctx)
int64_t GetAttrInt(const char *attr_name)
size_t GetInputCount() const
Definition onnxruntime_cxx_api.h:3303
std::vector< std::string > Strings
Definition onnxruntime_cxx_api.h:3319
Floats GetAttrFloats(const char *attr_name)
const Shape & GetInputShape(size_t indice) const
Definition onnxruntime_cxx_api.h:3301
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:835
OrtErrorCode GetErrorCode() const
Status(const Exception &)
Creates status instance out of exception.
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 std::exception &)
Creates status instance out of exception.
Status(const char *message, OrtErrorCode code)
Creates status instance out of null-terminated string message.
Status(std::nullptr_t) noexcept
Create an empty object, must be assigned a valid one to be used.
Definition onnxruntime_cxx_api.h:837
Definition onnxruntime_cxx_api.h:1128
SyncStream(OrtSyncStream *p)
Definition onnxruntime_cxx_api.h:1132
SyncStream(std::nullptr_t)
< Create an empty SyncStream object, must be assigned a valid one to be used
Definition onnxruntime_cxx_api.h:1130
The TensorRTOptions (V2)
Definition onnxruntime_cxx_api.h:881
void Update(const std::unordered_map< std::string, std::string > &options)
Wrapper around OrtApi::UpdateTensorRTProviderOptions.
void UpdateWithValue(const char *key, void *value)
Wrapper around OrtApi::GetTensorRTProviderOptionsByName.
std::string GetTensorRTProviderOptionsAsString() const
void * GetOptionByName(const char *name) const
Wrapper around OrtApi::GetTensorRTProviderOptionsAsString.
TensorRTProviderOptions(std::nullptr_t)
Definition onnxruntime_cxx_api.h:882
TensorRTProviderOptions()
Wraps OrtApi::CreateTensorRTProviderOptionsV2.
Wrapper around OrtTensorTypeAndShapeInfo.
Definition onnxruntime_cxx_api.h:2204
TensorTypeAndShapeInfo(std::nullptr_t)
Create an empty TensorTypeAndShapeInfo object, must be assigned a valid one to be used.
Definition onnxruntime_cxx_api.h:2209
ConstTensorTypeAndShapeInfo GetConst() const
Definition onnxruntime_cxx_api.h:2220
TensorTypeAndShapeInfo(OrtTensorTypeAndShapeInfo *p)
Used for interop with the C API.
Definition onnxruntime_cxx_api.h:2211
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:851
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:2310
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:2315
static TypeInfo CreateMapTypeInfo(ONNXTensorElementDataType key_type, ConstTypeInfo value_type)
ConstTypeInfo GetConst() const
Definition onnxruntime_cxx_api.h:2326
TypeInfo(OrtTypeInfo *p)
C API Interop.
Definition onnxruntime_cxx_api.h:2316
Wrapper around OrtValue.
Definition onnxruntime_cxx_api.h:2683
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:2689
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:2694
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:2693
Definition onnxruntime_cxx_api.h:3610
int64_t index
Definition onnxruntime_cxx_api.h:3614
ConstNode node
Definition onnxruntime_cxx_api.h:3611
Wrapper around OrtValueInfo.
Definition onnxruntime_cxx_api.h:3515
ConstValueInfo GetConst() const
Definition onnxruntime_cxx_api.h:3525
ValueInfo(std::nullptr_t)
Definition onnxruntime_cxx_api.h:3517
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:3519
Definition onnxruntime_cxx_api.h:793
AllocatedFree(OrtAllocator *allocator)
Definition onnxruntime_cxx_api.h:795
OrtAllocator * allocator_
Definition onnxruntime_cxx_api.h:794
void operator()(void *ptr) const
Definition onnxruntime_cxx_api.h:797
Base & operator=(Base &&v) noexcept
Definition onnxruntime_cxx_api.h:779
constexpr contained_type & operator*() const noexcept
Definition onnxruntime_cxx_api.h:786
typename Unowned< T >::Type contained_type
Definition onnxruntime_cxx_api.h:768
Base(Base &&v) noexcept
Definition onnxruntime_cxx_api.h:778
Base(const Base &)=default
constexpr Base(contained_type *p) noexcept
Definition onnxruntime_cxx_api.h:771
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:721
Base(Base &&v) noexcept
Definition onnxruntime_cxx_api.h:733
constexpr contained_type & operator*() const noexcept
Definition onnxruntime_cxx_api.h:741
contained_type * release()
Relinquishes ownership of the contained C object pointer The underlying object is not destroyed.
Definition onnxruntime_cxx_api.h:745
Base(const Base &)=delete
constexpr Base(contained_type *p) noexcept
Definition onnxruntime_cxx_api.h:725
Base & operator=(const Base &)=delete
Base & operator=(Base &&v) noexcept
Definition onnxruntime_cxx_api.h:734
contained_type * p_
Definition onnxruntime_cxx_api.h:752
~Base()
Definition onnxruntime_cxx_api.h:726
T contained_type
Definition onnxruntime_cxx_api.h:722
Definition onnxruntime_cxx_api.h:931
size_t GetByteSize() const
int64_t GetFileOffset() const
const std::basic_string< char > GetFilePath() const
Definition onnxruntime_cxx_api.h:3625
std::vector< ConstNode > GetNodes() const
std::vector< ConstValueInfo > GetInputs() const
ConstNode GetParentNode() const
int64_t GetOnnxIRVersion() const
std::basic_string< char > GetModelPath() const
Graph GetGraphView(const std::vector< ConstNode > &nodes) const
ModelMetadata GetModelMetadata() const
Wraps OrtApi::Graph_GetModelMetadata.
std::vector< ConstValueInfo > GetInitializers() const
std::string GetName() const
std::vector< ConstValueInfo > GetOutputs() const
std::vector< OperatorSet > GetOperatorSets() const
Definition onnxruntime_cxx_api.h:2862
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:3735
std::pair< int, int > GetSinceVersion() const
Wraps OrtEpApi::KernelDef_GetExecutionProvider.
const char * GetDomain() const
Wraps OrtEpApi::KernelDef_GetSinceVersion.
OrtMemType GetOutputMemType(size_t output_index) const
const char * GetExecutionProvider() const
Wraps OrtEpApi::KernelDef_GetInputMemType.
OrtMemType GetInputMemType(size_t input_index) const
Wraps OrtEpApi::KernelDef_GetOutputMemType.
const char * GetOperatorType() const
< Wraps OrtEpApi::KernelDef_GetOperatorType
Definition onnxruntime_cxx_api.h:3537
std::vector< ConstValueInfo > GetOutputs() const
std::vector< ConstValueInfo > GetImplicitInputs() const
int GetSinceVersion() const
std::string GetName() const
std::string GetDomain() const
std::vector< AttrNameSubgraph > GetSubgraphs() const
ConstGraphImpl< detail::Unowned< const OrtGraph > > GetGraph() const
std::string GetOperatorType() const
std::vector< ConstOpAttr > GetAttributes() const
std::vector< ConstValueInfo > GetInputs() const
Status GetAttributeByName(const std::string &name, ConstOpAttr &attr) const
std::string GetEpName() const
Definition onnxruntime_cxx_api.h:2931
std::string GetName() const
Status GetValue(R &out) const
Status GetTensorAttributeAsOrtValue(Value &) const
Status GetValueArray(std::vector< R > &out) const
OrtOpAttrType GetType() const
Definition onnxruntime_cxx_api.h:1293
int64_t GetTimestampUs() const
Get the start timestamp in microseconds. Wraps OrtEpApi::ProfilingEvent_GetTimestampUs.
const char * GetName() const
Get the event name. Wraps OrtEpApi::ProfilingEvent_GetName.
const char * GetArgValue(const char *key) const
Get the value of an event argument by key. Wraps OrtEpApi::ProfilingEvent_GetArgValue.
int64_t GetDurationUs() const
Get the duration in microseconds. Wraps OrtEpApi::ProfilingEvent_GetDurationUs.
OrtProfilingEventCategory GetCategory() const
Get the event category. Wraps OrtEpApi::ProfilingEvent_GetCategory.
Definition onnxruntime_cxx_api.h:1975
std::vector< std::string > GetOutputNames() const
TypeInfo GetInputTypeInfo(size_t index) const
Wraps OrtApi::SessionGetInputTypeInfo.
std::vector< ConstEpAssignedSubgraph > GetEpGraphAssignmentInfo() const
Returns information on the subgraph/nodes assigned to execution providers in the session.
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< ConstEpDevice > GetEpDeviceForOutputs() const
Wrapper for OrtApi::SessionGetEpDeviceForOutputs.
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.
std::vector< ConstEpDevice > GetEpDeviceForInputs() const
Wrapper for OrtApi::SessionGetEpDeviceForInputs.
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.
std::vector< ConstMemoryInfo > GetMemoryInfoForOutputs() const
Wrapper for OrtApi::SessionGetMemoryInfoForOutputs.
AllocatedStringPtr GetInputNameAllocated(size_t index, OrtAllocator *allocator) const
Returns a copy of input name at the specified index.
std::vector< ConstMemoryInfo > GetMemoryInfoForInputs() const
Wrapper for OrtApi::SessionGetMemoryInfoForInputs.
std::vector< ValueInfo > GetInputs() const
TypeInfo GetOverridableInitializerTypeInfo(size_t index) const
Wraps OrtApi::SessionGetOverridableInitializerTypeInfo.
Definition onnxruntime_cxx_api.h:2355
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.
size_t GetTensorSizeInBytes() const
Returns the total size of the tensor data in bytes. Throws an exception if the OrtValue does not cont...
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....
void GetTensorElementTypeAndShapeDataReference(ONNXTensorElementDataType &elem_type, Shape &shape) const
Returns the tensor's element type and a reference to the tensor's internal shape data....
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:3480
Status GetInitializer(ConstValue &value) const
< A wrapper around OrtApi::ValueInfo_GetInitializerValue
std::string GetName() const
< A wrapper around OrtApi::GetValueInfoName
bool IsFromOuterScope() const
< A wrapper around OrtApi::ValueInfo_IsFromOuterScope
Status GetExternalInitializerInfo(ExternalInitializerInfo &info) const
< A wrapper around OrtApi::ValueInfo_GetExternalInitializerInfo
bool IsConstantInitializer() const
< A wrapper around OrtApi::ValueInfo_IsConstantInitializer
std::vector< ValueInfoConsumerProducerInfo > GetConsumers() const
< A wrapper around OrtApi::ValueInfo_GetValueConsumers
bool IsGraphOutput() const
< A wrapper around OrtApi::ValueInfo_IsGraphOutput
bool IsRequiredGraphInput() const
< A wrapper around OrtApi::ValueInfo_IsRequiredGraphInput
ConstTypeInfo TypeInfo() const
< A wrapper around OrtApi::GetValueInfoTypeInfo
ValueInfoConsumerProducerInfo GetProducerNode() const
bool IsOptionalGraphInput() const
< A wrapper around OrtApi::ValueInfo_IsOptionalGraphInput
Definition onnxruntime_cxx_api.h:1158
uint32_t GetReasonsBitmask() const
Wraps DeviceEpIncompatibilityDetails_GetReasonsBitmask.
const char * GetNotes() const
Wraps DeviceEpIncompatibilityDetails_GetNotes.
int32_t GetErrorCode() const
Wraps DeviceEpIncompatibilityDetails_GetErrorCode.
Definition onnxruntime_cxx_api.h:1260
std::string GetDomain() const
std::string GetOperatorType() const
std::string GetName() const
Definition onnxruntime_cxx_api.h:1277
std::vector< ConstEpAssignedNode > GetNodes() const
std::string GetEpName() const
Definition onnxruntime_cxx_api.h:1179
const char * EpName() const
const char * EpVendor() const
ConstKeyValuePairs EpOptions() const
ConstHardwareDevice Device() const
ConstMemoryInfo GetMemoryInfo(OrtDeviceMemoryType memory_type) const
Wraps EpDevice_MemoryInfo.
SyncStream CreateSyncStream(ConstKeyValuePairs stream_options={}) const
ConstKeyValuePairs EpMetadata() const
Definition onnxruntime_cxx_api.h:3654
void SetInputs(std::vector< ValueInfo > &inputs)
void SetOutputs(std::vector< ValueInfo > &outputs)
void AddInitializer(const std::string &name, Value &initializer, bool data_is_external)
Definition onnxruntime_cxx_api.h:1139
uint32_t DeviceId() const
OrtHardwareDeviceType Type() const
const char * Vendor() const
ConstKeyValuePairs Metadata() const
uint32_t VendorId() const
Definition onnxruntime_cxx_api.h:2873
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:971
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:2262
ONNXTensorElementDataType GetMapKeyType() const
Wraps OrtApi::GetMapKeyType.
TypeInfo GetMapValueType() const
Wraps OrtApi::GetMapValueType.
Definition onnxruntime_cxx_api.h:1010
std::string GetAllocatorName() const
Wrapper MemoryInfoGetName.
int GetDeviceId() const
Wrapper MemoryInfoGetId.
OrtMemType GetMemoryType() const
Wrapper MemoryInfoGetMemType.
OrtDeviceMemoryType GetDeviceMemoryType() const
Wrapper MemoryInfoGetDeviceMemType.
OrtMemoryInfoDeviceType GetDeviceType() const
Wrapper MemoryInfoGetDeviceType.
OrtAllocatorType GetAllocatorType() const
Wrapper MemoryInfoGetType.
uint32_t GetVendorId() const
Wrapper MemoryInfoGetVendorId.
bool operator==(const MemoryInfoImpl< U > &o) const
Definition onnxruntime_cxx_api.h:3702
void AddGraph(Graph &graph)
Definition onnxruntime_cxx_api.h:3844
std::string GetInputName(size_t index) const
int GetSinceVersion() const
< Wraps OrtEpApi::OpSchema_GetSinceVersion
size_t GetNumOutputs() const
Wraps OrtEpApi::OpSchema_GetOutputName.
ConstOpSchemaTypeConstraint GetOutputTypeConstraint(size_t index) const
Wraps OrtEpApi::OpSchema_GetTypeConstraintCount.
size_t GetTypeConstraintCount() const
Wraps OrtEpApi::OpSchema_GetTypeConstraint. Returns the i-th type constraint.
ConstOpSchemaTypeConstraint GetInputTypeConstraint(size_t index) const
Wraps OrtEpApi::OpSchema_GetNumOutputs.
size_t GetNumInputs() const
Wraps OrtEpApi::OpSchema_GetInputName.
std::string GetOutputName(size_t index) const
ConstOpSchemaTypeConstraint GetTypeConstraint(size_t index) const
Definition onnxruntime_cxx_api.h:3819
std::vector< size_t > GetOutputIndices() const
std::vector< size_t > GetInputIndices() const
Wraps OrtEpApi::OpSchemaTypeConstraint_GetOutputIndices.
std::vector< std::string > GetAllowedTypes() const
Wraps OrtEpApi::OpSchemaTypeConstraint_GetInputIndices.
std::string GetTypeParamName() const
< Wraps OrtEpApi::OpSchemaTypeConstraint_GetTypeParamName
Definition onnxruntime_cxx_api.h:2249
TypeInfo GetOptionalElementType() const
Wraps OrtApi::CastOptionalTypeToContainedTypeInfo.
Definition onnxruntime_cxx_api.h:2338
const char ** str
Definition onnxruntime_cxx_api.h:2343
const int64_t * values_shape
Definition onnxruntime_cxx_api.h:2339
size_t values_shape_len
Definition onnxruntime_cxx_api.h:2340
const void * p_data
Definition onnxruntime_cxx_api.h:2342
Definition onnxruntime_cxx_api.h:1362
Ort::Status AddEvents(const std::vector< ProfilingEvent > &events)
Ort::Status AddEvents(const OrtProfilingEvent *const *events, size_t num_events)
Adds profiling events to this container. Events are copied. Wraps OrtEpApi::ProfilingEventsContainer_...
Definition onnxruntime_cxx_api.h:2225
TypeInfo GetSequenceElementType() const
Wraps OrtApi::GetSequenceElementType.
Definition onnxruntime_cxx_api.h:2039
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 ReleaseCapturedGraph(int graph_annotation_id)
Release a previously captured graph.
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:2349
const int64_t * shape
Definition onnxruntime_cxx_api.h:2350
size_t shape_len
Definition onnxruntime_cxx_api.h:2351
Definition onnxruntime_cxx_api.h:3894
Status StoreWeightData(void **buffer_data_ptrs, size_t *buffer_sizes, size_t num_buffers)
Definition onnxruntime_cxx_api.h:1120
void * GetHandle()
Wraps SyncStream_GetHandle.
Definition onnxruntime_cxx_api.h:2170
size_t GetElementCount() const
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.
bool HasShape() const
Wraps OrtApi::TensorTypeAndShape_HasShape.
Definition onnxruntime_cxx_api.h:2287
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:697
T Type
Definition onnxruntime_cxx_api.h:698
Definition onnxruntime_cxx_api.h:2541
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...
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 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
const OrtModelPackageApi *(* GetModelPackageApi)(void)
Get the stable model package API table.
Definition onnxruntime_c_api.h:7708
const OrtEpApi *(* GetEpApi)(void)
Get the OrtEpApi instance for implementing an execution provider.
Definition onnxruntime_c_api.h:5855
const OrtInteropApi *(* GetInteropApi)(void)
Get the EP Interop API instance.
Definition onnxruntime_c_api.h:7112
const OrtCompileApi *(* GetCompileApi)(void)
Get the Compile API instance.
Definition onnxruntime_c_api.h:5587
void(* ReleaseTensorRTProviderOptions)(OrtTensorRTProviderOptionsV2 *input)
Release an OrtTensorRTProviderOptionsV2.
Definition onnxruntime_c_api.h:3634
const OrtModelEditorApi *(* GetModelEditorApi)(void)
Get the Model Editor API instance.
Definition onnxruntime_c_api.h:5529
void(* ReleaseCUDAProviderOptions)(OrtCUDAProviderOptionsV2 *input)
Release an OrtCUDAProviderOptionsV2.
Definition onnxruntime_c_api.h:4137
CUDA Provider Options.
Definition onnxruntime_c_api.h:704
The OrtCompileApi struct provides functions to compile ONNX models.
Definition onnxruntime_c_api.h:8290
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
The OrtEpApi struct provides functions that are relevant to the implementation of an execution provid...
Definition onnxruntime_ep_c_api.h:1021
The OrtEpFactory provides functions to create and manage execution providers.
Definition onnxruntime_ep_c_api.h:2842
The OrtEp struct provides functions to implement for an execution provider.
Definition onnxruntime_ep_c_api.h:2220
The OrtInteropApi struct provides functions for external resource interop with execution providers.
Definition onnxruntime_c_api.h:8686
MIGraphX Provider Options.
Definition onnxruntime_c_api.h:908
The OrtModelEditorApi struct provides functions to create or edit an ONNX model.
Definition onnxruntime_c_api.h:7837
Stable API table for model package workflows.
Definition onnxruntime_c_api.h:8931
OpenVINO Provider Options.
Definition onnxruntime_c_api.h:947
ROCM Provider Options.
Definition onnxruntime_c_api.h:791
TensorRT Provider Options.
Definition onnxruntime_c_api.h:880
Configuration for thread pool work callbacks.
Definition onnxruntime_c_api.h:1100