### C Example: Initialize Graphics Interop for D3D12 Source: https://onnxruntime.ai/docs/api/c/group___global.html Example demonstrating how to initialize graphics interop for a Direct3D 12 execution provider. Ensure the 'version' field is set to ORT_API_VERSION for forward compatibility. ```c const OrtInteropApi* interop_api = ort_api->GetInteropApi(); OrtGraphicsInteropConfig config = {0}; config.version = ORT_API_VERSION; config.graphics_api = ORT_GRAPHICS_API_D3D12; config.command_queue = my_d3d12_command_queue; // ID3D12CommandQueue* status = interop_api->InitGraphicsInteropForEpDevice(ep_device, &config); ``` -------------------------------- ### OrtCustomOp::GetStartVersion Source: https://onnxruntime.ai/docs/api/c/struct_ort_1_1_custom_op_base-members.html Gets the starting version of the operator. ```APIDOC ## OrtCustomOp::GetStartVersion ### Description Retrieves the version number from which this custom operator is supported. ### Method (Implicitly public, as it's a member function) ### Endpoint N/A (C++ API) ### Parameters None ### Request Example N/A (C++ API) ### Response - **int64_t**: The starting version of the operator. ``` -------------------------------- ### CustomOpConfigs Class Example Source: https://onnxruntime.ai/docs/api/c/struct_ort_1_1_custom_op_configs.html Example demonstrating the creation and usage of Ort::CustomOpConfigs to add a configuration for a custom operator. ```cpp Ort::CustomOpConfigs op_configs; op_configs.AddConfig("my_custom_op", "device_type", "CPU"); ``` -------------------------------- ### GetStartVersion Source: https://onnxruntime.ai/docs/api/c/functions_g.html Retrieves the start version from OrtCustomOp. ```APIDOC ## GetStartVersion ### Description Retrieves the start version. ### Method GetStartVersion ### Returns OrtCustomOp ``` -------------------------------- ### StartEvent Source: https://onnxruntime.ai/docs/api/c/functions_func_s.html Starts a profiling event. ```APIDOC ## StartEvent() ### Description Begins the recording of a profiling event. ### Method Not applicable (C API function signature) ### Endpoint Not applicable (C API function) ### Parameters None explicitly documented. ### Request Example None provided. ### Response #### Success Response (OrtEpProfilerImpl) Returns an OrtEpProfilerImpl object, likely for further profiling actions. #### Response Example None provided. ``` -------------------------------- ### SessionGetProfilingStartTimeNs Source: https://onnxruntime.ai/docs/api/c/functions_func_s.html Gets the start time of the profiling session in nanoseconds. ```APIDOC ## SessionGetProfilingStartTimeNs() ### Description Gets the start time of the profiling session in nanoseconds. ### Returns - OrtApi: The OrtApi object. ``` -------------------------------- ### OrtEpProfilerImpl::StartProfiling Source: https://onnxruntime.ai/docs/api/c/onnxruntime__ep__c__api_8h_source.html Called when profiling starts. ```APIDOC ## OrtEpProfilerImpl::StartProfiling ### Description Called when profiling starts. ### Signature OrtStatus * StartProfiling(OrtEpProfilerImpl *this_ptr, int64_t ep_profiling_start_offset_ns) ``` -------------------------------- ### StartProfiling Source: https://onnxruntime.ai/docs/api/c/struct_ort_ep_profiler_impl.html Called when profiling starts. This method allows the EP profiler to initialize profiling utilities and record the profiling start time. The EP profiler uses this to compute ORT-relative event timestamps. ```APIDOC ## StartProfiling() ### Description Called when profiling starts. Allows the EP profiler to initialize profiling utilities and record the profiling start time. An EP profiler should record its own clock's current time when this function is called. This allows the EP to later compute ORT-relative event timestamps by combining `ep_profiling_start_offset_ns` with the EP's own elapsed time since this call. ### Method Signature `OrtStatus * OrtEpProfilerImpl::StartProfiling(OrtEpProfilerImpl * _this_ptr_, int64_t _ep_profiling_start_offset_ns_)` ### Parameters - **_this_ptr_** (*OrtEpProfilerImpl*): Pointer to the OrtEpProfilerImpl instance. - **_ep_profiling_start_offset_ns_** (*int64_t*): The elapsed time in nanoseconds (using ORT's profiling clock) between ORT's profiling start and this call to `StartProfiling`. ### Returns - *OrtStatus* Pointer: If no error, nullptr will be returned. If there is an error, a pointer to an OrtStatus that contains error details will be returned. Use `OrtApi::ReleaseStatus` to free this pointer. ### Notes - An error `OrtStatus` returned from this function is logged by ORT (does not end execution). - Implementation of this function is required. - The formula for calculating event timestamps is: `event_timestamp_us = (ep_profiling_start_offset_ns + (ep_event_time_ns - ep_profiling_start_time_ns)) / 1000`, where `ep_event_time_ns` and `ep_profiling_start_time_ns` are measured using the EP's own clock. ### Since Version 1.25. ``` -------------------------------- ### GetHardwareDevices() Source: https://onnxruntime.ai/docs/api/c/functions_g.html Gets available hardware devices. ```APIDOC ## GetHardwareDevices() ### Description Retrieves a list of available hardware devices that ONNX Runtime can utilize. ### Method Not applicable (function signature) ### Endpoint Not applicable (function signature) ### Parameters None explicitly documented. ### Request Example None available. ### Response - **OrtApi**: The OrtApi object. ``` -------------------------------- ### Get Profiling Start Time Source: https://onnxruntime.ai/docs/api/c/struct_ort_1_1detail_1_1_session_impl.html Retrieves the start time of the profiling session in nanoseconds. ```APIDOC ## GetProfilingStartTimeNs ### Description Wraps OrtApi::SessionGetProfilingStartTimeNs. ### Method uint64_t GetProfilingStartTimeNs () const ### Returns The profiling start time in nanoseconds. ``` -------------------------------- ### Initialize Training Session and Perform Training Steps Source: https://onnxruntime.ai/docs/api/c/training_c_cpp_api.html Initializes the training environment, session options, loads a checkpoint, creates a training session, and demonstrates a basic training loop. Ensure the Ort::CheckpointState instance outlives the Ort::TrainingSession instance. ```cpp #include Ort::Env env; Ort::SessionOptions session_options; auto state = Ort::CheckpointState::LoadCheckpoint(path_to_checkpoint); auto training_session = Ort::TrainingSession(env, session_options, state, training_model_path, eval_model_path, optimizer_model_path); // Training Loop { training_session.TrainStep(...); training_session.OptimizerStep(...); training_session.LazyResetGrad(...); } ``` -------------------------------- ### Create Training Session from File Paths Source: https://onnxruntime.ai/docs/api/c/onnxruntime__training__cxx__api_8h_source.html Initializes a training session using model paths. Supports training, evaluation, and optimizer models. ```cpp TrainingSession(const Env& env, const SessionOptions& session_options, CheckpointState& checkpoint_state, const std::basic_string& train_model_path, const std::optional>& eval_model_path = std::nullopt, const std::optional>& optimizer_model_path = std::nullopt); ``` -------------------------------- ### GetEpDevices() Source: https://onnxruntime.ai/docs/api/c/functions_g.html Gets the available execution provider devices. ```APIDOC ## GetEpDevices() ### Description Retrieves a list of available execution provider devices that can be used for computation. ### Method Not applicable (function signature) ### Endpoint Not applicable (function signature) ### Parameters None explicitly documented. ### Request Example None available. ### Response - **Ort::Env, OrtApi**: Returns the available execution provider devices. ``` -------------------------------- ### Variables starting with 'n' Source: https://onnxruntime.ai/docs/api/c/functions_vars_n.html This section details variables whose names start with the letter 'n'. ```APIDOC ## Variables ### - n - * **native_handle** : OrtExternalMemoryDescriptor, OrtExternalSemaphoreDescriptor * Description: Represents the native handle for external memory or semaphore descriptors. * **node** : Ort::ValueInfoConsumerProducerInfo * Description: Refers to the node information within the context of value info consumer/producer. * **NodeComputeContext_NodeName** : OrtEpApi * Description: A constant or identifier related to the node name within the execution provider API context. * **num_of_threads** : OrtOpenVINOProviderOptions * Description: Specifies the number of threads to be used by the OpenVINO provider. ``` -------------------------------- ### Initialize and Load Training Session C API Source: https://onnxruntime.ai/docs/api/c/training_c_cpp_api.html Demonstrates the initialization of the ONNX Runtime environment and training API, followed by loading a checkpoint and creating a training session. Ensure the OrtCheckpointState instance outlives the OrtTrainingSession. ```c #include OrtApi* g_ort_api = OrtGetApiBase()->GetApi(ORT_API_VERSION); OrtTrainingApi* g_ort_training_api = g_ort_api->GetTrainingApi(ORT_API_VERSION); OrtEnv* env = NULL; g_ort_api->CreateEnv(logging_level, logid, &env); OrtSessionOptions* session_options = NULL; g_ort_api->CreateSessionOptions(&session_options); OrtCheckpointState* state = NULL; g_ort_training_api->LoadCheckpoint(path_to_checkpoint, &state); OrtTrainingSession* training_session = NULL; g_ort_training_api->CreateTrainingSession(env, session_options, training_model_path, state, eval_model_path, optimizer_model_path, &training_session); ``` -------------------------------- ### GetProfilingStartTimeNs Source: https://onnxruntime.ai/docs/api/c/functions_func_g.html Retrieves the profiling start time in nanoseconds. ```APIDOC ## GetProfilingStartTimeNs ### Description Retrieves the start time of profiling, measured in nanoseconds, from a session. ### Method (Not specified, likely a member function) ### Endpoint (Not applicable for C++ API) ### Parameters (Not specified) ### Request Example (Not applicable for C++ API) ### Response - Ort::detail::ConstSessionImpl< T > ``` -------------------------------- ### Example: Compiling an ONNX Model Source: https://onnxruntime.ai/docs/api/c/struct_ort_compile_api.html Demonstrates a typical workflow for compiling an ONNX model using the OrtCompileApi. It includes creating compilation options, setting input/output paths, compiling the model, and releasing resources. Error handling is omitted for brevity. ```c OrtStatus* status = NULL; OrtCompileApi* compile_api = ort_api->GetCompileApi(); OrtModelCompilationOptions* compile_options = NULL; status = compile_api->CreateModelCompilationOptionsFromSessionOptions(env, session_options, &compile_options); status = compile_api->ModelCompilationOptions_SetInputModelPath(compile_options, ORT_TSTR("model.onnx")); status = compile_api->ModelCompilationOptions_SetOutputModelPath(compile_options, ORT_TSTR("model.compiled.onnx")); status = compile_api->CompileModel(env, compile_options); compile_api->ReleaseModelCompilationOptions(compile_options); ``` -------------------------------- ### Variables starting with 'i' Source: https://onnxruntime.ai/docs/api/c/functions_vars_i.html This section details variables in the ONNX Runtime C/C++ API that start with the letter 'i'. ```APIDOC ## Variables starting with 'i' ### i_ : Ort::ShapeInferContext::SymbolicInteger **Description**: Represents a symbolic integer within the shape inference context. ### index : Ort::ValueInfoConsumerProducerInfo **Description**: An index used in value information for consumers and producers. ### InferOutputShapeFn : OrtCustomOp **Description**: Function pointer for inferring output shape in custom operations. ### Info : OrtAllocator **Description**: Information related to memory allocation. ### INVALID_INT_DIM : Ort::ShapeInferContext::SymbolicInteger **Description**: Represents an invalid integer dimension in the shape inference context. ### IsGraphCaptured : OrtEp **Description**: Flag indicating if the graph is captured. ### IsGraphCaptureEnabled : OrtEp **Description**: Flag indicating if graph capture is enabled. ### IsStreamAware : OrtEpFactory **Description**: Flag indicating if the execution provider factory supports stream awareness. ``` -------------------------------- ### Variables starting with 'p' Source: https://onnxruntime.ai/docs/api/c/functions_vars_p.html This section details variables that start with the letter 'p', including their associated classes. ```APIDOC ## Variables ### - p - - **p_** : Ort::detail::Base< T >, Ort::detail::Base< Unowned< T > > - Description: Represents a base class template for managing resources, with specializations for owned and unowned types. - **p_data** : Ort::detail::OrtSparseValuesParam - Description: A parameter structure used to represent sparse data values within ONNX Runtime. ``` -------------------------------- ### OrtStatus * CreateEnvWithOptions(const OrtEnvCreationOptions *options, OrtEnv **out) Source: https://onnxruntime.ai/docs/api/c/onnxruntime__c__api_8h_source.html Creates an ONNX Runtime environment instance with specified creation options. ```APIDOC ## CreateEnvWithOptions ### Description Create an OrtEnv instance with the given options. ### Signature OrtStatus * CreateEnvWithOptions(const OrtEnvCreationOptions *options, OrtEnv **out) ``` -------------------------------- ### Example Usage of OrtInteropApi Source: https://onnxruntime.ai/docs/api/c/struct_ort_interop_api.html Demonstrates a typical workflow for creating an external resource importer, checking memory import capabilities, importing memory, and releasing resources. Error handling is omitted for brevity. ```c const OrtInteropApi* interop_api = ort_api->GetInteropApi(); OrtExternalResourceImporter* importer = NULL; status = interop_api->CreateExternalResourceImporterForDevice(ep_device, &importer); if (importer == nullptr) { // External resource import is optional for EPs to implement return; } bool can_import = false; status = interop_api->CanImportMemory(importer, ORT_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE, &can_import); if (can_import) { OrtExternalMemoryHandle* mem_handle = NULL; status = interop_api->ImportMemory(importer, &mem_desc, &mem_handle); // ... use mem_handle to create tensors ... interop_api->ReleaseExternalMemoryHandle(mem_handle); } interop_api->ReleaseExternalResourceImporter(importer); ``` -------------------------------- ### Create Training Session from Data Buffers Source: https://onnxruntime.ai/docs/api/c/onnxruntime__training__cxx__api_8h_source.html Initializes a training session using model data provided as byte vectors. Supports training, evaluation, and optimizer models. ```cpp TrainingSession(const Env& env, const SessionOptions& session_options, CheckpointState& checkpoint_state, const std::vector& train_model_data, const std::vector& eval_model_data = {}, const std::vector& optim_model_data = {}); ``` -------------------------------- ### CreateEnvWithOptions Source: https://onnxruntime.ai/docs/api/c/struct_ort_api-members.html Creates an ONNX Runtime environment with specified creation options. ```APIDOC ## CreateEnvWithOptions ### Description Creates an ONNX Runtime environment with specified creation options. ### Method OrtApi::CreateEnvWithOptions ### Parameters - **options** (const OrtEnvCreationOptions *) - Pointer to environment creation options. - **out** (OrtEnv **) - Pointer to the output environment object. ``` -------------------------------- ### Example Derived Type for CUDA EP Source: https://onnxruntime.ai/docs/api/c/struct_ort_external_semaphore_handle.html This example shows how an EP, like CUDA, might derive from OrtExternalSemaphoreHandle to include its specific semaphore type. The EP is responsible for managing the lifecycle of these derived handles. ```c++ struct MyCudaExternalSemaphoreHandle : OrtExternalSemaphoreHandle { CUexternalSemaphore ext_semaphore; }; ``` -------------------------------- ### MemoryInfoGetType Source: https://onnxruntime.ai/docs/api/c/onnxruntime__c__api_8h_source.html Get the OrtAllocatorType from OrtMemoryInfo. ```APIDOC ## MemoryInfoGetType Get the OrtAllocatorType from OrtMemoryInfo. ### Parameters - **ptr** (const OrtMemoryInfo *) - Pointer to the OrtMemoryInfo. - **out** (OrtAllocatorType *) - Pointer to store the OrtAllocatorType. ### Returns - OrtStatus * - Status of the operation. ``` -------------------------------- ### StartProfiling Source: https://onnxruntime.ai/docs/api/c/functions_func_s.html Initiates the profiling session. ```APIDOC ## StartProfiling() ### Description Starts the overall profiling session for performance analysis. ### Method Not applicable (C API function signature) ### Endpoint Not applicable (C API function) ### Parameters None explicitly documented. ### Request Example None provided. ### Response #### Success Response (OrtEpProfilerImpl) Returns an OrtEpProfilerImpl object, representing the active profiling session. #### Response Example None provided. ``` -------------------------------- ### CastTypeInfoToTensorInfo Source: https://onnxruntime.ai/docs/api/c/onnxruntime__c__api_8h_source.html Get OrtTensorTypeAndShapeInfo from an OrtTypeInfo. ```APIDOC ## CastTypeInfoToTensorInfo Get OrtTensorTypeAndShapeInfo from an OrtTypeInfo. ### Parameters - **type_info** (const OrtTypeInfo *) - Pointer to the OrtTypeInfo. - **out** (const OrtTensorTypeAndShapeInfo **) - Pointer to store the OrtTensorTypeAndShapeInfo. ### Returns - OrtStatus * - Status of the operation. ``` -------------------------------- ### Load Checkpoint State from Path Source: https://onnxruntime.ai/docs/api/c/onnxruntime__training__cxx__api_8h_source.html Loads the checkpoint state from a specified file path. Use this to initialize or resume training. ```cpp static CheckpointState LoadCheckpoint(const std::basic_string& path_to_checkpoint); ``` -------------------------------- ### Ort::Env::Env(OrtEnv*) Source: https://onnxruntime.ai/docs/api/c/struct_ort_1_1_env.html C Interop Helper constructor for Env. ```APIDOC ## Env(OrtEnv *p) ### Description C Interop Helper. ### Method Constructor ### Parameters - **p** (OrtEnv *) - Pointer to an OrtEnv object. ``` -------------------------------- ### MemoryInfoGetName Source: https://onnxruntime.ai/docs/api/c/onnxruntime__c__api_8h_source.html Get the name from OrtMemoryInfo. ```APIDOC ## MemoryInfoGetName Get the name from OrtMemoryInfo. ### Parameters - **ptr** (const OrtMemoryInfo *) - Pointer to the OrtMemoryInfo. - **out** (const char **) - Pointer to store the name string. ### Returns - OrtStatus * - Status of the operation. ``` -------------------------------- ### GetInputCount() Source: https://onnxruntime.ai/docs/api/c/functions_g.html Gets the number of inputs. ```APIDOC ## GetInputCount() ### Description Retrieves the total number of inputs for a session, kernel context, or shape inference context. ### Method Not applicable (function signature) ### Endpoint Not applicable (function signature) ### Parameters None explicitly documented. ### Request Example None available. ### Response - **Ort::detail::ConstSessionImpl< T >, Ort::KernelContext, Ort::ShapeInferContext**: The count of inputs. ``` -------------------------------- ### StartProfiling Source: https://onnxruntime.ai/docs/api/c/struct_ort_ep_profiler_impl-members.html Starts the overall profiling session with an optional offset. ```APIDOC ## StartProfiling ### Description Initiates the profiling session. An optional offset in nanoseconds can be provided to align profiling with specific execution points. ### Method `StartProfiling(OrtEpProfilerImpl *this_ptr, int64_t ep_profiling_start_offset_ns)` ### Parameters - **this_ptr** (*OrtEpProfilerImpl* *) - Pointer to the OrtEpProfilerImpl instance. - **ep_profiling_start_offset_ns** (*int64_t*) - The offset in nanoseconds from which profiling should begin. Use 0 to start immediately. ``` -------------------------------- ### GetInitializers() Source: https://onnxruntime.ai/docs/api/c/functions_g.html Gets all initializers from a graph. ```APIDOC ## GetInitializers() ### Description Retrieves all initializers present in the ONNX graph. ### Method Not applicable (function signature) ### Endpoint Not applicable (function signature) ### Parameters None explicitly documented. ### Request Example None available. ### Response - **Ort::detail::ConstGraphImpl< T >**: The graph object. ``` -------------------------------- ### Run (returning user provided outputs) Source: https://onnxruntime.ai/docs/api/c/onnxruntime__cxx__api_8h_source.html Executes the model and populates user-provided output buffers. This method offers direct control over output memory management. ```APIDOC ## Run (returning user provided outputs) ### Description Run the model returning results in user provided outputs. Same as Run(const RunOptions&,...) ### Signature ```cpp 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) ``` ``` -------------------------------- ### GetId() Source: https://onnxruntime.ai/docs/api/c/functions_g.html Gets the ID of a node. ```APIDOC ## GetId() ### Description Retrieves the unique identifier for a node within the ONNX graph. ### Method Not applicable (function signature) ### Endpoint Not applicable (function signature) ### Parameters None explicitly documented. ### Request Example None available. ### Response - **Ort::detail::ConstNodeImpl< T >**: The node object. ``` -------------------------------- ### GetGraphView() Source: https://onnxruntime.ai/docs/api/c/functions_g.html Gets a view of the graph. ```APIDOC ## GetGraphView() ### Description Retrieves a view of the ONNX graph, allowing for inspection of its structure. ### Method Not applicable (function signature) ### Endpoint Not applicable (function signature) ### Parameters None explicitly documented. ### Request Example None available. ### Response - **Ort::detail::ConstGraphImpl< T >**: A view of the graph. ``` -------------------------------- ### OrtEnvCreationOptions Source: https://onnxruntime.ai/docs/api/c/classes.html Options for creating an ONNX Runtime environment. ```APIDOC ## Struct: OrtEnvCreationOptions ### Description Options for creating an ONNX Runtime environment. ### Fields - **Version** (uint64_t) - Version of the environment creation options structure. ``` -------------------------------- ### GetGraph() Source: https://onnxruntime.ai/docs/api/c/functions_g.html Gets the graph from a node. ```APIDOC ## GetGraph() ### Description Retrieves the graph object that contains the given node. ### Method Not applicable (function signature) ### Endpoint Not applicable (function signature) ### Parameters None explicitly documented. ### Request Example None available. ### Response - **Ort::detail::ConstNodeImpl< T >**: The node object from which the graph is retrieved. ``` -------------------------------- ### Ort::Env::GetEpDevices() const Source: https://onnxruntime.ai/docs/api/c/struct_ort_1_1_env.html Retrieves a list of available execution provider devices. ```APIDOC ## GetEpDevices() const ### Description Retrieves a list of available execution provider devices. ### Method Member Function ### Returns A std::vector of ConstEpDevice objects. ``` -------------------------------- ### OrtKernelImpl::PrePackWeight Source: https://onnxruntime.ai/docs/api/c/functions_p.html Pre-packs weights for efficient use by ONNX Runtime kernels. ```APIDOC ## PrePackWeight() : OrtKernelImpl ### Description Pre-packs weights to optimize kernel performance. ### Method `PrePackWeight()` ### Endpoint N/A (C++ API) ### Parameters None explicitly documented in this snippet. ### Request Example N/A ### Response N/A ``` -------------------------------- ### GetDimensions() Source: https://onnxruntime.ai/docs/api/c/functions_g.html Gets the dimensions of a tensor. ```APIDOC ## GetDimensions() ### Description Retrieves the dimensions (shape) of a tensor. ### Method Not applicable (function signature) ### Endpoint Not applicable (function signature) ### Parameters None explicitly documented. ### Request Example None available. ### Response - **Ort::detail::TensorTypeAndShapeInfoImpl< T >, OrtApi**: Returns the tensor dimensions. ``` -------------------------------- ### GetDeviceType() Source: https://onnxruntime.ai/docs/api/c/functions_g.html Gets the device type. ```APIDOC ## GetDeviceType() ### Description Retrieves the type of the device (e.g., CPU, GPU). ### Method Not applicable (function signature) ### Endpoint Not applicable (function signature) ### Parameters None explicitly documented. ### Request Example None available. ### Response - **Ort::detail::MemoryInfoImpl< T >**: The memory information object. ``` -------------------------------- ### OrtEp::OnRunStart Source: https://onnxruntime.ai/docs/api/c/struct_ort_ep-members.html Callback function executed at the start of a run. ```APIDOC ## OrtEp::OnRunStart ### Description Callback function executed at the start of a run. ### Method OrtEp ### Parameters - **this_ptr** (OrtEp *) - Pointer to the OrtEp instance. - **run_options** (const OrtRunOptions *) - Options for the run. ``` -------------------------------- ### GetConsumers() Source: https://onnxruntime.ai/docs/api/c/functions_g.html Gets the consumers of a value. ```APIDOC ## GetConsumers() ### Description Retrieves the nodes that consume a specific value within the ONNX graph. ### Method Not applicable (function signature) ### Endpoint Not applicable (function signature) ### Parameters None explicitly documented. ### Request Example None available. ### Response - **Ort::detail::ConstValueInfoImpl< T >**: The value information object from which consumers are retrieved. ``` -------------------------------- ### Ort::Env::GetEpDevices() Source: https://onnxruntime.ai/docs/api/c/struct_ort_1_1_env.html Retrieves a list of available execution provider devices. ```APIDOC ## Ort::Env::GetEpDevices() ### Description Retrieves a list of available execution provider devices. ### Returns A vector of ConstEpDevice objects representing the available devices. ### Const ``` -------------------------------- ### OnRunStart Source: https://onnxruntime.ai/docs/api/c/functions_func_o.html Represents the start of a run, likely within an execution provider context. ```APIDOC ## OnRunStart() ### Description Called when a run operation is about to start. ### Method (Implicitly a function call) ### Endpoint N/A (C++ API) ### Parameters None explicitly documented. ### Request Example N/A ### Response N/A ``` -------------------------------- ### GetAttributes() Source: https://onnxruntime.ai/docs/api/c/functions_g.html Gets all attributes from a node. ```APIDOC ## GetAttributes() ### Description Retrieves all attributes associated with a node. ### Method Not applicable (function signature) ### Endpoint Not applicable (function signature) ### Parameters None explicitly documented. ### Request Example None available. ### Response - **Ort::detail::ConstNodeImpl< T >**: The node object from which the attributes are retrieved. ``` -------------------------------- ### GetArgValue() Source: https://onnxruntime.ai/docs/api/c/functions_g.html Gets the value of an argument. ```APIDOC ## GetArgValue() ### Description Retrieves the value of a specific argument from a profiling event. ### Method Not applicable (function signature) ### Endpoint Not applicable (function signature) ### Parameters None explicitly documented. ### Request Example None available. ### Response - **Ort::detail::ConstProfilingEventImpl< T >**: The profiling event object from which the argument value is retrieved. ``` -------------------------------- ### RunOptions Constructors Source: https://onnxruntime.ai/docs/api/c/struct_ort_1_1_run_options.html Provides documentation for the constructors of the RunOptions class. ```APIDOC ## RunOptions() [1/2] `explicit inline Ort::RunOptions::RunOptions (std::nullptr_t)` Create an empty RunOptions object, must be assigned a valid one to be used. ``` ```APIDOC ## RunOptions() [2/2] `Ort::RunOptions::RunOptions ()` Wraps OrtApi::CreateRunOptions. ``` -------------------------------- ### GetAllocatorType() Source: https://onnxruntime.ai/docs/api/c/functions_g.html Gets the type of the allocator. ```APIDOC ## GetAllocatorType() ### Description Retrieves the type of the memory allocator. ### Method Not applicable (function signature) ### Endpoint Not applicable (function signature) ### Parameters None explicitly documented. ### Request Example None available. ### Response - **Ort::detail::MemoryInfoImpl< T >**: The memory information object containing the allocator's type. ``` -------------------------------- ### CreateEpDevice Source: https://onnxruntime.ai/docs/api/c/struct_ort_ep_api.html Creates an OrtEpDevice for the execution provider and a given hardware device. ```APIDOC ## CreateEpDevice() ### Description Create an OrtEpDevice for the EP and an OrtHardwareDevice. ### Method OrtStatus * OrtEpApi::CreateEpDevice(const OrtEpFactory * _ep_factory, const OrtHardwareDevice * _hardware_device, const OrtKeyValuePairs * _ep_metadata, const OrtKeyValuePairs * _ep_options, OrtEpDevice ** _ep_device) ### Parameters #### Path Parameters - **_ep_factory** (const OrtEpFactory *) - [in] Execution provider factory that is creating the instance. - **_hardware_device** (const OrtHardwareDevice *) - [in] Hardware device that the EP can utilize. - **_ep_metadata** (const OrtKeyValuePairs *) - [in] Optional OrtKeyValuePairs instance for execution provider metadata that may be used during execution provider selection and passed to CreateEp. ep_device will copy this instance and the user should call ReleaseKeyValuePairs. - **_ep_options** (const OrtKeyValuePairs *) - [in] Optional OrtKeyValuePairs instance for execution provider options that will be added to the Session configuration options if the execution provider is selected. ep_device will copy this instance and the user should call ReleaseKeyValuePairs. #### Query Parameters - **_ep_device** (OrtEpDevice **) - [out] OrtExecutionDevice that is created. ### Returns - OrtStatus *: If no error, nullptr will be returned. If there is an error, a pointer to an OrtStatus that contains error details will be returned. Use OrtApi::ReleaseStatus to free this pointer. ``` -------------------------------- ### Create External Resource Importer for Device Source: https://onnxruntime.ai/docs/api/c/struct_ort_interop_api.html Creates an external resource importer for a specific execution provider device. This is the entry point for importing external resources. ```c OrtStatus * | CreateExternalResourceImporterForDevice (const OrtEpDevice *ep_device, OrtExternalResourceImporter **out_importer) ``` -------------------------------- ### GetAllocatorName() Source: https://onnxruntime.ai/docs/api/c/functions_g.html Gets the name of the allocator. ```APIDOC ## GetAllocatorName() ### Description Retrieves the name of the memory allocator. ### Method Not applicable (function signature) ### Endpoint Not applicable (function signature) ### Parameters None explicitly documented. ### Request Example None available. ### Response - **Ort::detail::MemoryInfoImpl< T >**: The memory information object containing the allocator's name. ``` -------------------------------- ### GetOutputCount Source: https://onnxruntime.ai/docs/api/c/functions_func_g.html Gets the number of outputs. ```APIDOC ## GetOutputCount ### Description Retrieves the total number of outputs from a session or kernel context. ### Method (Not specified, likely a member function) ### Endpoint (Not applicable for C++ API) ### Parameters (Not specified) ### Request Example (Not applicable for C++ API) ### Response - Ort::detail::ConstSessionImpl< T > - Ort::KernelContext ``` -------------------------------- ### OrtStatus * CreateAndRegisterAllocatorV2(OrtEnv *env, const char *provider_type, const OrtMemoryInfo *mem_info, const OrtArenaCfg *arena_cfg, const char *const *provider_options_keys, const char *const *provider_options_values, size_t num_keys) Source: https://onnxruntime.ai/docs/api/c/onnxruntime__c__api_8h_source.html Create an allocator with specific type and register it with the OrtEnv. This API enhances CreateAndRegi... ```APIDOC ## CreateAndRegisterAllocatorV2 ### Description Creates an allocator of a specific type and registers it with the OrtEnv. This API is an enhancement over CreateAndRegisterAllocator. ### Parameters - **env** (OrtEnv *) - The ONNX Runtime environment. - **provider_type** (const char *) - The type of the allocator provider. - **mem_info** (const OrtMemoryInfo *) - Memory information for the allocator. - **arena_cfg** (const OrtArenaCfg *) - Arena configuration for the allocator. - **provider_options_keys** (const char *const *) - Array of keys for provider-specific options. - **provider_options_values** (const char *const *) - Array of values for provider-specific options. - **num_keys** (size_t) - The number of provider options. ### Returns - **OrtStatus *** - Status of the operation. ``` -------------------------------- ### OrtStatus * GetHardwareDevices(const OrtEnv *env, const OrtHardwareDevice **devices, size_t num_devices) Source: https://onnxruntime.ai/docs/api/c/onnxruntime__c__api_8h_source.html Retrieves a list of available hardware devices. ```APIDOC ## GetHardwareDevices ### Description Get the list of available hardware devices. ### Signature OrtStatus * GetHardwareDevices(const OrtEnv *env, const OrtHardwareDevice **devices, size_t num_devices) ``` -------------------------------- ### OrtStatus * CreateSession(const OrtEnv *env, const char *model_path, const OrtSessionOptions *options, OrtSession **out) Source: https://onnxruntime.ai/docs/api/c/onnxruntime__c__api_8h_source.html Creates an ONNX Runtime session by loading a model from a specified file path. ```APIDOC ## CreateSession ### Description Create an OrtSession from a model file. ### Signature OrtStatus * CreateSession(const OrtEnv *env, const char *model_path, const OrtSessionOptions *options, OrtSession **out) ``` -------------------------------- ### OrtApi::MemoryInfoGetMemType Source: https://onnxruntime.ai/docs/api/c/onnxruntime__c__api_8h_source.html Get the OrtMemType from OrtMemoryInfo. ```APIDOC ## OrtApi::MemoryInfoGetMemType ### Description Get the OrtMemType from OrtMemoryInfo. ### Signature ```c OrtStatus * MemoryInfoGetMemType(const OrtMemoryInfo *ptr, OrtMemType *out) ``` ``` -------------------------------- ### KernelInfo_GetOutputCount Source: https://onnxruntime.ai/docs/api/c/struct_ort_api-members.html Gets the number of outputs for a kernel. ```APIDOC ## KernelInfo_GetOutputCount ### Description Retrieves the number of outputs defined for a kernel. ### Signature ```c void KernelInfo_GetOutputCount(const OrtKernelInfo *info, size_t *out) ``` ### Parameters - **info** (const OrtKernelInfo *) - Pointer to the kernel information structure. - **out** (size_t *) - Pointer to a size_t where the output count will be stored. ### Returns - void ``` -------------------------------- ### CreateEpDevice Source: https://onnxruntime.ai/docs/api/c/struct_ort_ep_api.html Creates an OrtEpDevice for a given execution provider factory, hardware device, metadata, and options. ```APIDOC ## CreateEpDevice ### Description Creates an OrtEpDevice for the EP and an OrtHardwareDevice. ### Signature OrtStatus * CreateEpDevice (OrtEpFactory *ep_factory, const OrtHardwareDevice *hardware_device, const OrtKeyValuePairs *ep_metadata, const OrtKeyValuePairs *ep_options, OrtEpDevice **ep_device) ``` -------------------------------- ### KernelInfo_GetInputCount Source: https://onnxruntime.ai/docs/api/c/struct_ort_api-members.html Gets the number of inputs for a kernel. ```APIDOC ## KernelInfo_GetInputCount ### Description Retrieves the number of inputs defined for a kernel. ### Signature ```c void KernelInfo_GetInputCount(const OrtKernelInfo *info, size_t *out) ``` ### Parameters - **info** (const OrtKernelInfo *) - Pointer to the kernel information structure. - **out** (size_t *) - Pointer to a size_t where the input count will be stored. ### Returns - void ``` -------------------------------- ### CreateEpDevice Source: https://onnxruntime.ai/docs/api/c/onnxruntime__ep__c__api_8h_source.html Creates an OrtEpDevice for the EP and an OrtHardwareDevice. ```APIDOC ## CreateEpDevice ### Description Create an OrtEpDevice for the EP and an OrtHardwareDevice. ### Signature ```c OrtStatus * CreateEpDevice(OrtEpFactory *ep_factory, const OrtHardwareDevice *hardware_device, const OrtKeyValuePairs *ep_metadata, const OrtKeyValuePairs *ep_options, OrtEpDevice **ep_device) ``` ``` -------------------------------- ### GetVersion Source: https://onnxruntime.ai/docs/api/c/struct_ort_ep_factory.html Gets the version of the execution provider. ```APIDOC ## GetVersion ### Description Get the version of the execution provider that the factory creates. ### Signature const char * GetVersion (const OrtEpFactory *this_ptr) ### Parameters - **this_ptr** (const OrtEpFactory *) - Pointer to the OrtEpFactory instance. ### Returns - **const char *** - The version of the execution provider. ``` -------------------------------- ### Custom Op GetStartVersion Source: https://onnxruntime.ai/docs/api/c/onnxruntime__cxx__api_8h_source.html Retrieves the starting version of the custom operator's support. ```cpp OrtCustomOp::GetStartVersion = [](const OrtCustomOp* this_) { return static_cast(this_)->start_ver_; }; ``` -------------------------------- ### Run (with IoBinding) Source: https://onnxruntime.ai/docs/api/c/onnxruntime__cxx__api_8h_source.html Executes the model using an IoBinding object, which manages input and output data. This is a high-level wrapper for running the model. ```APIDOC ## Run (with IoBinding) ### Description Wraps OrtApi::RunWithBinding. Executes the model using the provided IoBinding. ### Signature ```cpp void Run(const RunOptions &run_options, const IoBinding &) ``` ``` -------------------------------- ### OrtEpFactory::GetCustomOpDomains Source: https://onnxruntime.ai/docs/api/c/onnxruntime__ep__c__api_8h_source.html Gets the EP-specific OrtCustomOpDomains. ```APIDOC ## OrtEpFactory::GetCustomOpDomains ### Description Gets the EP-specific OrtCustomOpDomains. ### Signature ```c OrtStatus * GetCustomOpDomains(OrtEpFactory *this_ptr, OrtCustomOpDomain **domains, size_t num_domains) ``` ``` -------------------------------- ### GetInput() Source: https://onnxruntime.ai/docs/api/c/functions_g.html Gets an input from the kernel context. ```APIDOC ## GetInput() ### Description Retrieves a specific input tensor from the kernel context. ### Method Not applicable (function signature) ### Endpoint Not applicable (function signature) ### Parameters None explicitly documented. ### Request Example None available. ### Response - **Ort::KernelContext**: The kernel context object. ``` -------------------------------- ### Perform a Training Step Source: https://onnxruntime.ai/docs/api/c/onnxruntime__training__cxx__api_8h_source.html Executes a single training step using the provided input values and returns the output values. ```cpp std::vector TrainStep(const std::vector& input_values); ``` -------------------------------- ### GetInitializer() Source: https://onnxruntime.ai/docs/api/c/functions_g.html Gets an initializer from value info. ```APIDOC ## GetInitializer() ### Description Retrieves an initializer (a constant tensor used as input) from the value information. ### Method Not applicable (function signature) ### Endpoint Not applicable (function signature) ### Parameters None explicitly documented. ### Request Example None available. ### Response - **Ort::detail::ConstValueInfoImpl< T >**: The value information object. ``` -------------------------------- ### CreateHardwareDevice Source: https://onnxruntime.ai/docs/api/c/struct_ort_ep_api.html Creates an OrtHardwareDevice instance. ```APIDOC ## CreateHardwareDevice() ### Description Create an OrtHardwareDevice. Note: Called within OrtEpFactory::GetSupportedDevices to create a new hardware device (e.g., virtual). ### Method OrtStatus * OrtEpApi::CreateHardwareDevice(OrtHardwareDeviceType _type, uint32_t _vendor_id, uint32_t _device_id, const char * _vendor_name, const OrtKeyValuePairs * _metadata, OrtHardwareDevice ** _hardware_device) ### Parameters #### Path Parameters - **_type** (OrtHardwareDeviceType) - [in] The hardware device type. - **_vendor_id** (uint32_t) - [in] The hardware device's vendor identifier. - **_device_id** (uint32_t) - [in] The hardware device's identifier. - **_vendor_name** (const char *) - [in] The hardware device's vendor name as a null-terminated string. Copied by ORT. - **_metadata** (const OrtKeyValuePairs *) - [in] Optional OrtKeyValuePairs instance for hardware device metadata that may be queried by applications via OrtApi::GetEpDevices(). Refer to onnxruntime_ep_device_ep_metadata_keys.h for common OrtHardwareDevice metadata keys. #### Query Parameters - **_hardware_device** (OrtHardwareDevice **) - [out] Output parameter set to the new OrtHardwareDevice instance that is created. Must be release with ReleaseHardwareDevice(). ### Returns - OrtStatus *: If no error, nullptr will be returned. If there is an error, a pointer to an OrtStatus that contains error details will be returned. Use OrtApi::ReleaseStatus to free this pointer. ``` -------------------------------- ### GetImplicitInputs() Source: https://onnxruntime.ai/docs/api/c/functions_g.html Gets implicit inputs of a node. ```APIDOC ## GetImplicitInputs() ### Description Retrieves the list of implicit inputs for a given node in the graph. ### Method Not applicable (function signature) ### Endpoint Not applicable (function signature) ### Parameters None explicitly documented. ### Request Example None available. ### Response - **Ort::detail::ConstNodeImpl< T >**: The node object. ``` -------------------------------- ### CreateEnv Source: https://onnxruntime.ai/docs/api/c/onnxruntime__c__api_8h_source.html Creates a new ONNX Runtime environment. ```APIDOC ## CreateEnv ### Description Create an OrtEnv. ### Signature OrtStatus * CreateEnv(OrtLoggingLevel log_severity_level, const char *logid, OrtEnv **out) ``` -------------------------------- ### Session() Source: https://onnxruntime.ai/docs/api/c/functions_s.html Creates a new ONNX Runtime session. ```APIDOC ## Session() ### Description Initializes and returns a new ONNX Runtime session object. This session is used to load and run ONNX models. ### Returns - Ort::Session: The created ONNX Runtime session object. ``` -------------------------------- ### GetHandle() Source: https://onnxruntime.ai/docs/api/c/functions_g.html Gets the handle from a stream object. ```APIDOC ## GetHandle() ### Description Retrieves the underlying handle from a stream object (e.g., a synchronization stream). ### Method Not applicable (function signature) ### Endpoint Not applicable (function signature) ### Parameters None explicitly documented. ### Request Example None available. ### Response - **Ort::detail::SyncStreamImpl< T >, OrtSyncStreamImpl**: The stream handle. ``` -------------------------------- ### CreateTrainingSession Source: https://onnxruntime.ai/docs/api/c/onnxruntime__training__c__api_8h_source.html Creates a training session with the provided environment, options, checkpoint state, and model paths. ```APIDOC ## CreateTrainingSession ### Description Creates a training session with the provided environment, options, checkpoint state, and model paths. ### Method ORT_API2_STATUS ### Parameters #### Input Parameters - **env** (const OrtEnv*) - Input - The ONNX Runtime environment. - **options** (const OrtSessionOptions*) - Input - Session options for the training. - **checkpoint_state** (OrtCheckpointState*) - Input/Output - The checkpoint state to use for training. - **train_model_path** (const ORTCHAR_T*) - Input - Path to the training model. - **eval_model_path** (const ORTCHAR_T*) - Input - Path to the evaluation model. - **optimizer_model_path** (const ORTCHAR_T*) - Input - Path to the optimizer model. #### Output Parameters - **out** (OrtTrainingSession**) - Output - Pointer to the created training session. ``` -------------------------------- ### GetFlattenedConfigs() Source: https://onnxruntime.ai/docs/api/c/functions_g.html Gets flattened configuration options. ```APIDOC ## GetFlattenedConfigs() ### Description Retrieves a flattened view of all configuration options available for custom operations. ### Method Not applicable (function signature) ### Endpoint Not applicable (function signature) ### Parameters None explicitly documented. ### Request Example None available. ### Response - **Ort::CustomOpConfigs**: The custom operation configurations object. ``` -------------------------------- ### Run Source: https://onnxruntime.ai/docs/api/c/struct_ort_1_1detail_1_1_session_impl-members.html Executes the inference session with specified inputs and outputs. ```APIDOC ## Run ### Description Executes the inference session with specified inputs and outputs. This method has multiple overloads to accommodate different ways of specifying inputs and outputs, including using an IoBinding. ### Method `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)` ### Parameters * **run_options** (const RunOptions &) - Options for running the session. * **input_names** (const char *const *) - Array of input names. * **input_values** (const Value *) - Array of input values. * **input_count** (size_t) - Number of inputs. * **output_names** (const char *const *) - Array of output names. * **output_count** (size_t) - Number of outputs. ### Method `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)` ### Parameters * **run_options** (const RunOptions &) - Options for running the session. * **input_names** (const char *const *) - Array of input names. * **input_values** (const Value *) - Array of input values. * **input_count** (size_t) - Number of inputs. * **output_names** (const char *const *) - Array of output names. * **output_values** (Value *) - Array to store output values. * **output_count** (size_t) - Number of outputs. ### Method `Run(const RunOptions &run_options, const IoBinding &)` ### Parameters * **run_options** (const RunOptions &) - Options for running the session. * **IoBinding** (const IoBinding &) - An IoBinding object specifying inputs and outputs. ### Endpoint N/A (Method) ``` -------------------------------- ### GetExternalInitializerInfo() Source: https://onnxruntime.ai/docs/api/c/functions_g.html Gets external initializer information. ```APIDOC ## GetExternalInitializerInfo() ### Description Retrieves information about an external initializer used in the model. ### Method Not applicable (function signature) ### Endpoint Not applicable (function signature) ### Parameters None explicitly documented. ### Request Example None available. ### Response - **Ort::detail::ConstValueInfoImpl< T >**: The value information object for the external initializer. ``` -------------------------------- ### GetExecutionProviderType() Source: https://onnxruntime.ai/docs/api/c/functions_g.html Gets the type of the execution provider. ```APIDOC ## GetExecutionProviderType() ### Description Retrieves the type of the execution provider (e.g., 'CPU', 'CUDA'). ### Method Not applicable (function signature) ### Endpoint Not applicable (function signature) ### Parameters None explicitly documented. ### Request Example None available. ### Response - **Ort::CustomOpBase< TOp, TKernel, WithStatus >, OrtCustomOp**: The type of the execution provider. ``` -------------------------------- ### Ort::detail::EpDeviceImpl::EpOptions Source: https://onnxruntime.ai/docs/api/c/onnxruntime__cxx__api_8h_source.html Returns the options associated with the execution provider device. ```APIDOC ## Ort::detail::EpDeviceImpl::EpOptions ### Description Returns the options associated with the execution provider device. ### Signature ```cpp ConstKeyValuePairs EpOptions() const ``` ``` -------------------------------- ### GetExecutionProviderApi() Source: https://onnxruntime.ai/docs/api/c/functions_g.html Gets the execution provider API. ```APIDOC ## GetExecutionProviderApi() ### Description Retrieves the API object for interacting with execution providers. ### Method Not applicable (function signature) ### Endpoint Not applicable (function signature) ### Parameters None explicitly documented. ### Request Example None available. ### Response - **OrtApi**: The OrtApi object. ``` -------------------------------- ### OrtStatus * GetHardwareDeviceEpIncompatibilityDetails(const OrtEnv *env, const char *ep_name, const OrtHardwareDevice *hw, OrtDeviceEpIncompatibilityDetails **details) Source: https://onnxruntime.ai/docs/api/c/onnxruntime__c__api_8h_source.html Retrieves details about the incompatibility between a hardware device and an execution provider. ```APIDOC ## GetHardwareDeviceEpIncompatibilityDetails ### Description Get the details about the incompatibility between a hardware device and an execution provider. ### Signature OrtStatus * GetHardwareDeviceEpIncompatibilityDetails(const OrtEnv *env, const char *ep_name, const OrtHardwareDevice *hw, OrtDeviceEpIncompatibilityDetails **details) ``` -------------------------------- ### GetEpName() Source: https://onnxruntime.ai/docs/api/c/functions_g.html Gets the name of the execution provider. ```APIDOC ## GetEpName() ### Description Retrieves the name of the execution provider for a given node or subgraph. ### Method Not applicable (function signature) ### Endpoint Not applicable (function signature) ### Parameters None explicitly documented. ### Request Example None available. ### Response - **Ort::detail::ConstNodeImpl< T >, Ort::detail::EpAssignedSubgraphImpl< T >**: The name of the execution provider. ``` -------------------------------- ### OrtEpFactory::GetSupportedDevices Source: https://onnxruntime.ai/docs/api/c/onnxruntime__ep__c__api_8h_source.html Gets information from the execution provider about hardware device support. ```APIDOC ## OrtEpFactory::GetSupportedDevices ### Description Get information from the execution provider about OrtHardwareDevice support. ### Signature ```c OrtStatus * GetSupportedDevices(OrtEpFactory *this_ptr, const OrtHardwareDevice *const *devices, size_t num_devices, OrtEpDevice **ep_devices, size_t max_ep_devices, size_t *num_ep_devices) ``` ``` -------------------------------- ### GetEnvConfigEntries() Source: https://onnxruntime.ai/docs/api/c/functions_g.html Gets configuration entries from the environment. ```APIDOC ## GetEnvConfigEntries() ### Description Retrieves configuration entries stored within the ONNX Runtime environment. ### Method Not applicable (function signature) ### Endpoint Not applicable (function signature) ### Parameters None explicitly documented. ### Request Example None available. ### Response - **OrtEpApi**: The execution provider API object. ``` -------------------------------- ### OrtEnvCreationOptions Source: https://onnxruntime.ai/docs/api/c/group___global.html Configuration options for creating an OrtEnv. ```APIDOC ## struct OrtEnvCreationOptions ### Description Configuration options for creating an OrtEnv. ### Type struct ```