26#include "onnxruntime_c_api.h"
34#include <unordered_map>
38#ifdef ORT_NO_EXCEPTIONS
55 const char*
what() const noexcept
override {
return message_.c_str(); }
62#ifdef ORT_NO_EXCEPTIONS
65#ifndef ORT_CXX_API_THROW
66#define ORT_CXX_API_THROW(string, code) \
68 std::cerr << Ort::Exception(string, code) \
75#define ORT_CXX_API_THROW(string, code) \
76 throw Ort::Exception(string, code)
89#ifdef ORT_API_MANUAL_INIT
109#if defined(_MSC_VER) && !defined(__clang__)
113#pragma warning(disable : 26426)
116#if defined(_MSC_VER) && !defined(__clang__)
187 constexpr operator uint16_t() const noexcept {
return value; }
192static_assert(
sizeof(Float16_t) ==
sizeof(uint16_t),
"Sizes must match");
206 constexpr operator uint16_t() const noexcept {
return value; }
211static_assert(
sizeof(BFloat16_t) ==
sizeof(uint16_t),
"Sizes must match");
222 constexpr operator uint8_t() const noexcept {
return value; }
228static_assert(
sizeof(Float8E4M3FN_t) ==
sizeof(uint8_t),
"Sizes must match");
239 constexpr operator uint8_t() const noexcept {
return value; }
245static_assert(
sizeof(Float8E4M3FNUZ_t) ==
sizeof(uint8_t),
"Sizes must match");
256 constexpr operator uint8_t() const noexcept {
return value; }
262static_assert(
sizeof(Float8E5M2_t) ==
sizeof(uint8_t),
"Sizes must match");
273 constexpr operator uint8_t() const noexcept {
return value; }
279static_assert(
sizeof(Float8E5M2FNUZ_t) ==
sizeof(uint8_t),
"Sizes must match");
284#define ORT_DEFINE_RELEASE(NAME) \
285 inline void OrtRelease(Ort##NAME* ptr) { GetApi().Release##NAME(ptr); }
305ORT_DEFINE_RELEASE(
Op);
308#undef ORT_DEFINE_RELEASE
417struct AllocatorWithDefaultOptions;
434 explicit Status(std::nullptr_t)
noexcept {}
437 explicit Status(
const std::exception&)
noexcept;
480 explicit Env(std::nullptr_t) {}
597 std::unordered_map<std::string, std::string> flat_configs_;
671 const std::unordered_map<std::string, std::string>& provider_options = {});
841 std::vector<Value>
Run(
const RunOptions& run_options,
const char*
const* input_names,
const Value* input_values,
size_t input_count,
842 const char*
const* output_names,
size_t output_count);
847 void Run(
const RunOptions& run_options,
const char*
const* input_names,
const Value* input_values,
size_t input_count,
848 const char*
const* output_names,
Value* output_values,
size_t output_count);
894 template <
typename U>
928 [[deprecated(
"use GetShape()")]]
void GetDimensions(int64_t* values,
size_t values_count)
const;
1005template <
typename T>
1061template <
typename T>
1069 template <
typename R>
1108 template <
typename R>
1165#if !defined(DISABLE_SPARSE_TENSORS)
1199 template <
typename R>
1216 template <
typename R>
1222template <
typename T>
1232 template <
typename R>
1248 template <
typename R>
1249 R&
At(
const std::vector<int64_t>& location);
1279#if !defined(DISABLE_SPARSE_TENSORS)
1300 void UseCsrIndices(int64_t* inner_data,
size_t inner_num, int64_t* outer_data,
size_t outer_num);
1322 const int64_t* indices_data,
size_t indices_num);
1337 const int64_t* inner_indices_data,
size_t inner_indices_num,
1338 const int64_t* outer_indices_data,
size_t outer_indices_num);
1351 const Shape& indices_shape,
1352 const int32_t* indices_data);
1386 template <
typename T>
1412 template <
typename T>
1455 template <
typename T>
1458#if !defined(DISABLE_SPARSE_TENSORS)
1469 template <
typename T>
1471 const Shape& values_shape);
1501 template <
typename T>
1534 void* get() {
return p_; }
1535 size_t size()
const {
return size_; }
1544template <
typename T>
1576namespace binding_utils {
1582template <
typename T>
1593template <
typename T>
1636 ArenaCfg(
size_t max_mem,
int arena_extend_strategy,
int initial_chunk_size_bytes,
int max_dead_bytes_per_chunk);
1658#define ORT_CXX_LOG(logger, message_severity, message) \
1660 if (message_severity >= logger.GetLoggingSeverityLevel()) { \
1661 Ort::ThrowOnError(logger.LogMessage(message_severity, ORT_FILE, __LINE__, \
1662 static_cast<const char*>(__FUNCTION__), message)); \
1674#define ORT_CXX_LOG_NOEXCEPT(logger, message_severity, message) \
1676 if (message_severity >= logger.GetLoggingSeverityLevel()) { \
1677 static_cast<void>(logger.LogMessage(message_severity, ORT_FILE, __LINE__, \
1678 static_cast<const char*>(__FUNCTION__), message)); \
1693#define ORT_CXX_LOGF(logger, message_severity, ...) \
1695 if (message_severity >= logger.GetLoggingSeverityLevel()) { \
1696 Ort::ThrowOnError(logger.LogFormattedMessage(message_severity, ORT_FILE, __LINE__, \
1697 static_cast<const char*>(__FUNCTION__), __VA_ARGS__)); \
1712#define ORT_CXX_LOGF_NOEXCEPT(logger, message_severity, ...) \
1714 if (message_severity >= logger.GetLoggingSeverityLevel()) { \
1715 static_cast<void>(logger.LogFormattedMessage(message_severity, ORT_FILE, __LINE__, \
1716 static_cast<const char*>(__FUNCTION__), __VA_ARGS__)); \
1777 const
char* func_name, const
char* message) const noexcept;
1793 template <typename... Args>
1795 const
char* func_name, const
char* format, Args&&... args) const noexcept;
1826namespace attr_utils {
1834template <
typename T>
1841 template <
typename R>
1844 attr_utils::GetAttr(this->p_, name, val);
1848 template <
typename R>
1850 std::vector<R> result;
1851 attr_utils::GetAttrs(this->p_, name, result);
1892 explicit Op(std::nullptr_t) {}
1897 int version,
const char** type_constraint_names,
1899 size_t type_constraint_count,
1900 const OpAttr* attr_values,
1902 size_t input_count,
size_t output_count);
1905 const Value* input_values,
1907 Value* output_values,
1908 size_t output_count);
1912 const OrtValue*
const* input_values,
1915 size_t output_count);
1918template <
typename TOp,
typename TKernel,
bool WithStatus = false>
1933#if defined(_MSC_VER) && !defined(__clang__)
1934#pragma warning(push)
1935#pragma warning(disable : 26409)
1938#if defined(_MSC_VER) && !defined(__clang__)
1948 if constexpr (WithStatus) {
1950 return static_cast<const TOp*
>(this_)->CreateKernelV2(*api, info, op_kernel);
1953 return static_cast<TKernel*
>(op_kernel)->ComputeV2(context);
1961 static_cast<TKernel*
>(op_kernel)->Compute(context);
1972 return OrtCustomOpInputOutputCharacteristic::INPUT_OUTPUT_REQUIRED;
1976 return OrtCustomOpInputOutputCharacteristic::INPUT_OUTPUT_REQUIRED;
2012 return std::vector<std::string>{};
2022#include "onnxruntime_cxx_inline.h"
struct OrtMemoryInfo OrtMemoryInfo
Definition: onnxruntime_c_api.h:278
struct OrtKernelInfo OrtKernelInfo
Definition: onnxruntime_c_api.h:357
OrtLoggingLevel
Logging severity levels.
Definition: onnxruntime_c_api.h:233
OrtMemoryInfoDeviceType
This mimics OrtDevice type constants so they can be returned in the API.
Definition: onnxruntime_c_api.h:381
void(* OrtLoggingFunction)(void *param, OrtLoggingLevel severity, const char *category, const char *logid, const char *code_location, const char *message)
Definition: onnxruntime_c_api.h:322
void(* OrtCustomJoinThreadFn)(OrtCustomThreadHandle ort_custom_thread_handle)
Custom thread join function.
Definition: onnxruntime_c_api.h:695
OrtCustomOpInputOutputCharacteristic
Definition: onnxruntime_c_api.h:4336
struct OrtTensorRTProviderOptionsV2 OrtTensorRTProviderOptionsV2
Definition: onnxruntime_c_api.h:295
struct OrtThreadingOptions OrtThreadingOptions
Definition: onnxruntime_c_api.h:292
struct OrtSequenceTypeInfo OrtSequenceTypeInfo
Definition: onnxruntime_c_api.h:286
struct OrtDnnlProviderOptions OrtDnnlProviderOptions
Definition: onnxruntime_c_api.h:298
OrtSparseIndicesFormat
Definition: onnxruntime_c_api.h:222
struct OrtPrepackedWeightsContainer OrtPrepackedWeightsContainer
Definition: onnxruntime_c_api.h:294
struct OrtCustomOpDomain OrtCustomOpDomain
Definition: onnxruntime_c_api.h:289
struct OrtIoBinding OrtIoBinding
Definition: onnxruntime_c_api.h:279
OrtAllocatorType
Definition: onnxruntime_c_api.h:363
struct OrtOp OrtOp
Definition: onnxruntime_c_api.h:299
struct OrtModelMetadata OrtModelMetadata
Definition: onnxruntime_c_api.h:290
struct OrtTypeInfo OrtTypeInfo
Definition: onnxruntime_c_api.h:283
struct OrtTensorTypeAndShapeInfo OrtTensorTypeAndShapeInfo
Definition: onnxruntime_c_api.h:284
struct OrtCUDAProviderOptionsV2 OrtCUDAProviderOptionsV2
Definition: onnxruntime_c_api.h:296
struct OrtKernelContext OrtKernelContext
Definition: onnxruntime_c_api.h:359
struct OrtCANNProviderOptions OrtCANNProviderOptions
Definition: onnxruntime_c_api.h:297
struct OrtSessionOptions OrtSessionOptions
Definition: onnxruntime_c_api.h:288
struct OrtValue OrtValue
Definition: onnxruntime_c_api.h:281
GraphOptimizationLevel
Graph optimization level.
Definition: onnxruntime_c_api.h:331
OrtStatus * OrtStatusPtr
Definition: onnxruntime_c_api.h:306
OrtMemType
Memory types for allocated memory, execution provider specific types should be extended in each provi...
Definition: onnxruntime_c_api.h:372
OrtSparseFormat
Definition: onnxruntime_c_api.h:214
ONNXType
Definition: onnxruntime_c_api.h:202
struct OrtEnv OrtEnv
Definition: onnxruntime_c_api.h:276
OrtErrorCode
Definition: onnxruntime_c_api.h:241
struct OrtStatus OrtStatus
Definition: onnxruntime_c_api.h:277
#define ORT_API_VERSION
The API version defined in this header.
Definition: onnxruntime_c_api.h:40
struct OrtLogger OrtLogger
Definition: onnxruntime_c_api.h:301
struct OrtMapTypeInfo OrtMapTypeInfo
Definition: onnxruntime_c_api.h:285
struct OrtArenaCfg OrtArenaCfg
Definition: onnxruntime_c_api.h:293
ExecutionMode
Definition: onnxruntime_c_api.h:338
OrtOpAttrType
Definition: onnxruntime_c_api.h:256
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:688
ONNXTensorElementDataType
Definition: onnxruntime_c_api.h:176
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:236
@ OrtMemTypeDefault
The default allocator for execution provider.
Definition: onnxruntime_c_api.h:376
void GetAttr(const OrtKernelInfo *p, const char *name, float &)
void GetAttrs(const OrtKernelInfo *p, const char *name, std::vector< float > &)
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:287
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:45
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:427
const OrtApi & GetApi() noexcept
This returns a reference to the OrtApi interface in use.
Definition: onnxruntime_cxx_api.h:122
std::string GetBuildInfoString()
This function returns the onnxruntime build information: including git branch, git commit id,...
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...
Wrapper around OrtAllocator.
Definition: onnxruntime_cxx_api.h:1568
Allocator(const Session &session, const OrtMemoryInfo *)
Allocator(std::nullptr_t)
Convenience to create a class member and then replace with an instance.
Definition: onnxruntime_cxx_api.h:1569
Wrapper around OrtAllocator default instance that is owned by Onnxruntime.
Definition: onnxruntime_cxx_api.h:1560
AllocatorWithDefaultOptions(std::nullptr_t)
Convenience to create a class member and then replace with an instance.
Definition: onnxruntime_cxx_api.h:1561
AllocatorWithDefaultOptions()
it is a structure that represents the configuration of an arena based allocator
Definition: onnxruntime_cxx_api.h:1626
ArenaCfg(std::nullptr_t)
Create an empty ArenaCfg object, must be assigned a valid one to be used.
Definition: onnxruntime_cxx_api.h:1627
ArenaCfg(size_t max_mem, int arena_extend_strategy, int initial_chunk_size_bytes, int max_dead_bytes_per_chunk)
bfloat16 (Brain Floating Point) data type
Definition: onnxruntime_cxx_api.h:202
uint16_t value
Definition: onnxruntime_cxx_api.h:203
constexpr bool operator!=(const BFloat16_t &rhs) const noexcept
Definition: onnxruntime_cxx_api.h:208
constexpr BFloat16_t(uint16_t v) noexcept
Definition: onnxruntime_cxx_api.h:205
constexpr bool operator==(const BFloat16_t &rhs) const noexcept
Definition: onnxruntime_cxx_api.h:207
constexpr BFloat16_t() noexcept
Definition: onnxruntime_cxx_api.h:204
Definition: onnxruntime_cxx_api.h:1919
OrtCustomOpInputOutputCharacteristic GetOutputCharacteristic(size_t) const
Definition: onnxruntime_cxx_api.h:1975
OrtCustomOpInputOutputCharacteristic GetInputCharacteristic(size_t) const
Definition: onnxruntime_cxx_api.h:1971
OrtMemType GetInputMemoryType(size_t) const
Definition: onnxruntime_cxx_api.h:1980
std::vector< std::string > GetSessionConfigKeys() const
Definition: onnxruntime_cxx_api.h:2011
bool GetVariadicInputHomogeneity() const
Definition: onnxruntime_cxx_api.h:1992
int GetVariadicInputMinArity() const
Definition: onnxruntime_cxx_api.h:1986
CustomOpBase()
Definition: onnxruntime_cxx_api.h:1920
bool GetVariadicOutputHomogeneity() const
Definition: onnxruntime_cxx_api.h:2004
int GetVariadicOutputMinArity() const
Definition: onnxruntime_cxx_api.h:1998
const char * GetExecutionProviderType() const
Definition: onnxruntime_cxx_api.h:1967
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:568
~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:511
CustomOpDomain(std::nullptr_t)
Create an empty CustomOpDomain object, must be assigned a valid one to be used.
Definition: onnxruntime_cxx_api.h:512
CustomOpDomain(const char *domain)
Wraps OrtApi::CreateCustomOpDomain.
void Add(const OrtCustomOp *op)
Wraps CustomOpDomain_Add.
The Env (Environment)
Definition: onnxruntime_cxx_api.h:479
Env & EnableTelemetryEvents()
Wraps OrtApi::EnableTelemetryEvents.
Env(OrtEnv *p)
C Interop Helper.
Definition: onnxruntime_cxx_api.h:496
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(std::nullptr_t)
Create an empty Env object, must be assigned a valid one to be used.
Definition: onnxruntime_cxx_api.h:480
Env(OrtLoggingLevel logging_level=ORT_LOGGING_LEVEL_WARNING, const char *logid="")
Wraps OrtApi::CreateEnv.
Env(const OrtThreadingOptions *tp_options, OrtLoggingLevel logging_level=ORT_LOGGING_LEVEL_WARNING, const char *logid="")
Wraps OrtApi::CreateEnvWithGlobalThreadPools.
Env(const OrtThreadingOptions *tp_options, OrtLoggingFunction logging_function, void *logger_param, OrtLoggingLevel logging_level=ORT_LOGGING_LEVEL_WARNING, const char *logid="")
Wraps OrtApi::CreateEnvWithCustomLoggerAndGlobalThreadPools.
Env(OrtLoggingLevel logging_level, const char *logid, OrtLoggingFunction logging_function, void *logger_param)
Wraps OrtApi::CreateEnvWithCustomLogger.
Env & CreateAndRegisterAllocator(const OrtMemoryInfo *mem_info, const OrtArenaCfg *arena_cfg)
Wraps OrtApi::CreateAndRegisterAllocator.
Env & UpdateEnvWithCustomLogLevel(OrtLoggingLevel log_severity_level)
Wraps OrtApi::UpdateEnvWithCustomLogLevel.
Env & DisableTelemetryEvents()
Wraps OrtApi::DisableTelemetryEvents.
All C++ methods that can fail will throw an exception of this type.
Definition: onnxruntime_cxx_api.h:51
const char * what() const noexcept override
Definition: onnxruntime_cxx_api.h:55
OrtErrorCode GetOrtErrorCode() const
Definition: onnxruntime_cxx_api.h:54
Exception(std::string &&string, OrtErrorCode code)
Definition: onnxruntime_cxx_api.h:52
IEEE 754 half-precision floating point data type.
Definition: onnxruntime_cxx_api.h:183
constexpr bool operator!=(const Float16_t &rhs) const noexcept
Definition: onnxruntime_cxx_api.h:189
constexpr Float16_t(uint16_t v) noexcept
Definition: onnxruntime_cxx_api.h:186
uint16_t value
Definition: onnxruntime_cxx_api.h:184
constexpr bool operator==(const Float16_t &rhs) const noexcept
Definition: onnxruntime_cxx_api.h:188
constexpr Float16_t() noexcept
Definition: onnxruntime_cxx_api.h:185
float8e4m3fn (Float8 Floating Point) data type
Definition: onnxruntime_cxx_api.h:218
uint8_t value
Definition: onnxruntime_cxx_api.h:219
constexpr Float8E4M3FN_t(uint8_t v) noexcept
Definition: onnxruntime_cxx_api.h:221
constexpr bool operator==(const Float8E4M3FN_t &rhs) const noexcept
Definition: onnxruntime_cxx_api.h:224
constexpr Float8E4M3FN_t() noexcept
Definition: onnxruntime_cxx_api.h:220
constexpr bool operator!=(const Float8E4M3FN_t &rhs) const noexcept
Definition: onnxruntime_cxx_api.h:225
float8e4m3fnuz (Float8 Floating Point) data type
Definition: onnxruntime_cxx_api.h:235
constexpr bool operator==(const Float8E4M3FNUZ_t &rhs) const noexcept
Definition: onnxruntime_cxx_api.h:241
uint8_t value
Definition: onnxruntime_cxx_api.h:236
constexpr Float8E4M3FNUZ_t() noexcept
Definition: onnxruntime_cxx_api.h:237
constexpr bool operator!=(const Float8E4M3FNUZ_t &rhs) const noexcept
Definition: onnxruntime_cxx_api.h:242
constexpr Float8E4M3FNUZ_t(uint8_t v) noexcept
Definition: onnxruntime_cxx_api.h:238
float8e5m2 (Float8 Floating Point) data type
Definition: onnxruntime_cxx_api.h:252
constexpr Float8E5M2_t(uint8_t v) noexcept
Definition: onnxruntime_cxx_api.h:255
uint8_t value
Definition: onnxruntime_cxx_api.h:253
constexpr bool operator!=(const Float8E5M2_t &rhs) const noexcept
Definition: onnxruntime_cxx_api.h:259
constexpr Float8E5M2_t() noexcept
Definition: onnxruntime_cxx_api.h:254
constexpr bool operator==(const Float8E5M2_t &rhs) const noexcept
Definition: onnxruntime_cxx_api.h:258
float8e5m2fnuz (Float8 Floating Point) data type
Definition: onnxruntime_cxx_api.h:269
constexpr Float8E5M2FNUZ_t() noexcept
Definition: onnxruntime_cxx_api.h:271
constexpr Float8E5M2FNUZ_t(uint8_t v) noexcept
Definition: onnxruntime_cxx_api.h:272
constexpr bool operator!=(const Float8E5M2FNUZ_t &rhs) const noexcept
Definition: onnxruntime_cxx_api.h:276
constexpr bool operator==(const Float8E5M2FNUZ_t &rhs) const noexcept
Definition: onnxruntime_cxx_api.h:275
uint8_t value
Definition: onnxruntime_cxx_api.h:270
Definition: onnxruntime_cxx_api.h:83
static const OrtApi * api_
Definition: onnxruntime_cxx_api.h:84
Wrapper around OrtIoBinding.
Definition: onnxruntime_cxx_api.h:1615
UnownedIoBinding GetUnowned() const
Definition: onnxruntime_cxx_api.h:1619
ConstIoBinding GetConst() const
Definition: onnxruntime_cxx_api.h:1618
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:1616
This class wraps a raw pointer OrtKernelContext* that is being passed to the custom kernel Compute() ...
Definition: onnxruntime_cxx_api.h:1808
KernelContext(OrtKernelContext *context)
ConstValue GetInput(size_t index) const
OrtAllocator * GetAllocator(const OrtMemoryInfo &memory_info) const
void * GetGPUComputeStream() const
size_t GetInputCount() const
size_t GetOutputCount() const
UnownedValue GetOutput(size_t index, const std::vector< int64_t > &dims) const
UnownedValue GetOutput(size_t index, const int64_t *dim_values, size_t dim_count) const
This struct owns the OrtKernInfo* pointer when a copy is made. For convenient wrapping of OrtKernelIn...
Definition: onnxruntime_cxx_api.h:1882
KernelInfo(OrtKernelInfo *info)
Take ownership of the instance.
ConstKernelInfo GetConst() const
Definition: onnxruntime_cxx_api.h:1885
KernelInfo(std::nullptr_t)
Create an empty instance to initialize later.
Definition: onnxruntime_cxx_api.h:1883
This class represents an ONNX Runtime logger that can be used to log information with an associated s...
Definition: onnxruntime_cxx_api.h:1730
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:1739
Logger(const OrtLogger *logger)
OrtLoggingLevel GetLoggingSeverityLevel() const noexcept
Wrapper around OrtMapTypeInfo.
Definition: onnxruntime_cxx_api.h:998
ConstMapTypeInfo GetConst() const
Definition: onnxruntime_cxx_api.h:1001
MapTypeInfo(OrtMapTypeInfo *p)
Used for interop with the C API.
Definition: onnxruntime_cxx_api.h:1000
MapTypeInfo(std::nullptr_t)
Create an empty MapTypeInfo object, must be assigned a valid one to be used.
Definition: onnxruntime_cxx_api.h:999
Represents native memory allocation coming from one of the OrtAllocators registered with OnnxRuntime....
Definition: onnxruntime_cxx_api.h:1526
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:1535
Wrapper around OrtMemoryInfo.
Definition: onnxruntime_cxx_api.h:905
MemoryInfo(const char *name, OrtAllocatorType type, int id, OrtMemType mem_type)
MemoryInfo(std::nullptr_t)
No instance is created.
Definition: onnxruntime_cxx_api.h:907
MemoryInfo(OrtMemoryInfo *p)
Take ownership of a pointer created by C Api.
Definition: onnxruntime_cxx_api.h:908
static MemoryInfo CreateCpu(OrtAllocatorType type, OrtMemType mem_type1)
ConstMemoryInfo GetConst() const
Definition: onnxruntime_cxx_api.h:910
This struct provides life time management for custom op attribute.
Definition: onnxruntime_cxx_api.h:1646
OpAttr(const char *name, const void *data, int len, OrtOpAttrType type)
Create and own custom defined operation.
Definition: onnxruntime_cxx_api.h:1891
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:1892
void Invoke(const OrtKernelContext *context, const OrtValue *const *input_values, size_t input_count, OrtValue *const *output_values, size_t output_count)
void Invoke(const OrtKernelContext *context, const Value *input_values, size_t input_count, Value *output_values, size_t output_count)
RunOptions.
Definition: onnxruntime_cxx_api.h:524
int GetRunLogSeverityLevel() const
Wraps OrtApi::RunOptionsGetRunLogSeverityLevel.
RunOptions & SetTerminate()
Terminates all currently executing Session::Run calls that were made using this RunOptions instance.
RunOptions & SetRunTag(const char *run_tag)
wraps OrtApi::RunOptionsSetRunTag
RunOptions & 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:525
RunOptions & SetRunLogVerbosityLevel(int)
Wraps OrtApi::RunOptionsSetRunLogVerbosityLevel.
RunOptions & SetRunLogSeverityLevel(int)
Wraps OrtApi::RunOptionsSetRunLogSeverityLevel.
RunOptions & AddConfigEntry(const char *config_key, const char *config_value)
Wraps OrtApi::AddRunConfigEntry.
const char * GetRunTag() const
Wraps OrtApi::RunOptionsGetRunTag.
RunOptions()
Wraps OrtApi::CreateRunOptions.
Wrapper around OrtSequenceTypeInfo.
Definition: onnxruntime_cxx_api.h:963
SequenceTypeInfo(std::nullptr_t)
Create an empty SequenceTypeInfo object, must be assigned a valid one to be used.
Definition: onnxruntime_cxx_api.h:964
ConstSequenceTypeInfo GetConst() const
Definition: onnxruntime_cxx_api.h:966
SequenceTypeInfo(OrtSequenceTypeInfo *p)
Used for interop with the C API.
Definition: onnxruntime_cxx_api.h:965
Wrapper around OrtSession.
Definition: onnxruntime_cxx_api.h:869
Session(std::nullptr_t)
Create an empty Session object, must be assigned a valid one to be used.
Definition: onnxruntime_cxx_api.h:870
UnownedSession GetUnowned() const
Definition: onnxruntime_cxx_api.h:879
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 char *model_path, const SessionOptions &options)
Wraps OrtApi::CreateSession.
ConstSession GetConst() const
Definition: onnxruntime_cxx_api.h:878
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:692
SessionOptions(std::nullptr_t)
Create an empty SessionOptions object, must be assigned a valid one to be used.
Definition: onnxruntime_cxx_api.h:693
UnownedSessionOptions GetUnowned() const
Definition: onnxruntime_cxx_api.h:696
SessionOptions()
Wraps OrtApi::CreateSessionOptions.
ConstSessionOptions GetConst() const
Definition: onnxruntime_cxx_api.h:697
SessionOptions(OrtSessionOptions *p)
Used for interop with the C API.
Definition: onnxruntime_cxx_api.h:695
The Status that holds ownership of OrtStatus received from C API Use it to safely destroy OrtStatus* ...
Definition: onnxruntime_cxx_api.h:433
OrtErrorCode GetErrorCode() const
Status(const char *message, OrtErrorCode code) noexcept
Creates status instance out of null-terminated string message.
bool IsOK() const noexcept
Returns true if instance represents an OK (non-error) status.
Status(OrtStatus *status) noexcept
Takes ownership of OrtStatus instance returned from the C API.
std::string GetErrorMessage() const
Status(const Exception &) noexcept
Creates status instance out of exception.
Status(const std::exception &) noexcept
Creates status instance out of exception.
Status(std::nullptr_t) noexcept
Create an empty object, must be assigned a valid one to be used.
Definition: onnxruntime_cxx_api.h:434
Wrapper around OrtTensorTypeAndShapeInfo.
Definition: onnxruntime_cxx_api.h:942
TensorTypeAndShapeInfo(std::nullptr_t)
Create an empty TensorTypeAndShapeInfo object, must be assigned a valid one to be used.
Definition: onnxruntime_cxx_api.h:943
ConstTensorTypeAndShapeInfo GetConst() const
Definition: onnxruntime_cxx_api.h:945
TensorTypeAndShapeInfo(OrtTensorTypeAndShapeInfo *p)
Used for interop with the C API.
Definition: onnxruntime_cxx_api.h:944
The ThreadingOptions.
Definition: onnxruntime_cxx_api.h:448
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:1029
TypeInfo(std::nullptr_t)
Create an empty TypeInfo object, must be assigned a valid one to be used.
Definition: onnxruntime_cxx_api.h:1030
ConstTypeInfo GetConst() const
Definition: onnxruntime_cxx_api.h:1033
TypeInfo(OrtTypeInfo *p)
C API Interop.
Definition: onnxruntime_cxx_api.h:1031
Wrapper around OrtValue.
Definition: onnxruntime_cxx_api.h:1365
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:1370
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.
Value(OrtValue *p)
Used for interop with the C API.
Definition: onnxruntime_cxx_api.h:1371
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:1376
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...
ConstValue GetConst() const
Definition: onnxruntime_cxx_api.h:1375
Definition: onnxruntime_cxx_api.h:406
AllocatedFree(OrtAllocator *allocator)
Definition: onnxruntime_cxx_api.h:408
OrtAllocator * allocator_
Definition: onnxruntime_cxx_api.h:407
void operator()(void *ptr) const
Definition: onnxruntime_cxx_api.h:410
Definition: onnxruntime_cxx_api.h:1545
ConstMemoryInfo GetInfo() const
void * Alloc(size_t size)
MemoryAllocation GetAllocation(size_t size)
Base & operator=(Base &&v) noexcept
Definition: onnxruntime_cxx_api.h:393
typename Unowned< T >::Type contained_type
Definition: onnxruntime_cxx_api.h:382
Base(Base &&v) noexcept
Definition: onnxruntime_cxx_api.h:392
Base(const Base &)=default
constexpr Base(contained_type *p) noexcept
Definition: onnxruntime_cxx_api.h:385
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:338
Base(Base &&v) noexcept
Definition: onnxruntime_cxx_api.h:348
contained_type * release()
Relinquishes ownership of the contained C object pointer The underlying object is not destroyed.
Definition: onnxruntime_cxx_api.h:359
Base(const Base &)=delete
constexpr Base(contained_type *p) noexcept
Definition: onnxruntime_cxx_api.h:342
Base & operator=(const Base &)=delete
Base & operator=(Base &&v) noexcept
Definition: onnxruntime_cxx_api.h:349
contained_type * p_
Definition: onnxruntime_cxx_api.h:366
~Base()
Definition: onnxruntime_cxx_api.h:343
T contained_type
Definition: onnxruntime_cxx_api.h:339
Definition: onnxruntime_cxx_api.h:1583
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:776
TypeInfo GetInputTypeInfo(size_t index) const
Wraps OrtApi::SessionGetInputTypeInfo.
size_t GetOutputCount() const
Returns the number of model outputs.
uint64_t GetProfilingStartTimeNs() const
Wraps OrtApi::SessionGetProfilingStartTimeNs.
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.
AllocatedStringPtr GetOverridableInitializerNameAllocated(size_t index, OrtAllocator *allocator) const
Returns a copy of the overridable initializer name at then specified index.
AllocatedStringPtr GetOutputNameAllocated(size_t index, OrtAllocator *allocator) const
Returns a copy of output name at then specified index.
size_t GetOverridableInitializerCount() const
Returns the number of inputs that have defaults that can be overridden.
AllocatedStringPtr GetInputNameAllocated(size_t index, OrtAllocator *allocator) const
Returns a copy of input name at the specified index.
TypeInfo GetOverridableInitializerTypeInfo(size_t index) const
Wraps OrtApi::SessionGetOverridableInitializerTypeInfo.
Definition: onnxruntime_cxx_api.h:611
std::string GetConfigEntry(const char *config_key) const
Wraps OrtApi::GetSessionConfigEntry.
std::string GetConfigEntryOrDefault(const char *config_key, const std::string &def)
SessionOptions Clone() const
Creates and returns a copy of this SessionOptions object. Wraps OrtApi::CloneSessionOptions.
bool HasConfigEntry(const char *config_key) const
Wraps OrtApi::HasSessionConfigEntry.
Definition: onnxruntime_cxx_api.h:1062
void GetStringTensorContent(void *buffer, size_t buffer_length, size_t *offsets, size_t offsets_count) const
The API copies all of the UTF-8 encoded string data contained within a tensor or a sparse tensor into...
void GetStringTensorElement(size_t buffer_length, size_t element_index, void *buffer) const
The API copies UTF-8 encoded bytes for the requested string element contained within a tensor or a sp...
TensorTypeAndShapeInfo GetSparseTensorIndicesTypeShapeInfo(OrtSparseIndicesFormat format) const
The API returns type and shape information for the specified indices. Each supported indices have the...
const void * GetTensorRawData() const
Returns a non-typed pointer to a tensor contained data.
std::string GetStringTensorElement(size_t element_index) const
Returns string tensor UTF-8 encoded string element. Use of this API is recommended over GetStringTens...
size_t GetStringTensorElementLength(size_t element_index) const
The API returns a byte length of UTF-8 encoded string element contained in either a tensor or a spare...
size_t GetStringTensorDataLength() const
This API returns a full length of string data contained within either a tensor or a sparse Tensor....
bool IsSparseTensor() const
Returns true if the OrtValue contains a sparse tensor.
TypeInfo GetTypeInfo() const
The API returns type information for data contained in a tensor. For sparse tensors it returns type i...
const R * GetSparseTensorIndicesData(OrtSparseIndicesFormat indices_format, size_t &num_indices) const
The API retrieves a pointer to the internal indices buffer. The API merely performs a convenience dat...
bool IsTensor() const
Returns true if Value is a tensor, false for other types like map/sequence/etc.
ConstMemoryInfo GetTensorMemoryInfo() const
This API returns information about the memory allocation used to hold data.
const R * GetSparseTensorValues() const
The API returns a pointer to an internal buffer of the sparse tensor containing non-zero values....
TensorTypeAndShapeInfo GetTensorTypeAndShapeInfo() const
The API returns type information for data contained in a tensor. For sparse tensors it returns type i...
Value GetValue(int index, OrtAllocator *allocator) const
size_t GetCount() const
< Return true if OrtValue contains data and returns false if the OrtValue is a None
void GetOpaqueData(const char *domain, const char *type_name, R &) const
Obtains a pointer to a user defined data for experimental purposes.
TensorTypeAndShapeInfo GetSparseTensorValuesTypeAndShapeInfo() const
The API returns type and shape information for stored non-zero values of the sparse tensor....
const R * GetTensorData() const
Returns a const typed pointer to the tensor contained data. No type checking is performed,...
OrtSparseFormat GetSparseFormat() const
The API returns the sparse data format this OrtValue holds in a sparse tensor. If the sparse tensor w...
Definition: onnxruntime_cxx_api.h:1594
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:1835
Value GetTensorAttribute(const char *name, OrtAllocator *allocator) const
TypeInfo GetInputTypeInfo(size_t index) const
std::vector< R > GetAttributes(const char *name) const
Definition: onnxruntime_cxx_api.h:1849
R GetAttribute(const char *name) const
Definition: onnxruntime_cxx_api.h:1842
TypeInfo GetOutputTypeInfo(size_t index) const
std::string GetNodeName() const
std::string GetInputName(size_t index) const
size_t GetOutputCount() const
size_t GetInputCount() const
ConstValue GetTensorConstantInput(size_t index, int *is_constant) const
std::string GetOutputName(size_t index) const
Definition: onnxruntime_cxx_api.h:984
ONNXTensorElementDataType GetMapKeyType() const
Wraps OrtApi::GetMapKeyType.
TypeInfo GetMapValueType() const
Wraps OrtApi::GetMapValueType.
Definition: onnxruntime_cxx_api.h:884
std::string GetAllocatorName() const
OrtMemType GetMemoryType() const
OrtMemoryInfoDeviceType GetDeviceType() const
OrtAllocatorType GetAllocatorType() const
bool operator==(const MemoryInfoImpl< U > &o) const
Definition: onnxruntime_cxx_api.h:971
TypeInfo GetOptionalElementType() const
Wraps OrtApi::CastOptionalTypeToContainedTypeInfo.
Definition: onnxruntime_cxx_api.h:1045
const char ** str
Definition: onnxruntime_cxx_api.h:1050
const int64_t * values_shape
Definition: onnxruntime_cxx_api.h:1046
size_t values_shape_len
Definition: onnxruntime_cxx_api.h:1047
const void * p_data
Definition: onnxruntime_cxx_api.h:1049
Definition: onnxruntime_cxx_api.h:950
TypeInfo GetSequenceElementType() const
Wraps OrtApi::GetSequenceElementType.
Definition: onnxruntime_cxx_api.h:820
AllocatedStringPtr EndProfilingAllocated(OrtAllocator *allocator)
End profiling and return a copy of the profiling file name.
void Run(const RunOptions &run_options, const IoBinding &)
Wraps OrtApi::RunWithBinding.
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:623
SessionOptionsImpl & DisableMemPattern()
Wraps OrtApi::DisableMemPattern.
SessionOptionsImpl & SetCustomJoinThreadFn(OrtCustomJoinThreadFn ort_custom_join_thread_fn)
Wraps OrtApi::SessionOptionsSetCustomJoinThreadFn.
SessionOptionsImpl & SetLogSeverityLevel(int level)
Wraps OrtApi::SetSessionLogSeverityLevel.
SessionOptionsImpl & AppendExecutionProvider(const std::string &provider_name, const std::unordered_map< std::string, std::string > &provider_options={})
Wraps OrtApi::SessionOptionsAppendExecutionProvider. Currently supports QNN, SNPE and XNNPACK.
SessionOptionsImpl & EnableOrtCustomOps()
Wraps OrtApi::EnableOrtCustomOps.
SessionOptionsImpl & SetCustomCreateThreadFn(OrtCustomCreateThreadFn ort_custom_create_thread_fn)
Wraps OrtApi::SessionOptionsSetCustomCreateThreadFn.
SessionOptionsImpl & AppendExecutionProvider_CANN(const OrtCANNProviderOptions &provider_options)
Wraps OrtApi::SessionOptionsAppendExecutionProvider_Dnnl.
SessionOptionsImpl & SetGraphOptimizationLevel(GraphOptimizationLevel graph_optimization_level)
Wraps OrtApi::SetSessionGraphOptimizationLevel.
SessionOptionsImpl & AppendExecutionProvider_MIGraphX(const OrtMIGraphXProviderOptions &provider_options)
Wraps OrtApi::SessionOptionsAppendExecutionProvider_CANN.
SessionOptionsImpl & DisableCpuMemArena()
Wraps OrtApi::DisableCpuMemArena.
SessionOptionsImpl & Add(OrtCustomOpDomain *custom_op_domain)
Wraps OrtApi::AddCustomOpDomain.
SessionOptionsImpl & AddConfigEntry(const char *config_key, const char *config_value)
Wraps OrtApi::AddSessionConfigEntry.
SessionOptionsImpl & EnableMemPattern()
Wraps OrtApi::EnableMemPattern.
SessionOptionsImpl & AppendExecutionProvider_Dnnl(const OrtDnnlProviderOptions &provider_options)
SessionOptionsImpl & SetCustomThreadCreationOptions(void *ort_custom_thread_creation_options)
Wraps OrtApi::SessionOptionsSetCustomThreadCreationOptions.
SessionOptionsImpl & AddExternalInitializers(const std::vector< std::string > &names, const std::vector< Value > &ort_values)
Wraps OrtApi::AddExternalInitializers.
SessionOptionsImpl & SetLogId(const char *logid)
Wraps OrtApi::SetSessionLogId.
SessionOptionsImpl & AppendExecutionProvider_CUDA_V2(const OrtCUDAProviderOptionsV2 &provider_options)
Wraps OrtApi::SessionOptionsAppendExecutionProvider_CUDA_V2.
SessionOptionsImpl & SetExecutionMode(ExecutionMode execution_mode)
Wraps OrtApi::SetSessionExecutionMode.
SessionOptionsImpl & DisablePerSessionThreads()
Wraps OrtApi::DisablePerSessionThreads.
SessionOptionsImpl & RegisterCustomOpsLibrary(const char *library_name, const CustomOpConfigs &custom_op_configs={})
SessionOptionsImpl & AppendExecutionProvider_TensorRT_V2(const OrtTensorRTProviderOptionsV2 &provider_options)
Wraps OrtApi::SessionOptionsAppendExecutionProvider_TensorRT.
SessionOptionsImpl & RegisterCustomOpsUsingFunction(const char *function_name)
Wraps OrtApi::RegisterCustomOpsUsingFunction.
SessionOptionsImpl & DisableProfiling()
Wraps OrtApi::DisableProfiling.
SessionOptionsImpl & SetIntraOpNumThreads(int intra_op_num_threads)
Wraps OrtApi::SetIntraOpNumThreads.
SessionOptionsImpl & AppendExecutionProvider_ROCM(const OrtROCMProviderOptions &provider_options)
Wraps OrtApi::SessionOptionsAppendExecutionProvider_ROCM.
SessionOptionsImpl & AppendExecutionProvider_OpenVINO(const OrtOpenVINOProviderOptions &provider_options)
Wraps OrtApi::SessionOptionsAppendExecutionProvider_OpenVINO.
SessionOptionsImpl & EnableCpuMemArena()
Wraps OrtApi::EnableCpuMemArena.
SessionOptionsImpl & AddInitializer(const char *name, const OrtValue *ort_val)
Wraps OrtApi::AddInitializer.
SessionOptionsImpl & SetInterOpNumThreads(int inter_op_num_threads)
Wraps OrtApi::SetInterOpNumThreads.
SessionOptionsImpl & EnableProfiling(const char *profile_file_prefix)
Wraps OrtApi::EnableProfiling.
SessionOptionsImpl & SetOptimizedModelFilePath(const char *optimized_model_file)
Wraps OrtApi::SetOptimizedModelFilePath.
SessionOptionsImpl & AppendExecutionProvider_TensorRT(const OrtTensorRTProviderOptions &provider_options)
Wraps OrtApi::SessionOptionsAppendExecutionProvider_TensorRT.
SessionOptionsImpl & AppendExecutionProvider_CUDA(const OrtCUDAProviderOptions &provider_options)
Wraps OrtApi::SessionOptionsAppendExecutionProvider_CUDA.
Definition: onnxruntime_cxx_api.h:1056
const int64_t * shape
Definition: onnxruntime_cxx_api.h:1057
size_t shape_len
Definition: onnxruntime_cxx_api.h:1058
Definition: onnxruntime_cxx_api.h:915
size_t GetElementCount() const
Wraps OrtApi::GetTensorShapeElementCount.
void GetDimensions(int64_t *values, size_t values_count) const
Wraps OrtApi::GetDimensions.
std::vector< int64_t > GetShape() const
Uses GetDimensionsCount & GetDimensions to return a std::vector of the shape.
void GetSymbolicDimensions(const char **values, size_t values_count) const
Wraps OrtApi::GetSymbolicDimensions.
size_t GetDimensionsCount() const
Wraps OrtApi::GetDimensionsCount.
ONNXTensorElementDataType GetElementType() const
Wraps OrtApi::GetTensorElementType.
Definition: onnxruntime_cxx_api.h:1006
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:314
T Type
Definition: onnxruntime_cxx_api.h:315
Definition: onnxruntime_cxx_api.h:1223
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:315
void(* Free)(struct OrtAllocator *this_, void *p)
Free a block of memory previously allocated with OrtAllocator::Alloc.
Definition: onnxruntime_c_api.h:318
const OrtApi *(* GetApi)(uint32_t version)
Get a pointer to the requested version of the OrtApi.
Definition: onnxruntime_c_api.h:655
The C API.
Definition: onnxruntime_c_api.h:706
CUDA Provider Options.
Definition: onnxruntime_c_api.h:399
Definition: onnxruntime_c_api.h:4346
int(* GetVariadicInputHomogeneity)(const struct OrtCustomOp *op)
Definition: onnxruntime_c_api.h:4392
OrtCustomOpInputOutputCharacteristic(* GetOutputCharacteristic)(const struct OrtCustomOp *op, size_t index)
Definition: onnxruntime_c_api.h:4376
size_t(* GetInputTypeCount)(const struct OrtCustomOp *op)
Definition: onnxruntime_c_api.h:4364
int(* GetVariadicOutputMinArity)(const struct OrtCustomOp *op)
Definition: onnxruntime_c_api.h:4396
const char *(* GetName)(const struct OrtCustomOp *op)
Definition: onnxruntime_c_api.h:4357
size_t(* GetOutputTypeCount)(const struct OrtCustomOp *op)
Definition: onnxruntime_c_api.h:4366
void(* KernelDestroy)(void *op_kernel)
Definition: onnxruntime_c_api.h:4372
int(* GetVariadicOutputHomogeneity)(const struct OrtCustomOp *op)
Definition: onnxruntime_c_api.h:4401
OrtMemType(* GetInputMemoryType)(const struct OrtCustomOp *op, size_t index)
Definition: onnxruntime_c_api.h:4383
void *(* CreateKernel)(const struct OrtCustomOp *op, const OrtApi *api, const OrtKernelInfo *info)
Definition: onnxruntime_c_api.h:4353
uint32_t version
Definition: onnxruntime_c_api.h:4347
ONNXTensorElementDataType(* GetInputType)(const struct OrtCustomOp *op, size_t index)
Definition: onnxruntime_c_api.h:4363
OrtCustomOpInputOutputCharacteristic(* GetInputCharacteristic)(const struct OrtCustomOp *op, size_t index)
Definition: onnxruntime_c_api.h:4375
const char *(* GetExecutionProviderType)(const struct OrtCustomOp *op)
Definition: onnxruntime_c_api.h:4360
ONNXTensorElementDataType(* GetOutputType)(const struct OrtCustomOp *op, size_t index)
Definition: onnxruntime_c_api.h:4365
int(* GetVariadicInputMinArity)(const struct OrtCustomOp *op)
Definition: onnxruntime_c_api.h:4387
OrtStatusPtr(* CreateKernelV2)(const struct OrtCustomOp *op, const OrtApi *api, const OrtKernelInfo *info, void **kernel)
Definition: onnxruntime_c_api.h:4404
OrtStatusPtr(* KernelComputeV2)(void *op_kernel, OrtKernelContext *context)
Definition: onnxruntime_c_api.h:4409
void(* KernelCompute)(void *op_kernel, OrtKernelContext *context)
Definition: onnxruntime_c_api.h:4371
MIGraphX Provider Options.
Definition: onnxruntime_c_api.h:600
OpenVINO Provider Options.
Definition: onnxruntime_c_api.h:610
ROCM Provider Options.
Definition: onnxruntime_c_api.h:486
TensorRT Provider Options.
Definition: onnxruntime_c_api.h:572