![]() |
ONNX Runtime
|
#include <onnxruntime_cxx_api.h>
Public Member Functions | |
| Env (std::nullptr_t) | |
| Create an empty Env object, must be assigned a valid one to be used. | |
| Env (OrtLoggingLevel logging_level=ORT_LOGGING_LEVEL_WARNING, const char *logid="") | |
| Wraps OrtApi::CreateEnv. | |
| Env (OrtLoggingLevel logging_level, const char *logid, OrtLoggingFunction logging_function, void *logger_param) | |
| Wraps OrtApi::CreateEnvWithCustomLogger. | |
| 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 (const OrtEnvCreationOptions *options) | |
| Wraps OrtApi::CreateEnvWithOptions. | |
| Env (OrtEnv *p) | |
| C Interop Helper. | |
| Env & | EnableTelemetryEvents () |
| Wraps OrtApi::EnableTelemetryEvents. | |
| Env & | DisableTelemetryEvents () |
| Wraps OrtApi::DisableTelemetryEvents. | |
| Env & | UpdateEnvWithCustomLogLevel (OrtLoggingLevel log_severity_level) |
| Wraps OrtApi::UpdateEnvWithCustomLogLevel. | |
| Env & | CreateAndRegisterAllocator (const OrtMemoryInfo *mem_info, const OrtArenaCfg *arena_cfg) |
| Wraps OrtApi::CreateAndRegisterAllocator. | |
| 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 & | RegisterAllocator (OrtAllocator *allocator) |
| Wraps OrtApi::RegisterAllocator. | |
| Env & | UnregisterAllocator (const OrtMemoryInfo *mem_info) |
| Wraps OrtApi::UnregisterAllocator. | |
| UnownedAllocator | CreateSharedAllocator (const OrtEpDevice *ep_device, OrtDeviceMemoryType mem_type, OrtAllocatorType allocator_type, const OrtKeyValuePairs *allocator_options) |
| Wraps OrtApi::CreateSharedAllocator. | |
| UnownedAllocator | GetSharedAllocator (const OrtMemoryInfo *mem_info) |
| Wraps OrtApi::GetSharedAllocator. | |
| void | ReleaseSharedAllocator (const OrtEpDevice *ep_device, OrtDeviceMemoryType mem_type) |
| Wraps OrtApi::ReleaseSharedAllocator. | |
| Env & | RegisterExecutionProviderLibrary (const char *registration_name, const std::basic_string< char > &path) |
| Wraps OrtApi::RegisterExecutionProviderLibrary. | |
| Env & | UnregisterExecutionProviderLibrary (const char *registration_name) |
| Wraps OrtApi::UnregisterExecutionProviderLibrary. | |
| std::vector< ConstEpDevice > | GetEpDevices () const |
| size_t | GetNumHardwareDevices () const |
| Get the number of available hardware devices. | |
| std::vector< ConstHardwareDevice > | GetHardwareDevices () const |
| Get the list of available hardware devices. | |
| DeviceEpIncompatibilityDetails | GetHardwareDeviceEpIncompatibilityDetails (const char *ep_name, ConstHardwareDevice hw) const |
| Check for known incompatibility issues between hardware device and a specific execution provider. | |
| Status | CopyTensors (const std::vector< Value > &src_tensors, const std::vector< Value > &dst_tensors, OrtSyncStream *stream) const |
| Wraps OrtApi::CopyTensors. | |
| Status | CopyTensor (const OrtValue *src_tensor, OrtValue *dst_tensor, OrtSyncStream *stream) const |
| Env & | SetPerSessionThreadPoolCallbacks (const OrtThreadPoolCallbacksConfig &config) |
| Wraps OrtApi::SetPerSessionThreadPoolCallbacks Stores work callbacks on the Env for per-session thread pools. Only affects sessions created after this call. Does not affect global thread pools. Requires ORT built with –enable_session_threadpool_callbacks. | |
Public Member Functions inherited from Ort::detail::Base< OrtEnv > | |
| constexpr | Base ()=default |
| constexpr | Base (contained_type *p) noexcept |
| Base (const Base &)=delete | |
| Base (Base &&v) noexcept | |
| ~Base () | |
| Base & | operator= (const Base &)=delete |
| Base & | operator= (Base &&v) noexcept |
| constexpr | operator contained_type * () const noexcept |
| constexpr contained_type & | operator* () const noexcept |
| contained_type * | release () |
| Relinquishes ownership of the contained C object pointer The underlying object is not destroyed. | |
Additional Inherited Members | |
Public Types inherited from Ort::detail::Base< OrtEnv > | |
| using | contained_type = OrtEnv |
Protected Attributes inherited from Ort::detail::Base< OrtEnv > | |
| contained_type * | p_ |
The Env (Environment)
The Env holds the logging state used by all other objects. Note: One Env must be created before using any other Onnxruntime functionality
|
inlineexplicit |
Create an empty Env object, must be assigned a valid one to be used.
| Ort::Env::Env | ( | OrtLoggingLevel | logging_level = ORT_LOGGING_LEVEL_WARNING, |
| const char * | logid = "" |
||
| ) |
Wraps OrtApi::CreateEnv.
| Ort::Env::Env | ( | OrtLoggingLevel | logging_level, |
| const char * | logid, | ||
| OrtLoggingFunction | logging_function, | ||
| void * | logger_param | ||
| ) |
| Ort::Env::Env | ( | const OrtThreadingOptions * | tp_options, |
| OrtLoggingLevel | logging_level = ORT_LOGGING_LEVEL_WARNING, |
||
| const char * | logid = "" |
||
| ) |
| Ort::Env::Env | ( | const OrtThreadingOptions * | tp_options, |
| OrtLoggingFunction | logging_function, | ||
| void * | logger_param, | ||
| OrtLoggingLevel | logging_level = ORT_LOGGING_LEVEL_WARNING, |
||
| const char * | logid = "" |
||
| ) |
|
explicit |
Wraps OrtApi::CreateEnvWithOptions.
|
inlineexplicit |
C Interop Helper.
| Status Ort::Env::CopyTensor | ( | const OrtValue * | src_tensor, |
| OrtValue * | dst_tensor, | ||
| OrtSyncStream * | stream | ||
| ) | const |
Wraps OrtApi::CopyTensors Copies only one src tensor to another dst tensor.
| Status Ort::Env::CopyTensors | ( | const std::vector< Value > & | src_tensors, |
| const std::vector< Value > & | dst_tensors, | ||
| OrtSyncStream * | stream | ||
| ) | const |
Wraps OrtApi::CopyTensors.
| Env & Ort::Env::CreateAndRegisterAllocator | ( | const OrtMemoryInfo * | mem_info, |
| const OrtArenaCfg * | arena_cfg | ||
| ) |
| Env & Ort::Env::CreateAndRegisterAllocatorV2 | ( | const std::string & | provider_type, |
| const OrtMemoryInfo * | mem_info, | ||
| const std::unordered_map< std::string, std::string > & | options, | ||
| const OrtArenaCfg * | arena_cfg | ||
| ) |
| UnownedAllocator Ort::Env::CreateSharedAllocator | ( | const OrtEpDevice * | ep_device, |
| OrtDeviceMemoryType | mem_type, | ||
| OrtAllocatorType | allocator_type, | ||
| const OrtKeyValuePairs * | allocator_options | ||
| ) |
| Env & Ort::Env::DisableTelemetryEvents | ( | ) |
| Env & Ort::Env::EnableTelemetryEvents | ( | ) |
| std::vector< ConstEpDevice > Ort::Env::GetEpDevices | ( | ) | const |
| DeviceEpIncompatibilityDetails Ort::Env::GetHardwareDeviceEpIncompatibilityDetails | ( | const char * | ep_name, |
| ConstHardwareDevice | hw | ||
| ) | const |
Check for known incompatibility issues between hardware device and a specific execution provider.
If returned incompatibility details have non-zero reasons, it indicates the device is not compatible. However, if the returned details have reasons == 0, that does not guarantee 100% compatibility for all models.
| ep_name | The name of the execution provider to check. |
| hw | The hardware device to check for incompatibility. |
| Ort::Exception | on error. Wraps OrtApi::GetHardwareDeviceEpIncompatibilityDetails |
| std::vector< ConstHardwareDevice > Ort::Env::GetHardwareDevices | ( | ) | const |
Get the list of available hardware devices.
Enumerates hardware devices available on the system.
| Ort::Exception | on error. Wraps OrtApi::GetHardwareDevices |
| size_t Ort::Env::GetNumHardwareDevices | ( | ) | const |
Get the number of available hardware devices.
Returns the count of hardware devices discovered on the system.
| Ort::Exception | on error. Wraps OrtApi::GetNumHardwareDevices |
| UnownedAllocator Ort::Env::GetSharedAllocator | ( | const OrtMemoryInfo * | mem_info | ) |
Wraps OrtApi::GetSharedAllocator.
| Env & Ort::Env::RegisterAllocator | ( | OrtAllocator * | allocator | ) |
Wraps OrtApi::RegisterAllocator.
| Env & Ort::Env::RegisterExecutionProviderLibrary | ( | const char * | registration_name, |
| const std::basic_string< char > & | path | ||
| ) |
| void Ort::Env::ReleaseSharedAllocator | ( | const OrtEpDevice * | ep_device, |
| OrtDeviceMemoryType | mem_type | ||
| ) |
| Env & Ort::Env::SetPerSessionThreadPoolCallbacks | ( | const OrtThreadPoolCallbacksConfig & | config | ) |
Wraps OrtApi::SetPerSessionThreadPoolCallbacks Stores work callbacks on the Env for per-session thread pools. Only affects sessions created after this call. Does not affect global thread pools. Requires ORT built with –enable_session_threadpool_callbacks.
| Env & Ort::Env::UnregisterAllocator | ( | const OrtMemoryInfo * | mem_info | ) |
Wraps OrtApi::UnregisterAllocator.
| Env & Ort::Env::UnregisterExecutionProviderLibrary | ( | const char * | registration_name | ) |
| Env & Ort::Env::UpdateEnvWithCustomLogLevel | ( | OrtLoggingLevel | log_severity_level | ) |