16#include "onnxruntime_c_api.h"
26#ifdef ORT_NO_EXCEPTIONS
43 const char*
what() const noexcept
override {
return message_.c_str(); }
50#ifdef ORT_NO_EXCEPTIONS
51#define ORT_CXX_API_THROW(string, code) \
53 std::cerr << Ort::Exception(string, code) \
59#define ORT_CXX_API_THROW(string, code) \
60 throw Ort::Exception(string, code)
72#ifdef ORT_API_MANUAL_INIT
87#define ORT_DEFINE_RELEASE(NAME) \
88 inline void OrtRelease(Ort##NAME* ptr) { GetApi().Release##NAME(ptr); }
93ORT_DEFINE_RELEASE(
Env);
103ORT_DEFINE_RELEASE(ThreadingOptions);
107#undef ORT_DEFINE_RELEASE
152 constexpr operator uint16_t() const noexcept {
return value; }
157static_assert(
sizeof(Float16_t) ==
sizeof(uint16_t),
"Sizes must match");
171 constexpr operator uint16_t() const noexcept {
return value; }
176static_assert(
sizeof(BFloat16_t) ==
sizeof(uint16_t),
"Sizes must match");
192 ORT_CXX_API_THROW(
"Allocation failure",
ORT_FAIL);
196 operator T*() {
return p_; }
197 operator const T*()
const {
return p_; }
227 Unowned(
typename T::contained_type* p) : T{p} {}
232struct AllocatorWithDefaultOptions;
245 explicit Env(std::nullptr_t) {}
403 std::vector<Value>
Run(
const RunOptions& run_options,
const char*
const* input_names,
const Value* input_values,
size_t input_count,
404 const char*
const* output_names,
size_t output_count);
409 void Run(
const RunOptions& run_options,
const char*
const* input_names,
const Value* input_values,
size_t input_count,
410 const char*
const* output_names,
Value* output_values,
size_t output_count);
505 template <
typename T>
511#if !defined(DISABLE_SPARSE_TENSORS)
522 template <
typename T>
524 const Shape& values_shape);
565 void UseCsrIndices(int64_t* inner_data,
size_t inner_num, int64_t* outer_data,
size_t outer_num);
580 template <
typename T>
585#if !defined(DISABLE_SPARSE_TENSORS)
595 template <
typename T>
621 const int64_t* indices_data,
size_t indices_num);
636 const int64_t* inner_indices_data,
size_t inner_indices_num,
637 const int64_t* outer_indices_data,
size_t outer_indices_num);
650 const Shape& indices_shape,
651 const int32_t* indices_data);
686 template <
typename T>
694 template <
typename T>
697 template <
typename T>
708#if !defined(DISABLE_SPARSE_TENSORS)
743 template <
typename T>
746 template <
typename T>
749#if !defined(DISABLE_SPARSE_TENSORS)
758 template <
typename T>
762 template <
typename T>
763 T&
At(
const std::vector<int64_t>& location);
812 void*
get() {
return p_; }
813 size_t size()
const {
return size_; }
878 std::vector<std::string> GetOutputNamesHelper(
OrtAllocator*)
const;
879 std::vector<Value> GetOutputValuesHelper(
OrtAllocator*)
const;
896 ArenaCfg(
size_t max_mem,
int arena_extend_strategy,
int initial_chunk_size_bytes,
int max_dead_bytes_per_chunk);
906 template <
typename T>
916 template <
typename T>
918 template <
typename T>
937template <
typename TOp,
typename TKernel>
953#if defined(_MSC_VER) && !defined(__clang__)
955#pragma warning(disable : 26409)
958#if defined(_MSC_VER) && !defined(__clang__)
981#include "onnxruntime_cxx_inline.h"
struct OrtMemoryInfo OrtMemoryInfo
Definition: onnxruntime_c_api.h:242
struct OrtKernelInfo OrtKernelInfo
Definition: onnxruntime_c_api.h:315
OrtLoggingLevel
Logging severity levels.
Definition: onnxruntime_c_api.h:207
void(* OrtLoggingFunction)(void *param, OrtLoggingLevel severity, const char *category, const char *logid, const char *code_location, const char *message)
Definition: onnxruntime_c_api.h:280
void(* OrtCustomJoinThreadFn)(OrtCustomThreadHandle ort_custom_thread_handle)
Custom thread join function.
Definition: onnxruntime_c_api.h:554
OrtCustomOpInputOutputCharacteristic
Definition: onnxruntime_c_api.h:3278
struct OrtThreadingOptions OrtThreadingOptions
Definition: onnxruntime_c_api.h:255
struct OrtSequenceTypeInfo OrtSequenceTypeInfo
Definition: onnxruntime_c_api.h:252
OrtSparseIndicesFormat
Definition: onnxruntime_c_api.h:196
struct OrtPrepackedWeightsContainer OrtPrepackedWeightsContainer
Definition: onnxruntime_c_api.h:257
struct OrtCustomOpDomain OrtCustomOpDomain
Definition: onnxruntime_c_api.h:250
OrtAllocatorType
Definition: onnxruntime_c_api.h:321
struct OrtModelMetadata OrtModelMetadata
Definition: onnxruntime_c_api.h:253
struct OrtTypeInfo OrtTypeInfo
Definition: onnxruntime_c_api.h:247
struct OrtTensorTypeAndShapeInfo OrtTensorTypeAndShapeInfo
Definition: onnxruntime_c_api.h:248
struct OrtKernelContext OrtKernelContext
Definition: onnxruntime_c_api.h:317
struct OrtSessionOptions OrtSessionOptions
Definition: onnxruntime_c_api.h:249
struct OrtValue OrtValue
Definition: onnxruntime_c_api.h:245
GraphOptimizationLevel
Graph optimization level.
Definition: onnxruntime_c_api.h:289
OrtMemType
Memory types for allocated memory, execution provider specific types should be extended in each provi...
Definition: onnxruntime_c_api.h:330
OrtSparseFormat
Definition: onnxruntime_c_api.h:188
ONNXType
Definition: onnxruntime_c_api.h:176
struct OrtEnv OrtEnv
Definition: onnxruntime_c_api.h:240
OrtErrorCode
Definition: onnxruntime_c_api.h:215
struct OrtStatus OrtStatus
Definition: onnxruntime_c_api.h:241
#define ORT_API_VERSION
The API version defined in this header.
Definition: onnxruntime_c_api.h:33
struct OrtMapTypeInfo OrtMapTypeInfo
Definition: onnxruntime_c_api.h:251
struct OrtArenaCfg OrtArenaCfg
Definition: onnxruntime_c_api.h:256
ExecutionMode
Definition: onnxruntime_c_api.h:296
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:547
ONNXTensorElementDataType
Definition: onnxruntime_c_api.h:155
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:210
@ INPUT_OUTPUT_REQUIRED
Definition: onnxruntime_c_api.h:3280
@ ORT_FAIL
Definition: onnxruntime_c_api.h:217
All C++ Onnxruntime APIs are defined inside this namespace.
Definition: onnxruntime_cxx_api.h:33
const OrtApi & GetApi()
This returns a reference to the OrtApi interface in use.
Definition: onnxruntime_cxx_api.h:80
void OrtRelease(OrtAllocator *ptr)
Definition: onnxruntime_cxx_api.h:90
std::vector< std::string > GetAvailableProviders()
This is a C++ wrapper for OrtApi::GetAvailableProviders() and returns a vector of strings representin...
Definition: onnxruntime_cxx_api.h:853
MemoryAllocation GetAllocation(size_t size)
void * Alloc(size_t size) const
Unowned< const MemoryInfo > GetInfo() const
Allocator(const Session &session, const MemoryInfo &)
Definition: onnxruntime_cxx_api.h:821
const OrtMemoryInfo * GetInfo() const
void * Alloc(size_t size)
AllocatorWithDefaultOptions()
MemoryAllocation GetAllocation(size_t size)
it is a structure that represents the configuration of an arena based allocator
Definition: onnxruntime_cxx_api.h:886
ArenaCfg(std::nullptr_t)
Create an empty ArenaCfg object, must be assigned a valid one to be used.
Definition: onnxruntime_cxx_api.h:887
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:167
uint16_t value
Definition: onnxruntime_cxx_api.h:168
constexpr bool operator!=(const BFloat16_t &rhs) const noexcept
Definition: onnxruntime_cxx_api.h:173
constexpr BFloat16_t(uint16_t v) noexcept
Definition: onnxruntime_cxx_api.h:170
constexpr bool operator==(const BFloat16_t &rhs) const noexcept
Definition: onnxruntime_cxx_api.h:172
constexpr BFloat16_t() noexcept
Definition: onnxruntime_cxx_api.h:169
Used internally by the C++ API. C++ wrapper types inherit from this.
Definition: onnxruntime_cxx_api.h:186
Base & operator=(const Base &)=delete
T * release()
Releases ownership of the contained pointer.
Definition: onnxruntime_cxx_api.h:200
~Base()
Definition: onnxruntime_cxx_api.h:194
Base(Base &&v) noexcept
Definition: onnxruntime_cxx_api.h:209
T * p_
Definition: onnxruntime_cxx_api.h:215
Base(const Base &)=delete
Base(T *p)
Definition: onnxruntime_cxx_api.h:190
void operator=(Base &&v) noexcept
Definition: onnxruntime_cxx_api.h:210
T contained_type
Definition: onnxruntime_cxx_api.h:187
Definition: onnxruntime_cxx_api.h:903
size_t KernelContext_GetOutputCount(const OrtKernelContext *context)
size_t GetDimensionsCount(const OrtTensorTypeAndShapeInfo *info)
void * KernelContext_GetGPUComputeStream(const OrtKernelContext *context)
size_t KernelContext_GetInputCount(const OrtKernelContext *context)
OrtValue * KernelContext_GetOutput(OrtKernelContext *context, size_t index, const int64_t *dim_values, size_t dim_count)
void ReleaseTensorTypeAndShapeInfo(OrtTensorTypeAndShapeInfo *input)
T KernelInfoGetAttribute(const OrtKernelInfo *info, const char *name)
OrtTensorTypeAndShapeInfo * GetTensorTypeAndShape(const OrtValue *value)
std::vector< int64_t > GetTensorShape(const OrtTensorTypeAndShapeInfo *info)
void GetDimensions(const OrtTensorTypeAndShapeInfo *info, int64_t *dim_values, size_t dim_values_length)
void ThrowOnError(OrtStatus *result)
size_t GetTensorShapeElementCount(const OrtTensorTypeAndShapeInfo *info)
ONNXTensorElementDataType GetTensorElementType(const OrtTensorTypeAndShapeInfo *info)
CustomOpApi(const OrtApi &api)
Definition: onnxruntime_cxx_api.h:904
void SetDimensions(OrtTensorTypeAndShapeInfo *info, const int64_t *dim_values, size_t dim_count)
T * GetTensorMutableData(OrtValue *value)
const OrtValue * KernelContext_GetInput(const OrtKernelContext *context, size_t index)
const OrtMemoryInfo * GetTensorMemoryInfo(const OrtValue *value)
const T * GetTensorData(const OrtValue *value)
Definition: onnxruntime_cxx_api.h:938
OrtCustomOpInputOutputCharacteristic GetOutputCharacteristic(size_t) const
Definition: onnxruntime_cxx_api.h:974
CustomOpBase()
Definition: onnxruntime_cxx_api.h:939
const char * GetExecutionProviderType() const
Definition: onnxruntime_cxx_api.h:966
OrtCustomOpInputOutputCharacteristic GetInputCharacteristic(size_t) const
Definition: onnxruntime_cxx_api.h:970
Custom Op Domain.
Definition: onnxruntime_cxx_api.h:272
CustomOpDomain(std::nullptr_t)
Create an empty CustomOpDomain object, must be assigned a valid one to be used.
Definition: onnxruntime_cxx_api.h:273
CustomOpDomain(const char *domain)
Wraps OrtApi::CreateCustomOpDomain.
void Add(OrtCustomOp *op)
Wraps CustomOpDomain_Add.
The Env (Environment)
Definition: onnxruntime_cxx_api.h:244
Env & EnableTelemetryEvents()
Wraps OrtApi::EnableTelemetryEvents.
Env(OrtEnv *p)
C Interop Helper.
Definition: onnxruntime_cxx_api.h:261
Env(std::nullptr_t)
Create an empty Env object, must be assigned a valid one to be used.
Definition: onnxruntime_cxx_api.h:245
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 & DisableTelemetryEvents()
Wraps OrtApi::DisableTelemetryEvents.
All C++ methods that can fail will throw an exception of this type.
Definition: onnxruntime_cxx_api.h:39
const char * what() const noexcept override
Definition: onnxruntime_cxx_api.h:43
OrtErrorCode GetOrtErrorCode() const
Definition: onnxruntime_cxx_api.h:42
Exception(std::string &&string, OrtErrorCode code)
Definition: onnxruntime_cxx_api.h:40
IEEE 754 half-precision floating point data type.
Definition: onnxruntime_cxx_api.h:148
constexpr bool operator!=(const Float16_t &rhs) const noexcept
Definition: onnxruntime_cxx_api.h:154
constexpr Float16_t(uint16_t v) noexcept
Definition: onnxruntime_cxx_api.h:151
uint16_t value
Definition: onnxruntime_cxx_api.h:149
constexpr bool operator==(const Float16_t &rhs) const noexcept
Definition: onnxruntime_cxx_api.h:153
constexpr Float16_t() noexcept
Definition: onnxruntime_cxx_api.h:150
Definition: onnxruntime_cxx_api.h:66
static const OrtApi * api_
Definition: onnxruntime_cxx_api.h:67
Definition: onnxruntime_cxx_api.h:863
void BindInput(const char *name, const Value &)
std::vector< Value > GetOutputValues() const
void SynchronizeOutputs()
std::vector< std::string > GetOutputNames() const
std::vector< Value > GetOutputValues(Allocator &) const
std::vector< std::string > GetOutputNames(Allocator &) const
void BindOutput(const char *name, const MemoryInfo &)
void BindOutput(const char *name, const Value &)
IoBinding(Session &session)
Wrapper around OrtMapTypeInfo.
Definition: onnxruntime_cxx_api.h:460
ONNXTensorElementDataType GetMapKeyType() const
Wraps OrtApi::GetMapKeyType.
TypeInfo GetMapValueType() const
Wraps OrtApi::GetMapValueType.
MapTypeInfo(OrtMapTypeInfo *p)
Used for interop with the C API.
Definition: onnxruntime_cxx_api.h:462
MapTypeInfo(std::nullptr_t)
Create an empty MapTypeInfo object, must be assigned a valid one to be used.
Definition: onnxruntime_cxx_api.h:461
Definition: onnxruntime_cxx_api.h:804
MemoryAllocation(MemoryAllocation &&) noexcept
MemoryAllocation & operator=(const MemoryAllocation &)=delete
void * get()
Definition: onnxruntime_cxx_api.h:812
MemoryAllocation(const MemoryAllocation &)=delete
MemoryAllocation(OrtAllocator *allocator, void *p, size_t size)
size_t size() const
Definition: onnxruntime_cxx_api.h:813
Definition: onnxruntime_cxx_api.h:838
OrtAllocatorType GetAllocatorType() const
MemoryInfo(const char *name, OrtAllocatorType type, int id, OrtMemType mem_type)
MemoryInfo(std::nullptr_t)
Definition: onnxruntime_cxx_api.h:841
MemoryInfo(OrtMemoryInfo *p)
Used for interop with the C API.
Definition: onnxruntime_cxx_api.h:842
static MemoryInfo CreateCpu(OrtAllocatorType type, OrtMemType mem_type1)
std::string GetAllocatorName() const
bool operator==(const MemoryInfo &o) const
OrtMemType GetMemoryType() const
Definition: onnxruntime_cxx_api.h:281
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:282
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:450
TypeInfo GetSequenceElementType() const
Wraps OrtApi::GetSequenceElementType.
SequenceTypeInfo(std::nullptr_t)
Create an empty SequenceTypeInfo object, must be assigned a valid one to be used.
Definition: onnxruntime_cxx_api.h:451
SequenceTypeInfo(OrtSequenceTypeInfo *p)
Used for interop with the C API.
Definition: onnxruntime_cxx_api.h:452
Wrapper around OrtSession.
Definition: onnxruntime_cxx_api.h:380
Session(Env &env, const char *model_path, const SessionOptions &options)
Wraps OrtApi::CreateSession.
char * GetInputName(size_t index, OrtAllocator *allocator) const
Wraps OrtApi::SessionGetInputName.
char * GetOutputName(size_t index, OrtAllocator *allocator) const
Wraps OrtApi::SessionGetOutputName.
size_t GetInputCount() const
Returns the number of model inputs.
Session(Env &env, const char *model_path, const SessionOptions &options, OrtPrepackedWeightsContainer *prepacked_weights_container)
Wraps OrtApi::CreateSessionWithPrepackedWeightsContainer.
Session(std::nullptr_t)
Create an empty Session object, must be assigned a valid one to be used.
Definition: onnxruntime_cxx_api.h:381
TypeInfo GetOutputTypeInfo(size_t index) const
Wraps OrtApi::SessionGetOutputTypeInfo.
ModelMetadata GetModelMetadata() const
Wraps OrtApi::SessionGetModelMetadata.
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&,...
size_t GetOverridableInitializerCount() const
Returns the number of inputs that have defaults that can be overridden.
size_t GetOutputCount() const
Returns the number of model outputs.
Session(Env &env, const void *model_data, size_t model_data_length, const SessionOptions &options)
Wraps OrtApi::CreateSessionFromArray.
uint64_t GetProfilingStartTimeNs() const
Wraps OrtApi::SessionGetProfilingStartTimeNs.
char * EndProfiling(OrtAllocator *allocator) const
Wraps OrtApi::SessionEndProfiling.
TypeInfo GetInputTypeInfo(size_t index) const
Wraps OrtApi::SessionGetInputTypeInfo.
char * GetOverridableInitializerName(size_t index, OrtAllocator *allocator) const
Wraps OrtApi::SessionGetOverridableInitializerName.
TypeInfo GetOverridableInitializerTypeInfo(size_t index) const
Wraps OrtApi::SessionGetOverridableInitializerTypeInfo.
void Run(const RunOptions &run_options, const struct 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.
Options object used when creating a new Session object.
Definition: onnxruntime_cxx_api.h:314
SessionOptions & SetGraphOptimizationLevel(GraphOptimizationLevel graph_optimization_level)
Wraps OrtApi::SetSessionGraphOptimizationLevel.
SessionOptions & EnableMemPattern()
Wraps OrtApi::EnableMemPattern.
SessionOptions & AddConfigEntry(const char *config_key, const char *config_value)
Wraps OrtApi::AddSessionConfigEntry.
SessionOptions & AppendExecutionProvider_TensorRT(const OrtTensorRTProviderOptions &provider_options)
Wraps OrtApi::SessionOptionsAppendExecutionProvider_TensorRT.
SessionOptions & SetCustomCreateThreadFn(OrtCustomCreateThreadFn ort_custom_create_thread_fn)
Wraps OrtApi::SessionOptionsSetCustomCreateThreadFn.
SessionOptions & SetIntraOpNumThreads(int intra_op_num_threads)
Wraps OrtApi::SetIntraOpNumThreads.
SessionOptions & DisableProfiling()
Wraps OrtApi::DisableProfiling.
SessionOptions & DisablePerSessionThreads()
Wraps OrtApi::DisablePerSessionThreads.
SessionOptions Clone() const
Creates and returns a copy of this SessionOptions object. Wraps OrtApi::CloneSessionOptions.
SessionOptions(std::nullptr_t)
Create an empty SessionOptions object, must be assigned a valid one to be used.
Definition: onnxruntime_cxx_api.h:315
SessionOptions & EnableOrtCustomOps()
Wraps OrtApi::EnableOrtCustomOps.
SessionOptions()
Wraps OrtApi::CreateSessionOptions.
SessionOptions & EnableProfiling(const char *profile_file_prefix)
Wraps OrtApi::EnableProfiling.
SessionOptions & SetOptimizedModelFilePath(const char *optimized_model_file)
Wraps OrtApi::SetOptimizedModelFilePath.
SessionOptions & EnableCpuMemArena()
Wraps OrtApi::EnableCpuMemArena.
SessionOptions & AppendExecutionProvider_OpenVINO(const OrtOpenVINOProviderOptions &provider_options)
Wraps OrtApi::SessionOptionsAppendExecutionProvider_OpenVINO.
SessionOptions & DisableMemPattern()
Wraps OrtApi::DisableMemPattern.
SessionOptions & AddInitializer(const char *name, const OrtValue *ort_val)
Wraps OrtApi::AddInitializer.
SessionOptions & SetLogSeverityLevel(int level)
Wraps OrtApi::SetSessionLogSeverityLevel.
SessionOptions & SetInterOpNumThreads(int inter_op_num_threads)
Wraps OrtApi::SetInterOpNumThreads.
SessionOptions & SetCustomThreadCreationOptions(void *ort_custom_thread_creation_options)
Wraps OrtApi::SessionOptionsSetCustomThreadCreationOptions.
SessionOptions & AppendExecutionProvider_ROCM(const OrtROCMProviderOptions &provider_options)
Wraps OrtApi::SessionOptionsAppendExecutionProvider_ROCM.
SessionOptions & DisableCpuMemArena()
Wraps OrtApi::DisableCpuMemArena.
SessionOptions & SetCustomJoinThreadFn(OrtCustomJoinThreadFn ort_custom_join_thread_fn)
Wraps OrtApi::SessionOptionsSetCustomJoinThreadFn.
SessionOptions & SetExecutionMode(ExecutionMode execution_mode)
Wraps OrtApi::SetSessionExecutionMode.
SessionOptions & SetLogId(const char *logid)
Wraps OrtApi::SetSessionLogId.
SessionOptions(OrtSessionOptions *p)
Used for interop with the C API.
Definition: onnxruntime_cxx_api.h:317
SessionOptions & Add(OrtCustomOpDomain *custom_op_domain)
Wraps OrtApi::AddCustomOpDomain.
SessionOptions & AppendExecutionProvider_CUDA(const OrtCUDAProviderOptions &provider_options)
Wraps OrtApi::SessionOptionsAppendExecutionProvider_CUDA.
Wrapper around OrtTensorTypeAndShapeInfo.
Definition: onnxruntime_cxx_api.h:433
TensorTypeAndShapeInfo(std::nullptr_t)
Create an empty TensorTypeAndShapeInfo object, must be assigned a valid one to be used.
Definition: onnxruntime_cxx_api.h:434
TensorTypeAndShapeInfo(OrtTensorTypeAndShapeInfo *p)
Used for interop with the C API.
Definition: onnxruntime_cxx_api.h:435
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.
size_t GetDimensionsCount() const
Wraps OrtApi::GetDimensionsCount.
ONNXTensorElementDataType GetElementType() const
Wraps OrtApi::GetTensorElementType.
size_t GetElementCount() const
Wraps OrtApi::GetTensorShapeElementCount.
void GetSymbolicDimensions(const char **values, size_t values_count) const
Wraps OrtApi::GetSymbolicDimensions.
Definition: onnxruntime_cxx_api.h:468
Unowned< MapTypeInfo > GetMapTypeInfo() const
Wraps OrtApi::CastTypeInfoToMapTypeInfo.
Unowned< SequenceTypeInfo > GetSequenceTypeInfo() const
Wraps OrtApi::CastTypeInfoToSequenceTypeInfo.
ONNXType GetONNXType() const
Unowned< TensorTypeAndShapeInfo > GetTensorTypeAndShapeInfo() const
Wraps OrtApi::CastTypeInfoToTensorInfo.
TypeInfo(std::nullptr_t)
Create an empty TypeInfo object, must be assigned a valid one to be used.
Definition: onnxruntime_cxx_api.h:469
TypeInfo(OrtTypeInfo *p)
C API Interop.
Definition: onnxruntime_cxx_api.h:470
Wraps an object that inherits from Ort::Base and stops it from deleting the contained pointer on dest...
Definition: onnxruntime_cxx_api.h:226
Unowned(Unowned &&v)
Definition: onnxruntime_cxx_api.h:228
~Unowned()
Definition: onnxruntime_cxx_api.h:229
Unowned(typename T::contained_type *p)
Definition: onnxruntime_cxx_api.h:227
Definition: onnxruntime_cxx_api.h:488
const char ** str
Definition: onnxruntime_cxx_api.h:493
size_t values_shape_len
Definition: onnxruntime_cxx_api.h:490
const int64_t * values_shape
Definition: onnxruntime_cxx_api.h:489
const void * p_data
Definition: onnxruntime_cxx_api.h:492
union Ort::Value::OrtSparseValuesParam::@0 data
Definition: onnxruntime_cxx_api.h:499
const int64_t * shape
Definition: onnxruntime_cxx_api.h:500
size_t shape_len
Definition: onnxruntime_cxx_api.h:501
Definition: onnxruntime_cxx_api.h:479
T * GetTensorMutableData()
Wraps OrtApi::GetTensorMutableData.
static Value CreateMap(Value &keys, Value &values)
Wraps OrtApi::CreateValue.
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...
const T * 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...
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....
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...
Value(std::nullptr_t)
Create an empty Value object, must be assigned a valid one to be used.
Definition: onnxruntime_cxx_api.h:700
bool IsTensor() const
Returns true if Value is a tensor, false for other types like map/sequence/etc.
const T * GetTensorData() const
Wraps OrtApi::GetTensorMutableData.
static Value CreateTensor(const OrtMemoryInfo *info, T *p_data, size_t p_data_element_count, const int64_t *shape, size_t shape_len)
Wraps OrtApi::CreateTensorWithDataAsOrtValue.
TensorTypeAndShapeInfo GetTensorTypeAndShapeInfo() const
The API returns type information for data contained in a tensor. For sparse tensors it returns type i...
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...
Value(OrtValue *p)
Used for interop with the C API.
Definition: onnxruntime_cxx_api.h:701
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...
static Value CreateSparseTensor(OrtAllocator *allocator, const Shape &dense_shape)
This is a simple forwarding method the below CreateSparseTensor. This helps to specify data type enum...
static Value CreateTensor(OrtAllocator *allocator, const int64_t *shape, size_t shape_len, ONNXTensorElementDataType type)
bool IsSparseTensor() const
< Return true if OrtValue contains data and returns false if the OrtValue is a None
TensorTypeAndShapeInfo GetSparseTensorIndicesTypeShapeInfo(OrtSparseIndicesFormat format) const
The API returns type and shape information for the specified indices. Each supported indices have the...
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...
TensorTypeAndShapeInfo GetSparseTensorValuesTypeAndShapeInfo() const
The API returns type and shape information for stored non-zero values of the sparse tensor....
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 FillStringTensor(const char *const *s, size_t s_len)
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...
T & At(const std::vector< int64_t > &location)
TypeInfo GetTypeInfo() const
The API returns type information for data contained in a tensor. For sparse tensors it returns type i...
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...
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)
Wraps OrtApi::CreateTensorWithDataAsOrtValue.
static Value CreateOpaque(const char *domain, const char *type_name, const T &)
Wraps OrtApi::CreateOpaqueValue.
Value GetValue(int index, OrtAllocator *allocator) const
static Value CreateTensor(OrtAllocator *allocator, const int64_t *shape, size_t shape_len)
static Value CreateSequence(std::vector< Value > &values)
Wraps OrtApi::CreateValue.
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...
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...
void FillStringTensorElement(const char *s, size_t index)
const T * GetSparseTensorValues() const
The API returns a pointer to an internal buffer of the sparse tensor containing non-zero values....
void GetOpaqueData(const char *domain, const char *type_name, T &) const
Wraps OrtApi::GetOpaqueValue.
OrtSparseFormat GetSparseFormat() const
The API returns the sparse data format this OrtValue holds in a sparse tensor. If the sparse tensor w...
size_t GetStringTensorDataLength() const
This API returns a full length of string data contained within either a tensor or a sparse Tensor....
Memory allocation interface.
Definition: onnxruntime_c_api.h:273
const OrtApi *(* GetApi)(uint32_t version)
Get a pointer to the requested version of the OrtApi.
Definition: onnxruntime_c_api.h:522
The C API.
Definition: onnxruntime_c_api.h:563
CUDA Provider Options.
Definition: onnxruntime_c_api.h:349
Definition: onnxruntime_c_api.h:3288
OrtCustomOpInputOutputCharacteristic(* GetOutputCharacteristic)(const struct OrtCustomOp *op, size_t index)
Definition: onnxruntime_c_api.h:3313
size_t(* GetInputTypeCount)(const struct OrtCustomOp *op)
Definition: onnxruntime_c_api.h:3303
const char *(* GetName)(const struct OrtCustomOp *op)
Definition: onnxruntime_c_api.h:3296
size_t(* GetOutputTypeCount)(const struct OrtCustomOp *op)
Definition: onnxruntime_c_api.h:3305
void(* KernelDestroy)(void *op_kernel)
Definition: onnxruntime_c_api.h:3309
void *(* CreateKernel)(const struct OrtCustomOp *op, const OrtApi *api, const OrtKernelInfo *info)
Definition: onnxruntime_c_api.h:3292
uint32_t version
Definition: onnxruntime_c_api.h:3289
ONNXTensorElementDataType(* GetInputType)(const struct OrtCustomOp *op, size_t index)
Definition: onnxruntime_c_api.h:3302
OrtCustomOpInputOutputCharacteristic(* GetInputCharacteristic)(const struct OrtCustomOp *op, size_t index)
Definition: onnxruntime_c_api.h:3312
const char *(* GetExecutionProviderType)(const struct OrtCustomOp *op)
Definition: onnxruntime_c_api.h:3299
ONNXTensorElementDataType(* GetOutputType)(const struct OrtCustomOp *op, size_t index)
Definition: onnxruntime_c_api.h:3304
void(* KernelCompute)(void *op_kernel, OrtKernelContext *context)
Definition: onnxruntime_c_api.h:3308
OpenVINO Provider Options.
Definition: onnxruntime_c_api.h:491
ROCM Provider Options.
Definition: onnxruntime_c_api.h:408
TensorRT Provider Options.
Definition: onnxruntime_c_api.h:466