1#![allow(non_upper_case_globals)]
2#![allow(non_camel_case_types)]
3#![allow(non_snake_case)]
4#![allow(clippy::type_complexity)]
5#![allow(clippy::missing_safety_doc)]
6#![cfg_attr(all(not(test), not(feature = "std")), no_std)]
7
8extern crate alloc;
9extern crate core;
10
11#[doc(hidden)]
12#[cfg(feature = "std")]
13pub mod internal;
14pub mod stub;
15mod version;
16
17#[cfg(link_error)]
18mod link_error;
19
20pub use core::ffi::{c_char, c_int, c_ulong, c_ulonglong, c_ushort, c_void};
21
22pub use self::version::ORT_API_VERSION;
23
24#[cfg(target_os = "windows")]
25pub type os_char = c_ushort;
26#[cfg(not(target_os = "windows"))]
27pub type os_char = c_char;
28
29#[deprecated = "use `os_char` instead"]
30pub type ortchar = os_char;
31
32#[repr(i32)]
33#[doc = " Copied from TensorProto::DataType\n Currently, Ort doesn't support complex64, complex128"]
34#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
35pub enum ONNXTensorElementDataType {
36 ONNX_TENSOR_ELEMENT_DATA_TYPE_UNDEFINED = 0,
37 ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT = 1,
38 ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT8 = 2,
39 ONNX_TENSOR_ELEMENT_DATA_TYPE_INT8 = 3,
40 ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT16 = 4,
41 ONNX_TENSOR_ELEMENT_DATA_TYPE_INT16 = 5,
42 ONNX_TENSOR_ELEMENT_DATA_TYPE_INT32 = 6,
43 ONNX_TENSOR_ELEMENT_DATA_TYPE_INT64 = 7,
44 ONNX_TENSOR_ELEMENT_DATA_TYPE_STRING = 8,
45 ONNX_TENSOR_ELEMENT_DATA_TYPE_BOOL = 9,
46 ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT16 = 10,
47 ONNX_TENSOR_ELEMENT_DATA_TYPE_DOUBLE = 11,
48 ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT32 = 12,
49 ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT64 = 13,
50 ONNX_TENSOR_ELEMENT_DATA_TYPE_COMPLEX64 = 14,
51 ONNX_TENSOR_ELEMENT_DATA_TYPE_COMPLEX128 = 15,
52 ONNX_TENSOR_ELEMENT_DATA_TYPE_BFLOAT16 = 16,
53 ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT8E4M3FN = 17,
54 ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT8E4M3FNUZ = 18,
55 ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT8E5M2 = 19,
56 ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT8E5M2FNUZ = 20,
57 ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT4 = 21,
58 ONNX_TENSOR_ELEMENT_DATA_TYPE_INT4 = 22
59}
60#[repr(i32)]
61#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
62pub enum ONNXType {
63 ONNX_TYPE_UNKNOWN = 0,
64 ONNX_TYPE_TENSOR = 1,
65 ONNX_TYPE_SEQUENCE = 2,
66 ONNX_TYPE_MAP = 3,
67 ONNX_TYPE_OPAQUE = 4,
68 ONNX_TYPE_SPARSETENSOR = 5,
69 ONNX_TYPE_OPTIONAL = 6
70}
71#[repr(i32)]
72#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
73pub enum OrtSparseFormat {
74 ORT_SPARSE_UNDEFINED = 0,
75 ORT_SPARSE_COO = 1,
76 ORT_SPARSE_CSRC = 2,
77 ORT_SPARSE_BLOCK_SPARSE = 4
78}
79#[repr(i32)]
80#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
81pub enum OrtSparseIndicesFormat {
82 ORT_SPARSE_COO_INDICES = 0,
83 ORT_SPARSE_CSR_INNER_INDICES = 1,
84 ORT_SPARSE_CSR_OUTER_INDICES = 2,
85 ORT_SPARSE_BLOCK_SPARSE_INDICES = 3
86}
87#[repr(i32)]
88#[doc = " \\brief Logging severity levels\n\n In typical API usage, specifying a logging severity level specifies the minimum severity of log messages to show."]
89#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
90pub enum OrtLoggingLevel {
91 #[doc = "< Verbose informational messages (least severe)."]
92 ORT_LOGGING_LEVEL_VERBOSE = 0,
93 #[doc = "< Informational messages."]
94 ORT_LOGGING_LEVEL_INFO = 1,
95 #[doc = "< Warning messages."]
96 ORT_LOGGING_LEVEL_WARNING = 2,
97 #[doc = "< Error messages."]
98 ORT_LOGGING_LEVEL_ERROR = 3,
99 #[doc = "< Fatal error messages (most severe)."]
100 ORT_LOGGING_LEVEL_FATAL = 4
101}
102#[repr(i32)]
103#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
104pub enum OrtErrorCode {
105 ORT_OK = 0,
106 ORT_FAIL = 1,
107 ORT_INVALID_ARGUMENT = 2,
108 ORT_NO_SUCHFILE = 3,
109 ORT_NO_MODEL = 4,
110 ORT_ENGINE_ERROR = 5,
111 ORT_RUNTIME_EXCEPTION = 6,
112 ORT_INVALID_PROTOBUF = 7,
113 ORT_MODEL_LOADED = 8,
114 ORT_NOT_IMPLEMENTED = 9,
115 ORT_INVALID_GRAPH = 10,
116 ORT_EP_FAIL = 11
117}
118#[repr(i32)]
119#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
120pub enum OrtOpAttrType {
121 ORT_OP_ATTR_UNDEFINED = 0,
122 ORT_OP_ATTR_INT = 1,
123 ORT_OP_ATTR_INTS = 2,
124 ORT_OP_ATTR_FLOAT = 3,
125 ORT_OP_ATTR_FLOATS = 4,
126 ORT_OP_ATTR_STRING = 5,
127 ORT_OP_ATTR_STRINGS = 6
128}
129#[repr(C)]
130#[derive(Debug, Copy, Clone)]
131pub struct OrtEnv {
132 _unused: [u8; 0]
133}
134#[repr(C)]
135#[derive(Debug, Copy, Clone)]
136pub struct OrtStatus {
137 _unused: [u8; 0]
138}
139#[repr(C)]
140#[derive(Debug, Copy, Clone)]
141pub struct OrtMemoryInfo {
142 _unused: [u8; 0]
143}
144#[repr(C)]
145#[derive(Debug, Copy, Clone)]
146pub struct OrtIoBinding {
147 _unused: [u8; 0]
148}
149#[repr(C)]
150#[derive(Debug, Copy, Clone)]
151pub struct OrtSession {
152 _unused: [u8; 0]
153}
154#[repr(C)]
155#[derive(Debug, Copy, Clone)]
156pub struct OrtValue {
157 _unused: [u8; 0]
158}
159#[repr(C)]
160#[derive(Debug, Copy, Clone)]
161pub struct OrtRunOptions {
162 _unused: [u8; 0]
163}
164#[repr(C)]
165#[derive(Debug, Copy, Clone)]
166pub struct OrtTypeInfo {
167 _unused: [u8; 0]
168}
169#[repr(C)]
170#[derive(Debug, Copy, Clone)]
171pub struct OrtTensorTypeAndShapeInfo {
172 _unused: [u8; 0]
173}
174#[repr(C)]
175#[derive(Debug, Copy, Clone)]
176pub struct OrtMapTypeInfo {
177 _unused: [u8; 0]
178}
179#[repr(C)]
180#[derive(Debug, Copy, Clone)]
181pub struct OrtSequenceTypeInfo {
182 _unused: [u8; 0]
183}
184#[repr(C)]
185#[derive(Debug, Copy, Clone)]
186pub struct OrtOptionalTypeInfo {
187 _unused: [u8; 0]
188}
189#[repr(C)]
190#[derive(Debug, Copy, Clone)]
191pub struct OrtSessionOptions {
192 _unused: [u8; 0]
193}
194#[repr(C)]
195#[derive(Debug, Copy, Clone)]
196pub struct OrtCustomOpDomain {
197 _unused: [u8; 0]
198}
199#[repr(C)]
200#[derive(Debug, Copy, Clone)]
201pub struct OrtModelMetadata {
202 _unused: [u8; 0]
203}
204#[repr(C)]
205#[derive(Debug, Copy, Clone)]
206pub struct OrtThreadPoolParams {
207 _unused: [u8; 0]
208}
209#[repr(C)]
210#[derive(Debug, Copy, Clone)]
211pub struct OrtThreadingOptions {
212 _unused: [u8; 0]
213}
214#[repr(C)]
215#[derive(Debug, Copy, Clone)]
216pub struct OrtArenaCfg {
217 _unused: [u8; 0]
218}
219#[repr(C)]
220#[derive(Debug, Copy, Clone)]
221pub struct OrtPrepackedWeightsContainer {
222 _unused: [u8; 0]
223}
224#[repr(C)]
225#[derive(Debug, Copy, Clone)]
226pub struct OrtTensorRTProviderOptionsV2 {
227 _unused: [u8; 0]
228}
229#[repr(C)]
230#[derive(Debug, Copy, Clone)]
231pub struct OrtNvTensorRtRtxProviderOptions {
232 _unused: [u8; 0]
233}
234#[repr(C)]
235#[derive(Debug, Copy, Clone)]
236pub struct OrtCUDAProviderOptionsV2 {
237 _unused: [u8; 0]
238}
239#[repr(C)]
240#[derive(Debug, Copy, Clone)]
241pub struct OrtCANNProviderOptions {
242 _unused: [u8; 0]
243}
244#[repr(C)]
245#[derive(Debug, Copy, Clone)]
246pub struct OrtDnnlProviderOptions {
247 _unused: [u8; 0]
248}
249#[repr(C)]
250#[derive(Debug, Copy, Clone)]
251pub struct OrtOp {
252 _unused: [u8; 0]
253}
254#[repr(C)]
255#[derive(Debug, Copy, Clone)]
256pub struct OrtOpAttr {
257 _unused: [u8; 0]
258}
259#[repr(C)]
260#[derive(Debug, Copy, Clone)]
261pub struct OrtLogger {
262 _unused: [u8; 0]
263}
264#[repr(C)]
265#[derive(Debug, Copy, Clone)]
266pub struct OrtShapeInferContext {
267 _unused: [u8; 0]
268}
269#[repr(C)]
270#[derive(Debug, Copy, Clone)]
271pub struct OrtLoraAdapter {
272 _unused: [u8; 0]
273}
274#[repr(C)]
275#[derive(Debug, Copy, Clone)]
276pub struct OrtValueInfo {
277 _unused: [u8; 0]
278}
279#[repr(C)]
280#[derive(Debug, Copy, Clone)]
281pub struct OrtNode {
282 _unused: [u8; 0]
283}
284#[repr(C)]
285#[derive(Debug, Copy, Clone)]
286pub struct OrtGraph {
287 _unused: [u8; 0]
288}
289#[repr(C)]
290#[derive(Debug, Copy, Clone)]
291pub struct OrtModel {
292 _unused: [u8; 0]
293}
294#[repr(C)]
295#[derive(Debug, Copy, Clone)]
296pub struct OrtModelCompilationOptions {
297 _unused: [u8; 0]
298}
299#[repr(C)]
300#[derive(Debug, Copy, Clone)]
301pub struct OrtHardwareDevice {
302 _unused: [u8; 0]
303}
304#[repr(C)]
305#[derive(Debug, Copy, Clone)]
306pub struct OrtEpDevice {
307 _unused: [u8; 0]
308}
309#[repr(C)]
310#[derive(Debug, Copy, Clone)]
311pub struct OrtKeyValuePairs {
312 _unused: [u8; 0]
313}
314#[repr(transparent)]
315#[derive(Debug, Copy, Clone)]
316#[must_use = "statuses must be freed with `OrtApi::ReleaseStatus` if they are not null"]
317pub struct OrtStatusPtr(pub *mut OrtStatus);
318impl Default for OrtStatusPtr {
319 fn default() -> Self {
320 OrtStatusPtr(core::ptr::null_mut())
321 }
322}
323#[doc = " \\brief Memory allocation interface\n\n Structure of function pointers that defines a memory allocator. This can be created and filled in by the user for custom allocators.\n\n When an allocator is passed to any function, be sure that the allocator object is not destroyed until the last allocated object using it is freed."]
324#[repr(C)]
325#[derive(Debug, Copy, Clone)]
326pub struct OrtAllocator {
327 #[doc = "< Must be initialized to ORT_API_VERSION"]
328 pub version: u32,
329 #[doc = "< Returns a pointer to an allocated block of `size` bytes"]
330 pub Alloc: Option<unsafe extern "system" fn(this_: *mut OrtAllocator, size: usize) -> *mut core::ffi::c_void>,
331 #[doc = "< Free a block of memory previously allocated with OrtAllocator::Alloc"]
332 pub Free: Option<unsafe extern "system" fn(this_: *mut OrtAllocator, p: *mut core::ffi::c_void)>,
333 #[doc = "< Return a pointer to an ::OrtMemoryInfo that describes this allocator"]
334 pub Info: Option<unsafe extern "system" fn(this_: *const OrtAllocator) -> *const OrtMemoryInfo>,
335 pub Reserve: Option<unsafe extern "system" fn(this_: *const OrtAllocator, size: usize) -> *mut core::ffi::c_void>
336}
337pub type OrtLoggingFunction = unsafe extern "system" fn(
338 param: *mut core::ffi::c_void,
339 severity: OrtLoggingLevel,
340 category: *const core::ffi::c_char,
341 logid: *const core::ffi::c_char,
342 code_location: *const core::ffi::c_char,
343 message: *const core::ffi::c_char
344);
345#[repr(i32)]
346#[doc = " \\brief Graph optimization level\n\n Refer to https://www.onnxruntime.ai/docs/performance/graph-optimizations.html#graph-optimization-levels\n for an in-depth understanding of the Graph Optimization Levels."]
347#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
348pub enum GraphOptimizationLevel {
349 ORT_DISABLE_ALL = 0,
350 ORT_ENABLE_BASIC = 1,
351 ORT_ENABLE_EXTENDED = 2,
352 ORT_ENABLE_LAYOUT = 3,
353 ORT_ENABLE_ALL = 99
354}
355#[repr(i32)]
356#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
357pub enum ExecutionMode {
358 ORT_SEQUENTIAL = 0,
359 ORT_PARALLEL = 1
360}
361#[repr(i32)]
362#[doc = " \\brief Language projection identifiers\n /see OrtApi::SetLanguageProjection"]
363#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
364pub enum OrtLanguageProjection {
365 ORT_PROJECTION_C = 0,
366 ORT_PROJECTION_CPLUSPLUS = 1,
367 ORT_PROJECTION_CSHARP = 2,
368 ORT_PROJECTION_PYTHON = 3,
369 ORT_PROJECTION_JAVA = 4,
370 ORT_PROJECTION_WINML = 5,
371 ORT_PROJECTION_NODEJS = 6
372}
373#[repr(C)]
374#[derive(Debug, Copy, Clone)]
375pub struct OrtKernelInfo {
376 _unused: [u8; 0]
377}
378#[repr(C)]
379#[derive(Debug, Copy, Clone)]
380pub struct OrtKernelContext {
381 _unused: [u8; 0]
382}
383#[repr(i32)]
384#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
385pub enum OrtAllocatorType {
386 OrtInvalidAllocator = -1,
387 OrtDeviceAllocator = 0,
388 OrtArenaAllocator = 1
389}
390impl OrtMemType {
391 pub const OrtMemTypeCPU: OrtMemType = OrtMemType::OrtMemTypeCPUOutput;
392}
393#[repr(i32)]
394#[doc = " \\brief Memory types for allocated memory, execution provider specific types should be extended in each provider."]
395#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
396pub enum OrtMemType {
397 #[doc = "< Any CPU memory used by non-CPU execution provider"]
398 OrtMemTypeCPUInput = -2,
399 #[doc = "< CPU accessible memory outputted by non-CPU execution provider, i.e. CUDA_PINNED"]
400 OrtMemTypeCPUOutput = -1,
401 #[doc = "< The default allocator for execution provider"]
402 OrtMemTypeDefault = 0
403}
404#[repr(i32)]
405#[doc = " \\brief This mimics OrtDevice type constants so they can be returned in the API"]
406#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
407pub enum OrtMemoryInfoDeviceType {
408 OrtMemoryInfoDeviceType_CPU = 0,
409 OrtMemoryInfoDeviceType_GPU = 1,
410 OrtMemoryInfoDeviceType_FPGA = 2
411}
412#[repr(i32)]
413#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
414pub enum OrtHardwareDeviceType {
415 OrtHardwareDeviceType_CPU = 0,
416 OrtHardwareDeviceType_GPU = 1,
417 OrtHardwareDeviceType_NPU = 2
418}
419#[repr(i32)]
420#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
421pub enum OrtExecutionProviderDevicePolicy {
422 OrtExecutionProviderDevicePolicy_DEFAULT = 0,
423 OrtExecutionProviderDevicePolicy_PREFER_CPU = 1,
424 OrtExecutionProviderDevicePolicy_PREFER_NPU = 2,
425 OrtExecutionProviderDevicePolicy_PREFER_GPU = 3,
426 OrtExecutionProviderDevicePolicy_MAX_PERFORMANCE = 4,
427 OrtExecutionProviderDevicePolicy_MAX_EFFICIENCY = 5,
428 OrtExecutionProviderDevicePolicy_MIN_OVERALL_POWER = 6
429}
430pub type EpSelectionDelegate = Option<
431 unsafe extern "system" fn(
432 ep_devices: *const *const OrtEpDevice,
433 num_devices: usize,
434 model_metadata: *const OrtKeyValuePairs,
435 runtime_metadata: *const OrtKeyValuePairs,
436 selected: *mut *const OrtEpDevice,
437 max_selected: usize,
438 num_selected: *mut usize,
439 state: *mut c_void
440 ) -> OrtStatusPtr
441>;
442#[repr(i32)]
443#[doc = " \\brief Algorithm to use for cuDNN Convolution Op"]
444#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
445pub enum OrtCudnnConvAlgoSearch {
446 OrtCudnnConvAlgoSearchExhaustive = 0,
447 OrtCudnnConvAlgoSearchHeuristic = 1,
448 OrtCudnnConvAlgoSearchDefault = 2
449}
450#[doc = " \\brief CUDA Provider Options\n\n \\see OrtApi::SessionOptionsAppendExecutionProvider_CUDA"]
451#[repr(C)]
452#[derive(Debug, Copy, Clone)]
453pub struct OrtCUDAProviderOptions {
454 #[doc = " \\brief CUDA device Id\n Defaults to 0."]
455 pub device_id: core::ffi::c_int,
456 #[doc = " \\brief CUDA Convolution algorithm search configuration.\n See enum OrtCudnnConvAlgoSearch for more details.\n Defaults to OrtCudnnConvAlgoSearchExhaustive."]
457 pub cudnn_conv_algo_search: OrtCudnnConvAlgoSearch,
458 #[doc = " \\brief CUDA memory limit (To use all possible memory pass in maximum usize)\n Defaults to SIZE_MAX.\n \\note If a ::OrtArenaCfg has been applied, it will override this field"]
459 pub gpu_mem_limit: usize,
460 #[doc = " \\brief Strategy used to grow the memory arena\n 0 = kNextPowerOfTwo<br>\n 1 = kSameAsRequested<br>\n Defaults to 0.\n \\note If a ::OrtArenaCfg has been applied, it will override this field"]
461 pub arena_extend_strategy: core::ffi::c_int,
462 #[doc = " \\brief Flag indicating if copying needs to take place on the same stream as the compute stream in the CUDA EP\n 0 = Use separate streams for copying and compute.\n 1 = Use the same stream for copying and compute.\n Defaults to 1.\n WARNING: Setting this to 0 may result in data races for some models.\n Please see issue #4829 for more details."]
463 pub do_copy_in_default_stream: core::ffi::c_int,
464 #[doc = " \\brief Flag indicating if there is a user provided compute stream\n Defaults to 0."]
465 pub has_user_compute_stream: core::ffi::c_int,
466 #[doc = " \\brief User provided compute stream.\n If provided, please set `has_user_compute_stream` to 1."]
467 pub user_compute_stream: *mut core::ffi::c_void,
468 #[doc = " \\brief CUDA memory arena configuration parameters"]
469 pub default_memory_arena_cfg: *mut OrtArenaCfg,
470 #[doc = " \\brief Enable TunableOp for using.\n Set it to 1/0 to enable/disable TunableOp. Otherwise, it is disabled by default.\n This option can be overriden by environment variable ORT_CUDA_TUNABLE_OP_ENABLE."]
471 pub tunable_op_enable: core::ffi::c_int,
472 #[doc = " \\brief Enable TunableOp for tuning.\n Set it to 1/0 to enable/disable TunableOp tuning. Otherwise, it is disabled by default.\n This option can be overriden by environment variable ORT_CUDA_TUNABLE_OP_TUNING_ENABLE."]
473 pub tunable_op_tuning_enable: core::ffi::c_int,
474 #[doc = " \\brief Max tuning duration time limit for each instance of TunableOp.\n Defaults to 0 to disable the limit."]
475 pub tunable_op_max_tuning_duration_ms: core::ffi::c_int
476}
477#[doc = " \\brief ROCM Provider Options\n\n \\see OrtApi::SessionOptionsAppendExecutionProvider_ROCM"]
478#[repr(C)]
479#[derive(Debug, Copy, Clone)]
480pub struct OrtROCMProviderOptions {
481 #[doc = " \\brief ROCM device Id\n Defaults to 0."]
482 pub device_id: core::ffi::c_int,
483 #[doc = " \\brief ROCM MIOpen Convolution algorithm exaustive search option.\n Defaults to 0 (false)."]
484 pub miopen_conv_exhaustive_search: core::ffi::c_int,
485 #[doc = " \\brief ROCM memory limit (To use all possible memory pass in maximum usize)\n Defaults to SIZE_MAX.\n \\note If a ::OrtArenaCfg has been applied, it will override this field"]
486 pub gpu_mem_limit: usize,
487 #[doc = " \\brief Strategy used to grow the memory arena\n 0 = kNextPowerOfTwo<br>\n 1 = kSameAsRequested<br>\n Defaults to 0.\n \\note If a ::OrtArenaCfg has been applied, it will override this field"]
488 pub arena_extend_strategy: core::ffi::c_int,
489 #[doc = " \\brief Flag indicating if copying needs to take place on the same stream as the compute stream in the ROCM EP\n 0 = Use separate streams for copying and compute.\n 1 = Use the same stream for copying and compute.\n Defaults to 1.\n WARNING: Setting this to 0 may result in data races for some models.\n Please see issue #4829 for more details."]
490 pub do_copy_in_default_stream: core::ffi::c_int,
491 #[doc = " \\brief Flag indicating if there is a user provided compute stream\n Defaults to 0."]
492 pub has_user_compute_stream: core::ffi::c_int,
493 #[doc = " \\brief User provided compute stream.\n If provided, please set `has_user_compute_stream` to 1."]
494 pub user_compute_stream: *mut core::ffi::c_void,
495 #[doc = " \\brief ROCM memory arena configuration parameters"]
496 pub default_memory_arena_cfg: *mut OrtArenaCfg,
497 pub enable_hip_graph: core::ffi::c_int,
498 #[doc = " \\brief Enable TunableOp for using.\n Set it to 1/0 to enable/disable TunableOp. Otherwise, it is disabled by default.\n This option can be overriden by environment variable ORT_ROCM_TUNABLE_OP_ENABLE."]
499 pub tunable_op_enable: core::ffi::c_int,
500 #[doc = " \\brief Enable TunableOp for tuning.\n Set it to 1/0 to enable/disable TunableOp tuning. Otherwise, it is disabled by default.\n This option can be overriden by environment variable ORT_ROCM_TUNABLE_OP_TUNING_ENABLE."]
501 pub tunable_op_tuning_enable: core::ffi::c_int,
502 #[doc = " \\brief Max tuning duration time limit for each instance of TunableOp.\n Defaults to 0 to disable the limit."]
503 pub tunable_op_max_tuning_duration_ms: core::ffi::c_int
504}
505#[doc = " \\brief TensorRT Provider Options\n\n \\see OrtApi::SessionOptionsAppendExecutionProvider_TensorRT"]
506#[repr(C)]
507#[derive(Debug, Copy, Clone)]
508pub struct OrtTensorRTProviderOptions {
509 #[doc = "< CUDA device id (0 = default device)"]
510 pub device_id: core::ffi::c_int,
511 pub has_user_compute_stream: core::ffi::c_int,
512 pub user_compute_stream: *mut core::ffi::c_void,
513 pub trt_max_partition_iterations: core::ffi::c_int,
514 pub trt_min_subgraph_size: core::ffi::c_int,
515 pub trt_max_workspace_size: usize,
516 pub trt_fp16_enable: core::ffi::c_int,
517 pub trt_int8_enable: core::ffi::c_int,
518 pub trt_int8_calibration_table_name: *const core::ffi::c_char,
519 pub trt_int8_use_native_calibration_table: core::ffi::c_int,
520 pub trt_dla_enable: core::ffi::c_int,
521 pub trt_dla_core: core::ffi::c_int,
522 pub trt_dump_subgraphs: core::ffi::c_int,
523 pub trt_engine_cache_enable: core::ffi::c_int,
524 pub trt_engine_cache_path: *const core::ffi::c_char,
525 pub trt_engine_decryption_enable: core::ffi::c_int,
526 pub trt_engine_decryption_lib_path: *const core::ffi::c_char,
527 pub trt_force_sequential_engine_build: core::ffi::c_int
528}
529#[doc = " \\brief MIGraphX Provider Options\n\n \\see OrtApi::SessionOptionsAppendExecutionProvider_MIGraphX"]
530#[repr(C)]
531#[derive(Debug, Copy, Clone)]
532pub struct OrtMIGraphXProviderOptions {
533 pub device_id: core::ffi::c_int,
534 pub migraphx_fp16_enable: core::ffi::c_int,
535 pub migraphx_int8_enable: core::ffi::c_int,
536 pub migraphx_use_native_calibration_table: core::ffi::c_int,
537 pub migraphx_int8_calibration_table_name: *const core::ffi::c_char,
538 pub migraphx_save_compiled_model: core::ffi::c_int,
539 pub migraphx_save_model_path: *const core::ffi::c_char,
540 pub migraphx_load_compiled_model: core::ffi::c_int,
541 pub migraphx_load_model_path: *const core::ffi::c_char,
542 pub migraphx_exhaustive_tune: bool
543}
544#[doc = " \\brief OpenVINO Provider Options\n\n \\see OrtApi::SessionOptionsAppendExecutionProvider_OpenVINO"]
545#[repr(C)]
546#[derive(Debug, Copy, Clone)]
547pub struct OrtOpenVINOProviderOptions {
548 #[doc = " \\brief Device type string\n\n Valid settings are one of: \"CPU_FP32\", \"CPU_FP16\", \"GPU_FP32\", \"GPU_FP16\""]
549 pub device_type: *const core::ffi::c_char,
550 #[doc = "< 0 = disabled, nonzero = enabled"]
551 pub enable_npu_fast_compile: core::ffi::c_uchar,
552 pub device_id: *const core::ffi::c_char,
553 #[doc = "< 0 = Use default number of threads"]
554 pub num_of_threads: usize,
555 pub cache_dir: *const core::ffi::c_char,
556 pub context: *mut core::ffi::c_void,
557 #[doc = "< 0 = disabled, nonzero = enabled"]
558 pub enable_opencl_throttling: core::ffi::c_uchar,
559 #[doc = "< 0 = disabled, nonzero = enabled"]
560 pub enable_dynamic_shapes: core::ffi::c_uchar
561}
562#[repr(C)]
563#[derive(Debug, Copy, Clone)]
564pub struct OrtTrainingSession {
565 _unused: [u8; 0]
566}
567#[repr(C)]
568#[derive(Debug, Copy, Clone)]
569pub struct OrtCheckpointState {
570 _unused: [u8; 0]
571}
572#[repr(i32)]
573#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
574pub enum OrtPropertyType {
575 OrtIntProperty = 0,
576 OrtFloatProperty = 1,
577 OrtStringProperty = 2
578}
579#[repr(C)]
580#[derive(Debug, Copy, Clone)]
581pub struct OrtTrainingApi {
582 pub LoadCheckpoint: unsafe extern "system" fn(checkpoint_path: *const os_char, checkpoint_state: *mut *mut OrtCheckpointState) -> OrtStatusPtr,
583 pub SaveCheckpoint:
584 unsafe extern "system" fn(checkpoint_state: *mut OrtCheckpointState, checkpoint_path: *const os_char, include_optimizer_state: bool) -> OrtStatusPtr,
585 pub CreateTrainingSession: unsafe extern "system" fn(
586 env: *const OrtEnv,
587 options: *const OrtSessionOptions,
588 checkpoint_state: *mut OrtCheckpointState,
589 train_model_path: *const os_char,
590 eval_model_path: *const os_char,
591 optimizer_model_path: *const os_char,
592 out: *mut *mut OrtTrainingSession
593 ) -> OrtStatusPtr,
594 pub CreateTrainingSessionFromBuffer: unsafe extern "system" fn(
595 env: *const OrtEnv,
596 options: *const OrtSessionOptions,
597 checkpoint_state: *mut OrtCheckpointState,
598 train_model_data: *const (),
599 train_data_length: usize,
600 eval_model_data: *const (),
601 eval_data_length: usize,
602 optimizer_model_data: *const (),
603 optimizer_data_length: usize,
604 out: *mut *mut OrtTrainingSession
605 ) -> OrtStatusPtr,
606 pub TrainingSessionGetTrainingModelOutputCount: unsafe extern "system" fn(sess: *const OrtTrainingSession, out: *mut usize) -> OrtStatusPtr,
607 pub TrainingSessionGetEvalModelOutputCount: unsafe extern "system" fn(sess: *const OrtTrainingSession, out: *mut usize) -> OrtStatusPtr,
608 pub TrainingSessionGetTrainingModelOutputName:
609 unsafe extern "system" fn(sess: *const OrtTrainingSession, index: usize, allocator: *mut OrtAllocator, output: *mut *const c_char) -> OrtStatusPtr,
610 pub TrainingSessionGetEvalModelOutputName:
611 unsafe extern "system" fn(sess: *const OrtTrainingSession, index: usize, allocator: *mut OrtAllocator, output: *mut *const c_char) -> OrtStatusPtr,
612 pub LazyResetGrad: unsafe extern "system" fn(session: *mut OrtTrainingSession) -> OrtStatusPtr,
613 pub TrainStep: unsafe extern "system" fn(
614 session: *mut OrtTrainingSession,
615 run_options: *const OrtRunOptions,
616 inputs_len: usize,
617 inputs: *const *const OrtValue,
618 outputs_len: usize,
619 outputs: *mut *mut OrtValue
620 ) -> OrtStatusPtr,
621 pub EvalStep: unsafe extern "system" fn(
622 session: *mut OrtTrainingSession,
623 run_options: *const OrtRunOptions,
624 inputs_len: usize,
625 inputs: *const *const OrtValue,
626 outputs_len: usize,
627 outputs: *mut *mut OrtValue
628 ) -> OrtStatusPtr,
629 pub SetLearningRate: unsafe extern "system" fn(session: *mut OrtTrainingSession, learning_rate: f32) -> OrtStatusPtr,
630 pub GetLearningRate: unsafe extern "system" fn(session: *mut OrtTrainingSession, learning_rate: *mut f32) -> OrtStatusPtr,
631 pub OptimizerStep: unsafe extern "system" fn(session: *mut OrtTrainingSession, run_options: *const OrtRunOptions) -> OrtStatusPtr,
632 pub RegisterLinearLRScheduler:
633 unsafe extern "system" fn(session: *mut OrtTrainingSession, warmup_step_count: i64, total_step_count: i64, initial_lr: f32) -> OrtStatusPtr,
634 pub SchedulerStep: unsafe extern "system" fn(session: *mut OrtTrainingSession) -> OrtStatusPtr,
635 pub GetParametersSize: unsafe extern "system" fn(session: *mut OrtTrainingSession, out: *mut usize, trainable_only: bool) -> OrtStatusPtr,
636 pub CopyParametersToBuffer:
637 unsafe extern "system" fn(session: *mut OrtTrainingSession, parameters_buffer: *mut OrtValue, trainable_only: bool) -> OrtStatusPtr,
638 pub CopyBufferToParameters:
639 unsafe extern "system" fn(session: *mut OrtTrainingSession, parameters_buffer: *mut OrtValue, trainable_only: bool) -> OrtStatusPtr,
640 pub ReleaseTrainingSession: unsafe extern "system" fn(input: *mut OrtTrainingSession),
641 pub ReleaseCheckpointState: unsafe extern "system" fn(input: *mut OrtCheckpointState),
642 pub ExportModelForInferencing: unsafe extern "system" fn(
643 session: *mut OrtTrainingSession,
644 inference_model_path: *const os_char,
645 graph_outputs_len: usize,
646 graph_output_names: *const *const c_char
647 ) -> OrtStatusPtr,
648 pub SetSeed: unsafe extern "system" fn(seed: i64) -> OrtStatusPtr,
649 pub TrainingSessionGetTrainingModelInputCount: unsafe extern "system" fn(session: *const OrtTrainingSession, out: *mut usize) -> OrtStatusPtr,
650 pub TrainingSessionGetEvalModelInputCount: unsafe extern "system" fn(session: *const OrtTrainingSession, out: *mut usize) -> OrtStatusPtr,
651 pub TrainingSessionGetTrainingModelInputName:
652 unsafe extern "system" fn(session: *const OrtTrainingSession, index: usize, allocator: *mut OrtAllocator, output: *mut *const c_char) -> OrtStatusPtr,
653 pub TrainingSessionGetEvalModelInputName:
654 unsafe extern "system" fn(session: *const OrtTrainingSession, index: usize, allocator: *mut OrtAllocator, output: *mut *const c_char) -> OrtStatusPtr,
655 pub AddProperty: unsafe extern "system" fn(
656 checkpoint_state: *mut OrtCheckpointState,
657 property_name: *const c_char,
658 property_type: OrtPropertyType,
659 property_value: *const ()
660 ) -> OrtStatusPtr,
661 pub GetProperty: unsafe extern "system" fn(
662 checkpoint_state: *mut OrtCheckpointState,
663 property_name: *const c_char,
664 allocator: *mut OrtAllocator,
665 property_type: *mut OrtPropertyType,
666 property_value: *mut *const ()
667 ) -> OrtStatusPtr,
668 pub LoadCheckpointFromBuffer:
669 unsafe extern "system" fn(checkpoint_buffer: *const (), num_bytes: usize, checkpoint_state: *mut *mut OrtCheckpointState) -> OrtStatusPtr,
670 pub GetParameterTypeAndShape: unsafe extern "system" fn(
671 checkpoint_state: *const OrtCheckpointState,
672 parameter_name: *const c_char,
673 parameter_type_and_shape: *mut *mut OrtTensorTypeAndShapeInfo
674 ) -> OrtStatusPtr,
675 pub UpdateParameter:
676 unsafe extern "system" fn(checkpoint_state: *mut OrtCheckpointState, parameter_name: *const c_char, parameter: *mut OrtValue) -> OrtStatusPtr,
677 pub GetParameter: unsafe extern "system" fn(
678 checkpoint_state: *const OrtCheckpointState,
679 parameter_name: *const c_char,
680 allocator: *mut OrtAllocator,
681 parameter: *mut *mut OrtValue
682 ) -> OrtStatusPtr
683}
684#[repr(C)]
685#[derive(Debug, Copy, Clone)]
686pub struct OrtModelEditorApi {
687 pub CreateTensorTypeInfo: unsafe extern "system" fn(tensor_info: *const OrtTensorTypeAndShapeInfo, type_info: *mut *mut OrtTypeInfo) -> OrtStatusPtr,
688 pub CreateSparseTensorTypeInfo: unsafe extern "system" fn(tensor_info: *const OrtTensorTypeAndShapeInfo, type_info: *mut *mut OrtTypeInfo) -> OrtStatusPtr,
689 pub CreateMapTypeInfo: unsafe extern "system" fn(
690 map_key_type: ONNXTensorElementDataType,
691 map_value_type: *const OrtTypeInfo,
692 type_info: *mut *mut OrtTypeInfo
693 ) -> OrtStatusPtr,
694 pub CreateSequenceTypeInfo: unsafe extern "system" fn(sequence_type: *const OrtTypeInfo, type_info: *mut *mut OrtTypeInfo) -> OrtStatusPtr,
695 pub CreateOptionalTypeInfo: unsafe extern "system" fn(contained_type: *const OrtTypeInfo, type_info: *mut *mut OrtTypeInfo) -> OrtStatusPtr,
696 pub CreateValueInfo: unsafe extern "system" fn(name: *const c_char, type_info: *const OrtTypeInfo, value_info: *mut *mut OrtValueInfo) -> OrtStatusPtr,
697 pub CreateNode: unsafe extern "system" fn(
698 operator_name: *const c_char,
699 domain_name: *const c_char,
700 node_name: *const c_char,
701 input_names: *const *const c_char,
702 input_names_len: usize,
703 output_names: *const *const c_char,
704 output_names_len: usize,
705 attributes: *mut *mut OrtOpAttr,
706 attribs_len: usize,
707 node: *mut *mut OrtNode
708 ) -> OrtStatusPtr,
709 pub CreateGraph: unsafe extern "system" fn(graph: *mut *mut OrtGraph) -> OrtStatusPtr,
710 pub SetGraphInputs: unsafe extern "system" fn(graph: *mut OrtGraph, inputs: *mut *mut OrtValueInfo, inputs_len: usize) -> OrtStatusPtr,
711 pub SetGraphOutputs: unsafe extern "system" fn(graph: *mut OrtGraph, outputs: *mut *mut OrtValueInfo, outputs_len: usize) -> OrtStatusPtr,
712 pub AddInitializerToGraph:
713 unsafe extern "system" fn(graph: *mut OrtGraph, name: *const c_char, tensor: *mut OrtValue, data_is_external: bool) -> OrtStatusPtr,
714 pub AddNodeToGraph: unsafe extern "system" fn(graph: *mut OrtGraph, node: *mut OrtNode) -> OrtStatusPtr,
715 pub CreateModel: unsafe extern "system" fn(
716 domain_names: *const *const c_char,
717 opset_versions: *const i32,
718 opset_entries_len: usize,
719 model: *mut *mut OrtModel
720 ) -> OrtStatusPtr,
721 pub AddGraphToModel: unsafe extern "system" fn(model: *mut OrtModel, graph: *mut OrtGraph) -> OrtStatusPtr,
722 pub CreateSessionFromModel:
723 unsafe extern "system" fn(env: *const OrtEnv, model: *const OrtModel, options: *const OrtSessionOptions, out: *mut *mut OrtSession) -> OrtStatusPtr,
724 pub CreateModelEditorSession:
725 unsafe extern "system" fn(env: *const OrtEnv, model_path: *const os_char, options: *const OrtSessionOptions, out: *mut *mut OrtSession) -> OrtStatusPtr,
726 pub CreateModelEditorSessionFromArray: unsafe extern "system" fn(
727 env: *const OrtEnv,
728 model_data: *const c_void,
729 model_data_length: usize,
730 options: *const OrtSessionOptions,
731 out: *mut *mut OrtSession
732 ) -> OrtStatusPtr,
733 pub SessionGetOpsetForDomain: unsafe extern "system" fn(session: *const OrtSession, domain: *const c_char, opset: *mut i32) -> OrtStatusPtr,
734 pub ApplyModelToModelEditorSession: unsafe extern "system" fn(session: *mut OrtSession, model: *mut OrtModel) -> OrtStatusPtr,
735 pub FinalizeModelEditorSession: unsafe extern "system" fn(
736 session: *mut OrtSession,
737 options: *const OrtSessionOptions,
738 prepacked_weights_container: *const OrtPrepackedWeightsContainer
739 ) -> OrtStatusPtr
740}
741#[repr(C)]
742#[derive(Debug, Copy, Clone)]
743pub struct OrtCompileApi {
744 pub ReleaseModelCompilationOptions: unsafe extern "system" fn(input: *mut OrtModelCompilationOptions),
745 pub CreateModelCompilationOptionsFromSessionOptions:
746 unsafe extern "system" fn(env: *const OrtEnv, session_options: *const OrtSessionOptions, out: *mut *mut OrtModelCompilationOptions) -> OrtStatusPtr,
747 pub ModelCompilationOptions_SetInputModelPath:
748 unsafe extern "system" fn(model_compile_options: *mut OrtModelCompilationOptions, input_model_path: *const os_char) -> OrtStatusPtr,
749 pub ModelCompilationOptions_SetInputModelFromBuffer: unsafe extern "system" fn(
750 model_compile_options: *mut OrtModelCompilationOptions,
751 input_model_data: *const c_void,
752 input_model_data_size: usize
753 ) -> OrtStatusPtr,
754 pub ModelCompilationOptions_SetOutputModelPath:
755 unsafe extern "system" fn(model_compile_options: *mut OrtModelCompilationOptions, output_model_path: *const os_char) -> OrtStatusPtr,
756 pub ModelCompilationOptions_SetOutputModelExternalInitializersFile: unsafe extern "system" fn(
757 model_compile_options: *mut OrtModelCompilationOptions,
758 external_initializers_file_path: *const os_char,
759 external_initializers_size_threshold: usize
760 ) -> OrtStatusPtr,
761 pub ModelCompilationOptions_SetOutputModelBuffer: unsafe extern "system" fn(
762 model_compile_options: *mut OrtModelCompilationOptions,
763 allocator: *mut OrtAllocator,
764 output_model_buffer_ptr: *mut *mut c_void,
765 output_model_buffer_size_ptr: *mut usize
766 ) -> OrtStatusPtr,
767 pub ModelCompilationOptions_SetEpContextEmbedMode:
768 unsafe extern "system" fn(model_compile_options: *mut OrtModelCompilationOptions, embed_ep_context_in_model: bool) -> OrtStatusPtr,
769 pub CompileModel: unsafe extern "system" fn(env: *const OrtEnv, model_options: *const OrtModelCompilationOptions) -> OrtStatusPtr
770}
771#[repr(C)]
772#[derive(Debug, Copy, Clone)]
773pub struct OrtEpApi {
774 _unused: [u8; 0]
775}
776#[doc = " \\brief The helper interface to get the right version of OrtApi\n\n Get a pointer to this structure through ::OrtGetApiBase"]
777#[repr(C)]
778#[derive(Debug, Copy, Clone)]
779pub struct OrtApiBase {
780 #[doc = " \\brief Get a pointer to the requested version of the ::OrtApi\n\n \\param[in] version Must be ::ORT_API_VERSION\n \\return The ::OrtApi for the version requested, nullptr will be returned if this version is unsupported, for example when using a runtime\n older than the version created with this header file.\n\n One can call GetVersionString() to get the version of the Onnxruntime library for logging\n and error reporting purposes."]
781 pub GetApi: unsafe extern "system" fn(version: u32) -> *const OrtApi,
782 #[doc = " \\brief Returns a null terminated string of the version of the Onnxruntime library (eg: \"1.8.1\")\n\n \\return UTF-8 encoded version string. Do not deallocate the returned buffer."]
783 pub GetVersionString: unsafe extern "system" fn() -> *const core::ffi::c_char
784}
785unsafe extern "system" {
786 #[doc = " \\brief The Onnxruntime library's entry point to access the C API\n\n Call this to get the a pointer to an ::OrtApiBase"]
787 pub fn OrtGetApiBase() -> *const OrtApiBase;
788}
789#[doc = " \\brief Thread work loop function\n\n Onnxruntime will provide the working loop on custom thread creation\n Argument is an onnxruntime built-in type which will be provided when thread pool calls OrtCustomCreateThreadFn"]
790pub type OrtThreadWorkerFn = unsafe extern "system" fn(ort_worker_fn_param: *mut core::ffi::c_void);
791#[repr(C)]
792#[derive(Debug, Copy, Clone)]
793pub struct OrtCustomHandleType {
794 pub __place_holder: core::ffi::c_char
795}
796pub type OrtCustomThreadHandle = *const OrtCustomHandleType;
797#[doc = " \\brief Ort custom thread creation function\n\n The function should return a thread handle to be used in onnxruntime thread pools\n Onnxruntime will throw exception on return value of nullptr or 0, indicating that the function failed to create a thread"]
798pub type OrtCustomCreateThreadFn = Option<
799 unsafe extern "system" fn(
800 ort_custom_thread_creation_options: *mut core::ffi::c_void,
801 ort_thread_worker_fn: OrtThreadWorkerFn,
802 ort_worker_fn_param: *mut core::ffi::c_void
803 ) -> OrtCustomThreadHandle
804>;
805#[doc = " \\brief Custom thread join function\n\n Onnxruntime thread pool destructor will call the function to join a custom thread.\n Argument ort_custom_thread_handle is the value returned by OrtCustomCreateThreadFn"]
806pub type OrtCustomJoinThreadFn = Option<unsafe extern "system" fn(ort_custom_thread_handle: OrtCustomThreadHandle)>;
807#[doc = " \\brief Callback function for RunAsync\n\n \\param[in] user_data User specific data that passed back to the callback\n \\param[out] outputs On succeed, outputs host inference results, on error, the value will be nullptr\n \\param[out] num_outputs Number of outputs, on error, the value will be zero\n \\param[out] status On error, status will provide details"]
808pub type RunAsyncCallbackFn =
809 Option<unsafe extern "system" fn(user_data: *mut core::ffi::c_void, outputs: *mut *mut OrtValue, num_outputs: usize, status: OrtStatusPtr)>;
810#[doc = " \\brief The C API\n\n All C API functions are defined inside this structure as pointers to functions.\n Call OrtApiBase::GetApi to get a pointer to it\n\n \\nosubgrouping"]
811#[repr(C)]
812#[derive(Debug, Copy, Clone)]
813pub struct OrtApi {
814 #[doc = " \\brief Create an OrtStatus from a null terminated string\n\n \\param[in] code\n \\param[in] msg A null-terminated string. Its contents will be copied.\n \\return A new OrtStatus object, must be destroyed with OrtApi::ReleaseStatus"]
815 pub CreateStatus: unsafe extern "system" fn(code: OrtErrorCode, msg: *const core::ffi::c_char) -> OrtStatusPtr,
816 #[doc = " \\brief Get OrtErrorCode from OrtStatus\n\n \\param[in] status\n \\return OrtErrorCode that \\p status was created with"]
817 pub GetErrorCode: unsafe extern "system" fn(status: *const OrtStatus) -> OrtErrorCode,
818 #[doc = " \\brief Get error string from OrtStatus\n\n \\param[in] status\n \\return The error message inside the `status`. Do not free the returned value."]
819 pub GetErrorMessage: unsafe extern "system" fn(status: *const OrtStatus) -> *const core::ffi::c_char,
820 pub CreateEnv: unsafe extern "system" fn(log_severity_level: OrtLoggingLevel, logid: *const core::ffi::c_char, out: *mut *mut OrtEnv) -> OrtStatusPtr,
821 pub CreateEnvWithCustomLogger: unsafe extern "system" fn(
822 logging_function: OrtLoggingFunction,
823 logger_param: *mut core::ffi::c_void,
824 log_severity_level: OrtLoggingLevel,
825 logid: *const core::ffi::c_char,
826 out: *mut *mut OrtEnv
827 ) -> OrtStatusPtr,
828 pub EnableTelemetryEvents: unsafe extern "system" fn(env: *const OrtEnv) -> OrtStatusPtr,
829 pub DisableTelemetryEvents: unsafe extern "system" fn(env: *const OrtEnv) -> OrtStatusPtr,
830 #[cfg(not(target_arch = "wasm32"))]
831 pub CreateSession:
832 unsafe extern "system" fn(env: *const OrtEnv, model_path: *const os_char, options: *const OrtSessionOptions, out: *mut *mut OrtSession) -> OrtStatusPtr,
833 #[cfg(target_arch = "wasm32")]
834 pub CreateSession: unsafe fn(
835 env: *const OrtEnv,
836 model_path: &str,
837 options: *const OrtSessionOptions,
838 out: *mut *mut OrtSession
839 ) -> core::pin::Pin<alloc::boxed::Box<dyn core::future::Future<Output = OrtStatusPtr>>>,
840 #[cfg(not(target_arch = "wasm32"))]
841 pub CreateSessionFromArray: unsafe extern "system" fn(
842 env: *const OrtEnv,
843 model_data: *const core::ffi::c_void,
844 model_data_length: usize,
845 options: *const OrtSessionOptions,
846 out: *mut *mut OrtSession
847 ) -> OrtStatusPtr,
848 #[cfg(target_arch = "wasm32")]
849 pub CreateSessionFromArray: unsafe fn(
850 env: *const OrtEnv,
851 model_data: &[u8],
852 options: *const OrtSessionOptions,
853 out: *mut *mut OrtSession
854 ) -> core::pin::Pin<alloc::boxed::Box<dyn core::future::Future<Output = OrtStatusPtr>>>,
855 pub Run: unsafe extern "system" fn(
856 session: *mut OrtSession,
857 run_options: *const OrtRunOptions,
858 input_names: *const *const core::ffi::c_char,
859 inputs: *const *const OrtValue,
860 input_len: usize,
861 output_names: *const *const core::ffi::c_char,
862 output_names_len: usize,
863 outputs: *mut *mut OrtValue
864 ) -> OrtStatusPtr,
865 pub CreateSessionOptions: unsafe extern "system" fn(options: *mut *mut OrtSessionOptions) -> OrtStatusPtr,
866 pub SetOptimizedModelFilePath: unsafe extern "system" fn(options: *mut OrtSessionOptions, optimized_model_filepath: *const os_char) -> OrtStatusPtr,
867 pub CloneSessionOptions: unsafe extern "system" fn(in_options: *const OrtSessionOptions, out_options: *mut *mut OrtSessionOptions) -> OrtStatusPtr,
868 pub SetSessionExecutionMode: unsafe extern "system" fn(options: *mut OrtSessionOptions, execution_mode: ExecutionMode) -> OrtStatusPtr,
869 pub EnableProfiling: unsafe extern "system" fn(options: *mut OrtSessionOptions, profile_file_prefix: *const os_char) -> OrtStatusPtr,
870 pub DisableProfiling: unsafe extern "system" fn(options: *mut OrtSessionOptions) -> OrtStatusPtr,
871 pub EnableMemPattern: unsafe extern "system" fn(options: *mut OrtSessionOptions) -> OrtStatusPtr,
872 pub DisableMemPattern: unsafe extern "system" fn(options: *mut OrtSessionOptions) -> OrtStatusPtr,
873 pub EnableCpuMemArena: unsafe extern "system" fn(options: *mut OrtSessionOptions) -> OrtStatusPtr,
874 pub DisableCpuMemArena: unsafe extern "system" fn(options: *mut OrtSessionOptions) -> OrtStatusPtr,
875 pub SetSessionLogId: unsafe extern "system" fn(options: *mut OrtSessionOptions, logid: *const core::ffi::c_char) -> OrtStatusPtr,
876 pub SetSessionLogVerbosityLevel: unsafe extern "system" fn(options: *mut OrtSessionOptions, session_log_verbosity_level: core::ffi::c_int) -> OrtStatusPtr,
877 pub SetSessionLogSeverityLevel: unsafe extern "system" fn(options: *mut OrtSessionOptions, session_log_severity_level: core::ffi::c_int) -> OrtStatusPtr,
878 pub SetSessionGraphOptimizationLevel:
879 unsafe extern "system" fn(options: *mut OrtSessionOptions, graph_optimization_level: GraphOptimizationLevel) -> OrtStatusPtr,
880 pub SetIntraOpNumThreads: unsafe extern "system" fn(options: *mut OrtSessionOptions, intra_op_num_threads: core::ffi::c_int) -> OrtStatusPtr,
881 pub SetInterOpNumThreads: unsafe extern "system" fn(options: *mut OrtSessionOptions, inter_op_num_threads: core::ffi::c_int) -> OrtStatusPtr,
882 pub CreateCustomOpDomain: unsafe extern "system" fn(domain: *const core::ffi::c_char, out: *mut *mut OrtCustomOpDomain) -> OrtStatusPtr,
883 pub CustomOpDomain_Add: unsafe extern "system" fn(custom_op_domain: *mut OrtCustomOpDomain, op: *const OrtCustomOp) -> OrtStatusPtr,
884 pub AddCustomOpDomain: unsafe extern "system" fn(options: *mut OrtSessionOptions, custom_op_domain: *mut OrtCustomOpDomain) -> OrtStatusPtr,
885 pub RegisterCustomOpsLibrary: unsafe extern "system" fn(
886 options: *mut OrtSessionOptions,
887 library_path: *const core::ffi::c_char,
888 library_handle: *mut *mut core::ffi::c_void
889 ) -> OrtStatusPtr,
890 pub SessionGetInputCount: unsafe extern "system" fn(session: *const OrtSession, out: *mut usize) -> OrtStatusPtr,
891 pub SessionGetOutputCount: unsafe extern "system" fn(session: *const OrtSession, out: *mut usize) -> OrtStatusPtr,
892 pub SessionGetOverridableInitializerCount: unsafe extern "system" fn(session: *const OrtSession, out: *mut usize) -> OrtStatusPtr,
893 pub SessionGetInputTypeInfo: unsafe extern "system" fn(session: *const OrtSession, index: usize, type_info: *mut *mut OrtTypeInfo) -> OrtStatusPtr,
894 pub SessionGetOutputTypeInfo: unsafe extern "system" fn(session: *const OrtSession, index: usize, type_info: *mut *mut OrtTypeInfo) -> OrtStatusPtr,
895 pub SessionGetOverridableInitializerTypeInfo:
896 unsafe extern "system" fn(session: *const OrtSession, index: usize, type_info: *mut *mut OrtTypeInfo) -> OrtStatusPtr,
897 pub SessionGetInputName:
898 unsafe extern "system" fn(session: *const OrtSession, index: usize, allocator: *mut OrtAllocator, value: *mut *mut core::ffi::c_char) -> OrtStatusPtr,
899 pub SessionGetOutputName:
900 unsafe extern "system" fn(session: *const OrtSession, index: usize, allocator: *mut OrtAllocator, value: *mut *mut core::ffi::c_char) -> OrtStatusPtr,
901 pub SessionGetOverridableInitializerName:
902 unsafe extern "system" fn(session: *const OrtSession, index: usize, allocator: *mut OrtAllocator, value: *mut *mut core::ffi::c_char) -> OrtStatusPtr,
903 pub CreateRunOptions: unsafe extern "system" fn(out: *mut *mut OrtRunOptions) -> OrtStatusPtr,
904 pub RunOptionsSetRunLogVerbosityLevel: unsafe extern "system" fn(options: *mut OrtRunOptions, log_verbosity_level: core::ffi::c_int) -> OrtStatusPtr,
905 pub RunOptionsSetRunLogSeverityLevel: unsafe extern "system" fn(options: *mut OrtRunOptions, log_severity_level: core::ffi::c_int) -> OrtStatusPtr,
906 pub RunOptionsSetRunTag: unsafe extern "system" fn(options: *mut OrtRunOptions, run_tag: *const core::ffi::c_char) -> OrtStatusPtr,
907 pub RunOptionsGetRunLogVerbosityLevel: unsafe extern "system" fn(options: *const OrtRunOptions, log_verbosity_level: *mut core::ffi::c_int) -> OrtStatusPtr,
908 pub RunOptionsGetRunLogSeverityLevel: unsafe extern "system" fn(options: *const OrtRunOptions, log_severity_level: *mut core::ffi::c_int) -> OrtStatusPtr,
909 pub RunOptionsGetRunTag: unsafe extern "system" fn(options: *const OrtRunOptions, run_tag: *mut *const core::ffi::c_char) -> OrtStatusPtr,
910 pub RunOptionsSetTerminate: unsafe extern "system" fn(options: *mut OrtRunOptions) -> OrtStatusPtr,
911 pub RunOptionsUnsetTerminate: unsafe extern "system" fn(options: *mut OrtRunOptions) -> OrtStatusPtr,
912 pub CreateTensorAsOrtValue: unsafe extern "system" fn(
913 allocator: *mut OrtAllocator,
914 shape: *const i64,
915 shape_len: usize,
916 type_: ONNXTensorElementDataType,
917 out: *mut *mut OrtValue
918 ) -> OrtStatusPtr,
919 pub CreateTensorWithDataAsOrtValue: unsafe extern "system" fn(
920 info: *const OrtMemoryInfo,
921 p_data: *mut core::ffi::c_void,
922 p_data_len: usize,
923 shape: *const i64,
924 shape_len: usize,
925 type_: ONNXTensorElementDataType,
926 out: *mut *mut OrtValue
927 ) -> OrtStatusPtr,
928 pub IsTensor: unsafe extern "system" fn(value: *const OrtValue, out: *mut core::ffi::c_int) -> OrtStatusPtr,
929 pub GetTensorMutableData: unsafe extern "system" fn(value: *mut OrtValue, out: *mut *mut core::ffi::c_void) -> OrtStatusPtr,
930 pub FillStringTensor: unsafe extern "system" fn(value: *mut OrtValue, s: *const *const core::ffi::c_char, s_len: usize) -> OrtStatusPtr,
931 pub GetStringTensorDataLength: unsafe extern "system" fn(value: *const OrtValue, len: *mut usize) -> OrtStatusPtr,
932 pub GetStringTensorContent:
933 unsafe extern "system" fn(value: *const OrtValue, s: *mut core::ffi::c_void, s_len: usize, offsets: *mut usize, offsets_len: usize) -> OrtStatusPtr,
934 pub CastTypeInfoToTensorInfo: unsafe extern "system" fn(type_info: *const OrtTypeInfo, out: *mut *const OrtTensorTypeAndShapeInfo) -> OrtStatusPtr,
935 pub GetOnnxTypeFromTypeInfo: unsafe extern "system" fn(type_info: *const OrtTypeInfo, out: *mut ONNXType) -> OrtStatusPtr,
936 pub CreateTensorTypeAndShapeInfo: unsafe extern "system" fn(out: *mut *mut OrtTensorTypeAndShapeInfo) -> OrtStatusPtr,
937 pub SetTensorElementType: unsafe extern "system" fn(info: *mut OrtTensorTypeAndShapeInfo, type_: ONNXTensorElementDataType) -> OrtStatusPtr,
938 pub SetDimensions: unsafe extern "system" fn(info: *mut OrtTensorTypeAndShapeInfo, dim_values: *const i64, dim_count: usize) -> OrtStatusPtr,
939 pub GetTensorElementType: unsafe extern "system" fn(info: *const OrtTensorTypeAndShapeInfo, out: *mut ONNXTensorElementDataType) -> OrtStatusPtr,
940 pub GetDimensionsCount: unsafe extern "system" fn(info: *const OrtTensorTypeAndShapeInfo, out: *mut usize) -> OrtStatusPtr,
941 pub GetDimensions: unsafe extern "system" fn(info: *const OrtTensorTypeAndShapeInfo, dim_values: *mut i64, dim_values_length: usize) -> OrtStatusPtr,
942 pub GetSymbolicDimensions:
943 unsafe extern "system" fn(info: *const OrtTensorTypeAndShapeInfo, dim_params: *mut *const core::ffi::c_char, dim_params_length: usize) -> OrtStatusPtr,
944 pub GetTensorShapeElementCount: unsafe extern "system" fn(info: *const OrtTensorTypeAndShapeInfo, out: *mut usize) -> OrtStatusPtr,
945 pub GetTensorTypeAndShape: unsafe extern "system" fn(value: *const OrtValue, out: *mut *mut OrtTensorTypeAndShapeInfo) -> OrtStatusPtr,
946 pub GetTypeInfo: unsafe extern "system" fn(value: *const OrtValue, out: *mut *mut OrtTypeInfo) -> OrtStatusPtr,
947 pub GetValueType: unsafe extern "system" fn(value: *const OrtValue, out: *mut ONNXType) -> OrtStatusPtr,
948 pub CreateMemoryInfo: unsafe extern "system" fn(
949 name: *const core::ffi::c_char,
950 type_: OrtAllocatorType,
951 id: core::ffi::c_int,
952 mem_type: OrtMemType,
953 out: *mut *mut OrtMemoryInfo
954 ) -> OrtStatusPtr,
955 pub CreateCpuMemoryInfo: unsafe extern "system" fn(type_: OrtAllocatorType, mem_type: OrtMemType, out: *mut *mut OrtMemoryInfo) -> OrtStatusPtr,
956 pub CompareMemoryInfo: unsafe extern "system" fn(info1: *const OrtMemoryInfo, info2: *const OrtMemoryInfo, out: *mut core::ffi::c_int) -> OrtStatusPtr,
957 pub MemoryInfoGetName: unsafe extern "system" fn(ptr: *const OrtMemoryInfo, out: *mut *const core::ffi::c_char) -> OrtStatusPtr,
958 pub MemoryInfoGetId: unsafe extern "system" fn(ptr: *const OrtMemoryInfo, out: *mut core::ffi::c_int) -> OrtStatusPtr,
959 pub MemoryInfoGetMemType: unsafe extern "system" fn(ptr: *const OrtMemoryInfo, out: *mut OrtMemType) -> OrtStatusPtr,
960 pub MemoryInfoGetType: unsafe extern "system" fn(ptr: *const OrtMemoryInfo, out: *mut OrtAllocatorType) -> OrtStatusPtr,
961 pub AllocatorAlloc: unsafe extern "system" fn(ort_allocator: *mut OrtAllocator, size: usize, out: *mut *mut core::ffi::c_void) -> OrtStatusPtr,
962 pub AllocatorFree: unsafe extern "system" fn(ort_allocator: *mut OrtAllocator, p: *mut core::ffi::c_void) -> OrtStatusPtr,
963 pub AllocatorGetInfo: unsafe extern "system" fn(ort_allocator: *const OrtAllocator, out: *mut *const OrtMemoryInfo) -> OrtStatusPtr,
964 pub GetAllocatorWithDefaultOptions: unsafe extern "system" fn(out: *mut *mut OrtAllocator) -> OrtStatusPtr,
965 pub AddFreeDimensionOverride:
966 unsafe extern "system" fn(options: *mut OrtSessionOptions, dim_denotation: *const core::ffi::c_char, dim_value: i64) -> OrtStatusPtr,
967 pub GetValue:
968 unsafe extern "system" fn(value: *const OrtValue, index: core::ffi::c_int, allocator: *mut OrtAllocator, out: *mut *mut OrtValue) -> OrtStatusPtr,
969 pub GetValueCount: unsafe extern "system" fn(value: *const OrtValue, out: *mut usize) -> OrtStatusPtr,
970 pub CreateValue: unsafe extern "system" fn(in_: *const *const OrtValue, num_values: usize, value_type: ONNXType, out: *mut *mut OrtValue) -> OrtStatusPtr,
971 pub CreateOpaqueValue: unsafe extern "system" fn(
972 domain_name: *const core::ffi::c_char,
973 type_name: *const core::ffi::c_char,
974 data_container: *const core::ffi::c_void,
975 data_container_size: usize,
976 out: *mut *mut OrtValue
977 ) -> OrtStatusPtr,
978 pub GetOpaqueValue: unsafe extern "system" fn(
979 domain_name: *const core::ffi::c_char,
980 type_name: *const core::ffi::c_char,
981 in_: *const OrtValue,
982 data_container: *mut core::ffi::c_void,
983 data_container_size: usize
984 ) -> OrtStatusPtr,
985 pub KernelInfoGetAttribute_float: unsafe extern "system" fn(info: *const OrtKernelInfo, name: *const core::ffi::c_char, out: *mut f32) -> OrtStatusPtr,
986 pub KernelInfoGetAttribute_int64: unsafe extern "system" fn(info: *const OrtKernelInfo, name: *const core::ffi::c_char, out: *mut i64) -> OrtStatusPtr,
987 pub KernelInfoGetAttribute_string:
988 unsafe extern "system" fn(info: *const OrtKernelInfo, name: *const core::ffi::c_char, out: *mut core::ffi::c_char, size: *mut usize) -> OrtStatusPtr,
989 pub KernelContext_GetInputCount: unsafe extern "system" fn(context: *const OrtKernelContext, out: *mut usize) -> OrtStatusPtr,
990 pub KernelContext_GetOutputCount: unsafe extern "system" fn(context: *const OrtKernelContext, out: *mut usize) -> OrtStatusPtr,
991 pub KernelContext_GetInput: unsafe extern "system" fn(context: *const OrtKernelContext, index: usize, out: *mut *const OrtValue) -> OrtStatusPtr,
992 pub KernelContext_GetOutput: unsafe extern "system" fn(
993 context: *mut OrtKernelContext,
994 index: usize,
995 dim_values: *const i64,
996 dim_count: usize,
997 out: *mut *mut OrtValue
998 ) -> OrtStatusPtr,
999 pub ReleaseEnv: unsafe extern "system" fn(input: *mut OrtEnv),
1000 pub ReleaseStatus: unsafe extern "system" fn(input: *mut OrtStatus),
1001 pub ReleaseMemoryInfo: unsafe extern "system" fn(input: *mut OrtMemoryInfo),
1002 pub ReleaseSession: unsafe extern "system" fn(input: *mut OrtSession),
1003 pub ReleaseValue: unsafe extern "system" fn(input: *mut OrtValue),
1004 pub ReleaseRunOptions: unsafe extern "system" fn(input: *mut OrtRunOptions),
1005 pub ReleaseTypeInfo: unsafe extern "system" fn(input: *mut OrtTypeInfo),
1006 pub ReleaseTensorTypeAndShapeInfo: unsafe extern "system" fn(input: *mut OrtTensorTypeAndShapeInfo),
1007 pub ReleaseSessionOptions: unsafe extern "system" fn(input: *mut OrtSessionOptions),
1008 pub ReleaseCustomOpDomain: unsafe extern "system" fn(input: *mut OrtCustomOpDomain),
1009 pub GetDenotationFromTypeInfo:
1010 unsafe extern "system" fn(type_info: *const OrtTypeInfo, denotation: *mut *const core::ffi::c_char, len: *mut usize) -> OrtStatusPtr,
1011 pub CastTypeInfoToMapTypeInfo: unsafe extern "system" fn(type_info: *const OrtTypeInfo, out: *mut *const OrtMapTypeInfo) -> OrtStatusPtr,
1012 pub CastTypeInfoToSequenceTypeInfo: unsafe extern "system" fn(type_info: *const OrtTypeInfo, out: *mut *const OrtSequenceTypeInfo) -> OrtStatusPtr,
1013 pub GetMapKeyType: unsafe extern "system" fn(map_type_info: *const OrtMapTypeInfo, out: *mut ONNXTensorElementDataType) -> OrtStatusPtr,
1014 pub GetMapValueType: unsafe extern "system" fn(map_type_info: *const OrtMapTypeInfo, type_info: *mut *mut OrtTypeInfo) -> OrtStatusPtr,
1015 pub GetSequenceElementType: unsafe extern "system" fn(sequence_type_info: *const OrtSequenceTypeInfo, type_info: *mut *mut OrtTypeInfo) -> OrtStatusPtr,
1016 pub ReleaseMapTypeInfo: unsafe extern "system" fn(input: *mut OrtMapTypeInfo),
1017 pub ReleaseSequenceTypeInfo: unsafe extern "system" fn(input: *mut OrtSequenceTypeInfo),
1018 pub SessionEndProfiling:
1019 unsafe extern "system" fn(session: *mut OrtSession, allocator: *mut OrtAllocator, out: *mut *mut core::ffi::c_char) -> OrtStatusPtr,
1020 pub SessionGetModelMetadata: unsafe extern "system" fn(session: *const OrtSession, out: *mut *mut OrtModelMetadata) -> OrtStatusPtr,
1021 pub ModelMetadataGetProducerName:
1022 unsafe extern "system" fn(model_metadata: *const OrtModelMetadata, allocator: *mut OrtAllocator, value: *mut *mut core::ffi::c_char) -> OrtStatusPtr,
1023 pub ModelMetadataGetGraphName:
1024 unsafe extern "system" fn(model_metadata: *const OrtModelMetadata, allocator: *mut OrtAllocator, value: *mut *mut core::ffi::c_char) -> OrtStatusPtr,
1025 pub ModelMetadataGetDomain:
1026 unsafe extern "system" fn(model_metadata: *const OrtModelMetadata, allocator: *mut OrtAllocator, value: *mut *mut core::ffi::c_char) -> OrtStatusPtr,
1027 pub ModelMetadataGetDescription:
1028 unsafe extern "system" fn(model_metadata: *const OrtModelMetadata, allocator: *mut OrtAllocator, value: *mut *mut core::ffi::c_char) -> OrtStatusPtr,
1029 pub ModelMetadataLookupCustomMetadataMap: unsafe extern "system" fn(
1030 model_metadata: *const OrtModelMetadata,
1031 allocator: *mut OrtAllocator,
1032 key: *const core::ffi::c_char,
1033 value: *mut *mut core::ffi::c_char
1034 ) -> OrtStatusPtr,
1035 pub ModelMetadataGetVersion: unsafe extern "system" fn(model_metadata: *const OrtModelMetadata, value: *mut i64) -> OrtStatusPtr,
1036 pub ReleaseModelMetadata: unsafe extern "system" fn(input: *mut OrtModelMetadata),
1037 pub CreateEnvWithGlobalThreadPools: unsafe extern "system" fn(
1038 log_severity_level: OrtLoggingLevel,
1039 logid: *const core::ffi::c_char,
1040 tp_options: *const OrtThreadingOptions,
1041 out: *mut *mut OrtEnv
1042 ) -> OrtStatusPtr,
1043 pub DisablePerSessionThreads: unsafe extern "system" fn(options: *mut OrtSessionOptions) -> OrtStatusPtr,
1044 pub CreateThreadingOptions: unsafe extern "system" fn(out: *mut *mut OrtThreadingOptions) -> OrtStatusPtr,
1045 pub ReleaseThreadingOptions: unsafe extern "system" fn(input: *mut OrtThreadingOptions),
1046 pub ModelMetadataGetCustomMetadataMapKeys: unsafe extern "system" fn(
1047 model_metadata: *const OrtModelMetadata,
1048 allocator: *mut OrtAllocator,
1049 keys: *mut *mut *mut core::ffi::c_char,
1050 num_keys: *mut i64
1051 ) -> OrtStatusPtr,
1052 pub AddFreeDimensionOverrideByName:
1053 unsafe extern "system" fn(options: *mut OrtSessionOptions, dim_name: *const core::ffi::c_char, dim_value: i64) -> OrtStatusPtr,
1054 pub GetAvailableProviders: unsafe extern "system" fn(out_ptr: *mut *mut *mut core::ffi::c_char, provider_length: *mut core::ffi::c_int) -> OrtStatusPtr,
1055 pub ReleaseAvailableProviders: unsafe extern "system" fn(ptr: *mut *mut core::ffi::c_char, providers_length: core::ffi::c_int) -> OrtStatusPtr,
1056 pub GetStringTensorElementLength: unsafe extern "system" fn(value: *const OrtValue, index: usize, out: *mut usize) -> OrtStatusPtr,
1057 pub GetStringTensorElement: unsafe extern "system" fn(value: *const OrtValue, s_len: usize, index: usize, s: *mut core::ffi::c_void) -> OrtStatusPtr,
1058 pub FillStringTensorElement: unsafe extern "system" fn(value: *mut OrtValue, s: *const core::ffi::c_char, index: usize) -> OrtStatusPtr,
1059 pub AddSessionConfigEntry: unsafe extern "system" fn(
1060 options: *mut OrtSessionOptions,
1061 config_key: *const core::ffi::c_char,
1062 config_value: *const core::ffi::c_char
1063 ) -> OrtStatusPtr,
1064 pub CreateAllocator: unsafe extern "system" fn(session: *const OrtSession, mem_info: *const OrtMemoryInfo, out: *mut *mut OrtAllocator) -> OrtStatusPtr,
1065 pub ReleaseAllocator: unsafe extern "system" fn(input: *mut OrtAllocator),
1066 pub RunWithBinding:
1067 unsafe extern "system" fn(session: *mut OrtSession, run_options: *const OrtRunOptions, binding_ptr: *const OrtIoBinding) -> OrtStatusPtr,
1068 pub CreateIoBinding: unsafe extern "system" fn(session: *mut OrtSession, out: *mut *mut OrtIoBinding) -> OrtStatusPtr,
1069 pub ReleaseIoBinding: unsafe extern "system" fn(input: *mut OrtIoBinding),
1070 pub BindInput: unsafe extern "system" fn(binding_ptr: *mut OrtIoBinding, name: *const core::ffi::c_char, val_ptr: *const OrtValue) -> OrtStatusPtr,
1071 pub BindOutput: unsafe extern "system" fn(binding_ptr: *mut OrtIoBinding, name: *const core::ffi::c_char, val_ptr: *const OrtValue) -> OrtStatusPtr,
1072 pub BindOutputToDevice:
1073 unsafe extern "system" fn(binding_ptr: *mut OrtIoBinding, name: *const core::ffi::c_char, mem_info_ptr: *const OrtMemoryInfo) -> OrtStatusPtr,
1074 pub GetBoundOutputNames: unsafe extern "system" fn(
1075 binding_ptr: *const OrtIoBinding,
1076 allocator: *mut OrtAllocator,
1077 buffer: *mut *mut core::ffi::c_char,
1078 lengths: *mut *mut usize,
1079 count: *mut usize
1080 ) -> OrtStatusPtr,
1081 pub GetBoundOutputValues: unsafe extern "system" fn(
1082 binding_ptr: *const OrtIoBinding,
1083 allocator: *mut OrtAllocator,
1084 output: *mut *mut *mut OrtValue,
1085 output_count: *mut usize
1086 ) -> OrtStatusPtr,
1087 #[doc = " \\brief Clears any previously set Inputs for an ::OrtIoBinding"]
1088 pub ClearBoundInputs: unsafe extern "system" fn(binding_ptr: *mut OrtIoBinding),
1089 #[doc = " \\brief Clears any previously set Outputs for an ::OrtIoBinding"]
1090 pub ClearBoundOutputs: unsafe extern "system" fn(binding_ptr: *mut OrtIoBinding),
1091 pub TensorAt: unsafe extern "system" fn(
1092 value: *mut OrtValue,
1093 location_values: *const i64,
1094 location_values_count: usize,
1095 out: *mut *mut core::ffi::c_void
1096 ) -> OrtStatusPtr,
1097 pub CreateAndRegisterAllocator: unsafe extern "system" fn(env: *mut OrtEnv, mem_info: *const OrtMemoryInfo, arena_cfg: *const OrtArenaCfg) -> OrtStatusPtr,
1098 pub SetLanguageProjection: unsafe extern "system" fn(ort_env: *const OrtEnv, projection: OrtLanguageProjection) -> OrtStatusPtr,
1099 pub SessionGetProfilingStartTimeNs: unsafe extern "system" fn(session: *const OrtSession, out: *mut u64) -> OrtStatusPtr,
1100 pub SetGlobalIntraOpNumThreads: unsafe extern "system" fn(tp_options: *mut OrtThreadingOptions, intra_op_num_threads: core::ffi::c_int) -> OrtStatusPtr,
1101 pub SetGlobalInterOpNumThreads: unsafe extern "system" fn(tp_options: *mut OrtThreadingOptions, inter_op_num_threads: core::ffi::c_int) -> OrtStatusPtr,
1102 pub SetGlobalSpinControl: unsafe extern "system" fn(tp_options: *mut OrtThreadingOptions, allow_spinning: core::ffi::c_int) -> OrtStatusPtr,
1103 pub AddInitializer: unsafe extern "system" fn(options: *mut OrtSessionOptions, name: *const core::ffi::c_char, val: *const OrtValue) -> OrtStatusPtr,
1104 pub CreateEnvWithCustomLoggerAndGlobalThreadPools: unsafe extern "system" fn(
1105 logging_function: OrtLoggingFunction,
1106 logger_param: *mut core::ffi::c_void,
1107 log_severity_level: OrtLoggingLevel,
1108 logid: *const core::ffi::c_char,
1109 tp_options: *const OrtThreadingOptions,
1110 out: *mut *mut OrtEnv
1111 ) -> OrtStatusPtr,
1112 pub SessionOptionsAppendExecutionProvider_CUDA:
1113 unsafe extern "system" fn(options: *mut OrtSessionOptions, cuda_options: *const OrtCUDAProviderOptions) -> OrtStatusPtr,
1114 pub SessionOptionsAppendExecutionProvider_ROCM:
1115 unsafe extern "system" fn(options: *mut OrtSessionOptions, rocm_options: *const OrtROCMProviderOptions) -> OrtStatusPtr,
1116 pub SessionOptionsAppendExecutionProvider_OpenVINO:
1117 unsafe extern "system" fn(options: *mut OrtSessionOptions, provider_options: *const OrtOpenVINOProviderOptions) -> OrtStatusPtr,
1118 pub SetGlobalDenormalAsZero: unsafe extern "system" fn(tp_options: *mut OrtThreadingOptions) -> OrtStatusPtr,
1119 pub CreateArenaCfg: unsafe extern "system" fn(
1120 max_mem: usize,
1121 arena_extend_strategy: core::ffi::c_int,
1122 initial_chunk_size_bytes: core::ffi::c_int,
1123 max_dead_bytes_per_chunk: core::ffi::c_int,
1124 out: *mut *mut OrtArenaCfg
1125 ) -> OrtStatusPtr,
1126 pub ReleaseArenaCfg: unsafe extern "system" fn(input: *mut OrtArenaCfg),
1127 pub ModelMetadataGetGraphDescription:
1128 unsafe extern "system" fn(model_metadata: *const OrtModelMetadata, allocator: *mut OrtAllocator, value: *mut *mut core::ffi::c_char) -> OrtStatusPtr,
1129 pub SessionOptionsAppendExecutionProvider_TensorRT:
1130 unsafe extern "system" fn(options: *mut OrtSessionOptions, tensorrt_options: *const OrtTensorRTProviderOptions) -> OrtStatusPtr,
1131 pub SetCurrentGpuDeviceId: unsafe extern "system" fn(device_id: core::ffi::c_int) -> OrtStatusPtr,
1132 pub GetCurrentGpuDeviceId: unsafe extern "system" fn(device_id: *mut core::ffi::c_int) -> OrtStatusPtr,
1133 pub KernelInfoGetAttributeArray_float:
1134 unsafe extern "system" fn(info: *const OrtKernelInfo, name: *const core::ffi::c_char, out: *mut f32, size: *mut usize) -> OrtStatusPtr,
1135 pub KernelInfoGetAttributeArray_int64:
1136 unsafe extern "system" fn(info: *const OrtKernelInfo, name: *const core::ffi::c_char, out: *mut i64, size: *mut usize) -> OrtStatusPtr,
1137 pub CreateArenaCfgV2: unsafe extern "system" fn(
1138 arena_config_keys: *const *const core::ffi::c_char,
1139 arena_config_values: *const usize,
1140 num_keys: usize,
1141 out: *mut *mut OrtArenaCfg
1142 ) -> OrtStatusPtr,
1143 pub AddRunConfigEntry:
1144 unsafe extern "system" fn(options: *mut OrtRunOptions, config_key: *const core::ffi::c_char, config_value: *const core::ffi::c_char) -> OrtStatusPtr,
1145 pub CreatePrepackedWeightsContainer: unsafe extern "system" fn(out: *mut *mut OrtPrepackedWeightsContainer) -> OrtStatusPtr,
1146 pub ReleasePrepackedWeightsContainer: unsafe extern "system" fn(input: *mut OrtPrepackedWeightsContainer),
1147 pub CreateSessionWithPrepackedWeightsContainer: unsafe extern "system" fn(
1148 env: *const OrtEnv,
1149 model_path: *const os_char,
1150 options: *const OrtSessionOptions,
1151 prepacked_weights_container: *mut OrtPrepackedWeightsContainer,
1152 out: *mut *mut OrtSession
1153 ) -> OrtStatusPtr,
1154 pub CreateSessionFromArrayWithPrepackedWeightsContainer: unsafe extern "system" fn(
1155 env: *const OrtEnv,
1156 model_data: *const core::ffi::c_void,
1157 model_data_length: usize,
1158 options: *const OrtSessionOptions,
1159 prepacked_weights_container: *mut OrtPrepackedWeightsContainer,
1160 out: *mut *mut OrtSession
1161 ) -> OrtStatusPtr,
1162 pub SessionOptionsAppendExecutionProvider_TensorRT_V2:
1163 unsafe extern "system" fn(options: *mut OrtSessionOptions, tensorrt_options: *const OrtTensorRTProviderOptionsV2) -> OrtStatusPtr,
1164 pub CreateTensorRTProviderOptions: unsafe extern "system" fn(out: *mut *mut OrtTensorRTProviderOptionsV2) -> OrtStatusPtr,
1165 pub UpdateTensorRTProviderOptions: unsafe extern "system" fn(
1166 tensorrt_options: *mut OrtTensorRTProviderOptionsV2,
1167 provider_options_keys: *const *const core::ffi::c_char,
1168 provider_options_values: *const *const core::ffi::c_char,
1169 num_keys: usize
1170 ) -> OrtStatusPtr,
1171 pub GetTensorRTProviderOptionsAsString: unsafe extern "system" fn(
1172 tensorrt_options: *const OrtTensorRTProviderOptionsV2,
1173 allocator: *mut OrtAllocator,
1174 ptr: *mut *mut core::ffi::c_char
1175 ) -> OrtStatusPtr,
1176 #[doc = " \\brief Release an ::OrtTensorRTProviderOptionsV2\n\n \\note This is an exception in the naming convention of other Release* functions, as the name of the method does not have the V2 suffix, but the type does"]
1177 pub ReleaseTensorRTProviderOptions: unsafe extern "system" fn(input: *mut OrtTensorRTProviderOptionsV2),
1178 pub EnableOrtCustomOps: unsafe extern "system" fn(options: *mut OrtSessionOptions) -> OrtStatusPtr,
1179 pub RegisterAllocator: unsafe extern "system" fn(env: *mut OrtEnv, allocator: *mut OrtAllocator) -> OrtStatusPtr,
1180 pub UnregisterAllocator: unsafe extern "system" fn(env: *mut OrtEnv, mem_info: *const OrtMemoryInfo) -> OrtStatusPtr,
1181 pub IsSparseTensor: unsafe extern "system" fn(value: *const OrtValue, out: *mut core::ffi::c_int) -> OrtStatusPtr,
1182 pub CreateSparseTensorAsOrtValue: unsafe extern "system" fn(
1183 allocator: *mut OrtAllocator,
1184 dense_shape: *const i64,
1185 dense_shape_len: usize,
1186 type_: ONNXTensorElementDataType,
1187 out: *mut *mut OrtValue
1188 ) -> OrtStatusPtr,
1189 pub FillSparseTensorCoo: unsafe extern "system" fn(
1190 ort_value: *mut OrtValue,
1191 data_mem_info: *const OrtMemoryInfo,
1192 values_shape: *const i64,
1193 values_shape_len: usize,
1194 values: *const core::ffi::c_void,
1195 indices_data: *const i64,
1196 indices_num: usize
1197 ) -> OrtStatusPtr,
1198 pub FillSparseTensorCsr: unsafe extern "system" fn(
1199 ort_value: *mut OrtValue,
1200 data_mem_info: *const OrtMemoryInfo,
1201 values_shape: *const i64,
1202 values_shape_len: usize,
1203 values: *const core::ffi::c_void,
1204 inner_indices_data: *const i64,
1205 inner_indices_num: usize,
1206 outer_indices_data: *const i64,
1207 outer_indices_num: usize
1208 ) -> OrtStatusPtr,
1209 pub FillSparseTensorBlockSparse: unsafe extern "system" fn(
1210 ort_value: *mut OrtValue,
1211 data_mem_info: *const OrtMemoryInfo,
1212 values_shape: *const i64,
1213 values_shape_len: usize,
1214 values: *const core::ffi::c_void,
1215 indices_shape_data: *const i64,
1216 indices_shape_len: usize,
1217 indices_data: *const i32
1218 ) -> OrtStatusPtr,
1219 pub CreateSparseTensorWithValuesAsOrtValue: unsafe extern "system" fn(
1220 info: *const OrtMemoryInfo,
1221 p_data: *mut core::ffi::c_void,
1222 dense_shape: *const i64,
1223 dense_shape_len: usize,
1224 values_shape: *const i64,
1225 values_shape_len: usize,
1226 type_: ONNXTensorElementDataType,
1227 out: *mut *mut OrtValue
1228 ) -> OrtStatusPtr,
1229 pub UseCooIndices: unsafe extern "system" fn(ort_value: *mut OrtValue, indices_data: *mut i64, indices_num: usize) -> OrtStatusPtr,
1230 pub UseCsrIndices:
1231 unsafe extern "system" fn(ort_value: *mut OrtValue, inner_data: *mut i64, inner_num: usize, outer_data: *mut i64, outer_num: usize) -> OrtStatusPtr,
1232 pub UseBlockSparseIndices:
1233 unsafe extern "system" fn(ort_value: *mut OrtValue, indices_shape: *const i64, indices_shape_len: usize, indices_data: *mut i32) -> OrtStatusPtr,
1234 pub GetSparseTensorFormat: unsafe extern "system" fn(ort_value: *const OrtValue, out: *mut OrtSparseFormat) -> OrtStatusPtr,
1235 pub GetSparseTensorValuesTypeAndShape: unsafe extern "system" fn(ort_value: *const OrtValue, out: *mut *mut OrtTensorTypeAndShapeInfo) -> OrtStatusPtr,
1236 pub GetSparseTensorValues: unsafe extern "system" fn(ort_value: *const OrtValue, out: *mut *const core::ffi::c_void) -> OrtStatusPtr,
1237 pub GetSparseTensorIndicesTypeShape:
1238 unsafe extern "system" fn(ort_value: *const OrtValue, indices_format: OrtSparseIndicesFormat, out: *mut *mut OrtTensorTypeAndShapeInfo) -> OrtStatusPtr,
1239 pub GetSparseTensorIndices: unsafe extern "system" fn(
1240 ort_value: *const OrtValue,
1241 indices_format: OrtSparseIndicesFormat,
1242 num_indices: *mut usize,
1243 indices: *mut *const core::ffi::c_void
1244 ) -> OrtStatusPtr,
1245 pub HasValue: unsafe extern "system" fn(value: *const OrtValue, out: *mut core::ffi::c_int) -> OrtStatusPtr,
1246 pub KernelContext_GetGPUComputeStream: unsafe extern "system" fn(context: *const OrtKernelContext, out: *mut *mut core::ffi::c_void) -> OrtStatusPtr,
1247 pub GetTensorMemoryInfo: unsafe extern "system" fn(value: *const OrtValue, mem_info: *mut *const OrtMemoryInfo) -> OrtStatusPtr,
1248 pub GetExecutionProviderApi:
1249 unsafe extern "system" fn(provider_name: *const core::ffi::c_char, version: u32, provider_api: *mut *const core::ffi::c_void) -> OrtStatusPtr,
1250 pub SessionOptionsSetCustomCreateThreadFn:
1251 unsafe extern "system" fn(options: *mut OrtSessionOptions, ort_custom_create_thread_fn: OrtCustomCreateThreadFn) -> OrtStatusPtr,
1252 pub SessionOptionsSetCustomThreadCreationOptions:
1253 unsafe extern "system" fn(options: *mut OrtSessionOptions, ort_custom_thread_creation_options: *mut core::ffi::c_void) -> OrtStatusPtr,
1254 pub SessionOptionsSetCustomJoinThreadFn:
1255 unsafe extern "system" fn(options: *mut OrtSessionOptions, ort_custom_join_thread_fn: OrtCustomJoinThreadFn) -> OrtStatusPtr,
1256 pub SetGlobalCustomCreateThreadFn:
1257 unsafe extern "system" fn(tp_options: *mut OrtThreadingOptions, ort_custom_create_thread_fn: OrtCustomCreateThreadFn) -> OrtStatusPtr,
1258 pub SetGlobalCustomThreadCreationOptions:
1259 unsafe extern "system" fn(tp_options: *mut OrtThreadingOptions, ort_custom_thread_creation_options: *mut core::ffi::c_void) -> OrtStatusPtr,
1260 pub SetGlobalCustomJoinThreadFn:
1261 unsafe extern "system" fn(tp_options: *mut OrtThreadingOptions, ort_custom_join_thread_fn: OrtCustomJoinThreadFn) -> OrtStatusPtr,
1262 pub SynchronizeBoundInputs: unsafe extern "system" fn(binding_ptr: *mut OrtIoBinding) -> OrtStatusPtr,
1263 pub SynchronizeBoundOutputs: unsafe extern "system" fn(binding_ptr: *mut OrtIoBinding) -> OrtStatusPtr,
1264 pub SessionOptionsAppendExecutionProvider_CUDA_V2:
1265 unsafe extern "system" fn(options: *mut OrtSessionOptions, cuda_options: *const OrtCUDAProviderOptionsV2) -> OrtStatusPtr,
1266 pub CreateCUDAProviderOptions: unsafe extern "system" fn(out: *mut *mut OrtCUDAProviderOptionsV2) -> OrtStatusPtr,
1267 pub UpdateCUDAProviderOptions: unsafe extern "system" fn(
1268 cuda_options: *mut OrtCUDAProviderOptionsV2,
1269 provider_options_keys: *const *const core::ffi::c_char,
1270 provider_options_values: *const *const core::ffi::c_char,
1271 num_keys: usize
1272 ) -> OrtStatusPtr,
1273 pub GetCUDAProviderOptionsAsString: unsafe extern "system" fn(
1274 cuda_options: *const OrtCUDAProviderOptionsV2,
1275 allocator: *mut OrtAllocator,
1276 ptr: *mut *mut core::ffi::c_char
1277 ) -> OrtStatusPtr,
1278 #[doc = " \\brief Release an ::OrtCUDAProviderOptionsV2\n\n \\note This is an exception in the naming convention of other Release* functions, as the name of the method does not have the V2 suffix, but the type does\n\n \\since Version 1.11."]
1279 pub ReleaseCUDAProviderOptions: unsafe extern "system" fn(input: *mut OrtCUDAProviderOptionsV2),
1280 pub SessionOptionsAppendExecutionProvider_MIGraphX:
1281 unsafe extern "system" fn(options: *mut OrtSessionOptions, migraphx_options: *const OrtMIGraphXProviderOptions) -> OrtStatusPtr,
1282 pub AddExternalInitializers: unsafe extern "system" fn(
1283 options: *mut OrtSessionOptions,
1284 initializer_names: *const *const core::ffi::c_char,
1285 initializers: *const *const OrtValue,
1286 initializers_num: usize
1287 ) -> OrtStatusPtr,
1288 pub CreateOpAttr: unsafe extern "system" fn(
1289 name: *const core::ffi::c_char,
1290 data: *const core::ffi::c_void,
1291 len: core::ffi::c_int,
1292 type_: OrtOpAttrType,
1293 op_attr: *mut *mut OrtOpAttr
1294 ) -> OrtStatusPtr,
1295 pub ReleaseOpAttr: unsafe extern "system" fn(input: *mut OrtOpAttr),
1296 pub CreateOp: unsafe extern "system" fn(
1297 info: *const OrtKernelInfo,
1298 op_name: *const core::ffi::c_char,
1299 domain: *const core::ffi::c_char,
1300 version: core::ffi::c_int,
1301 type_constraint_names: *mut *const core::ffi::c_char,
1302 type_constraint_values: *const ONNXTensorElementDataType,
1303 type_constraint_count: core::ffi::c_int,
1304 attr_values: *const *const OrtOpAttr,
1305 attr_count: core::ffi::c_int,
1306 input_count: core::ffi::c_int,
1307 output_count: core::ffi::c_int,
1308 ort_op: *mut *mut OrtOp
1309 ) -> OrtStatusPtr,
1310 pub InvokeOp: unsafe extern "system" fn(
1311 context: *const OrtKernelContext,
1312 ort_op: *const OrtOp,
1313 input_values: *const *const OrtValue,
1314 input_count: core::ffi::c_int,
1315 output_values: *const *mut OrtValue,
1316 output_count: core::ffi::c_int
1317 ) -> OrtStatusPtr,
1318 pub ReleaseOp: unsafe extern "system" fn(input: *mut OrtOp),
1319 pub SessionOptionsAppendExecutionProvider: unsafe extern "system" fn(
1320 options: *mut OrtSessionOptions,
1321 provider_name: *const core::ffi::c_char,
1322 provider_options_keys: *const *const core::ffi::c_char,
1323 provider_options_values: *const *const core::ffi::c_char,
1324 num_keys: usize
1325 ) -> OrtStatusPtr,
1326 pub CopyKernelInfo: unsafe extern "system" fn(info: *const OrtKernelInfo, info_copy: *mut *mut OrtKernelInfo) -> OrtStatusPtr,
1327 pub ReleaseKernelInfo: unsafe extern "system" fn(input: *mut OrtKernelInfo),
1328 #[doc = " \\name Ort Training\n @{\n** \\brief Gets the Training C Api struct\n*\n* Call this function to access the ::OrtTrainingApi structure that holds pointers to functions that enable\n* training with onnxruntime.\n* \\note A NULL pointer will be returned and no error message will be printed if the training api\n* is not supported with this build. A NULL pointer will be returned and an error message will be\n* printed if the provided version is unsupported, for example when using a runtime older than the\n* version created with this header file.\n*\n* \\param[in] version Must be ::ORT_API_VERSION\n* \\return The ::OrtTrainingApi struct for the version requested.\n*\n* \\since Version 1.13\n*/"]
1329 pub GetTrainingApi: unsafe extern "system" fn(version: u32) -> *const OrtTrainingApi,
1330 pub SessionOptionsAppendExecutionProvider_CANN:
1331 unsafe extern "system" fn(options: *mut OrtSessionOptions, cann_options: *const OrtCANNProviderOptions) -> OrtStatusPtr,
1332 pub CreateCANNProviderOptions: unsafe extern "system" fn(out: *mut *mut OrtCANNProviderOptions) -> OrtStatusPtr,
1333 pub UpdateCANNProviderOptions: unsafe extern "system" fn(
1334 cann_options: *mut OrtCANNProviderOptions,
1335 provider_options_keys: *const *const core::ffi::c_char,
1336 provider_options_values: *const *const core::ffi::c_char,
1337 num_keys: usize
1338 ) -> OrtStatusPtr,
1339 pub GetCANNProviderOptionsAsString:
1340 unsafe extern "system" fn(cann_options: *const OrtCANNProviderOptions, allocator: *mut OrtAllocator, ptr: *mut *mut core::ffi::c_char) -> OrtStatusPtr,
1341 #[doc = " \\brief Release an OrtCANNProviderOptions\n\n \\param[in] the pointer of OrtCANNProviderOptions which will been deleted\n\n \\since Version 1.13."]
1342 pub ReleaseCANNProviderOptions: unsafe extern "system" fn(input: *mut OrtCANNProviderOptions),
1343 pub MemoryInfoGetDeviceType: unsafe extern "system" fn(ptr: *const OrtMemoryInfo, out: *mut OrtMemoryInfoDeviceType),
1344 pub UpdateEnvWithCustomLogLevel: unsafe extern "system" fn(ort_env: *mut OrtEnv, log_severity_level: OrtLoggingLevel) -> OrtStatusPtr,
1345 pub SetGlobalIntraOpThreadAffinity:
1346 unsafe extern "system" fn(tp_options: *mut OrtThreadingOptions, affinity_string: *const core::ffi::c_char) -> OrtStatusPtr,
1347 pub RegisterCustomOpsLibrary_V2: unsafe extern "system" fn(options: *mut OrtSessionOptions, library_name: *const os_char) -> OrtStatusPtr,
1348 pub RegisterCustomOpsUsingFunction:
1349 unsafe extern "system" fn(options: *mut OrtSessionOptions, registration_func_name: *const core::ffi::c_char) -> OrtStatusPtr,
1350 pub KernelInfo_GetInputCount: unsafe extern "system" fn(info: *const OrtKernelInfo, out: *mut usize) -> OrtStatusPtr,
1351 pub KernelInfo_GetOutputCount: unsafe extern "system" fn(info: *const OrtKernelInfo, out: *mut usize) -> OrtStatusPtr,
1352 pub KernelInfo_GetInputName:
1353 unsafe extern "system" fn(info: *const OrtKernelInfo, index: usize, out: *mut core::ffi::c_char, size: *mut usize) -> OrtStatusPtr,
1354 pub KernelInfo_GetOutputName:
1355 unsafe extern "system" fn(info: *const OrtKernelInfo, index: usize, out: *mut core::ffi::c_char, size: *mut usize) -> OrtStatusPtr,
1356 pub KernelInfo_GetInputTypeInfo: unsafe extern "system" fn(info: *const OrtKernelInfo, index: usize, type_info: *mut *mut OrtTypeInfo) -> OrtStatusPtr,
1357 pub KernelInfo_GetOutputTypeInfo: unsafe extern "system" fn(info: *const OrtKernelInfo, index: usize, type_info: *mut *mut OrtTypeInfo) -> OrtStatusPtr,
1358 pub KernelInfoGetAttribute_tensor: unsafe extern "system" fn(
1359 info: *const OrtKernelInfo,
1360 name: *const core::ffi::c_char,
1361 allocator: *mut OrtAllocator,
1362 out: *mut *mut OrtValue
1363 ) -> OrtStatusPtr,
1364 pub HasSessionConfigEntry:
1365 unsafe extern "system" fn(options: *const OrtSessionOptions, config_key: *const core::ffi::c_char, out: *mut core::ffi::c_int) -> OrtStatusPtr,
1366 pub GetSessionConfigEntry: unsafe extern "system" fn(
1367 options: *const OrtSessionOptions,
1368 config_key: *const core::ffi::c_char,
1369 config_value: *mut core::ffi::c_char,
1370 size: *mut usize
1371 ) -> OrtStatusPtr,
1372 pub SessionOptionsAppendExecutionProvider_Dnnl:
1373 unsafe extern "system" fn(options: *mut OrtSessionOptions, dnnl_options: *const OrtDnnlProviderOptions) -> OrtStatusPtr,
1374 pub CreateDnnlProviderOptions: unsafe extern "system" fn(out: *mut *mut OrtDnnlProviderOptions) -> OrtStatusPtr,
1375 pub UpdateDnnlProviderOptions: unsafe extern "system" fn(
1376 dnnl_options: *mut OrtDnnlProviderOptions,
1377 provider_options_keys: *const *const core::ffi::c_char,
1378 provider_options_values: *const *const core::ffi::c_char,
1379 num_keys: usize
1380 ) -> OrtStatusPtr,
1381 pub GetDnnlProviderOptionsAsString:
1382 unsafe extern "system" fn(dnnl_options: *const OrtDnnlProviderOptions, allocator: *mut OrtAllocator, ptr: *mut *mut core::ffi::c_char) -> OrtStatusPtr,
1383 #[doc = " \\brief Release an ::OrtDnnlProviderOptions\n\n \\since Version 1.15."]
1384 pub ReleaseDnnlProviderOptions: unsafe extern "system" fn(input: *mut OrtDnnlProviderOptions),
1385 pub KernelInfo_GetNodeName: unsafe extern "system" fn(info: *const OrtKernelInfo, out: *mut core::ffi::c_char, size: *mut usize) -> OrtStatusPtr,
1386 pub KernelInfo_GetLogger: unsafe extern "system" fn(info: *const OrtKernelInfo, logger: *mut *const OrtLogger) -> OrtStatusPtr,
1387 pub KernelContext_GetLogger: unsafe extern "system" fn(context: *const OrtKernelContext, logger: *mut *const OrtLogger) -> OrtStatusPtr,
1388 pub Logger_LogMessage: unsafe extern "system" fn(
1389 logger: *const OrtLogger,
1390 log_severity_level: OrtLoggingLevel,
1391 message: *const core::ffi::c_char,
1392 file_path: *const os_char,
1393 line_number: core::ffi::c_int,
1394 func_name: *const core::ffi::c_char
1395 ) -> OrtStatusPtr,
1396 pub Logger_GetLoggingSeverityLevel: unsafe extern "system" fn(logger: *const OrtLogger, out: *mut OrtLoggingLevel) -> OrtStatusPtr,
1397 pub KernelInfoGetConstantInput_tensor:
1398 unsafe extern "system" fn(info: *const OrtKernelInfo, index: usize, is_constant: *mut core::ffi::c_int, out: *mut *const OrtValue) -> OrtStatusPtr,
1399 pub CastTypeInfoToOptionalTypeInfo: unsafe extern "system" fn(type_info: *const OrtTypeInfo, out: *mut *const OrtOptionalTypeInfo) -> OrtStatusPtr,
1400 pub GetOptionalContainedTypeInfo: unsafe extern "system" fn(optional_type_info: *const OrtOptionalTypeInfo, out: *mut *mut OrtTypeInfo) -> OrtStatusPtr,
1401 pub GetResizedStringTensorElementBuffer:
1402 unsafe extern "system" fn(value: *mut OrtValue, index: usize, length_in_bytes: usize, buffer: *mut *mut core::ffi::c_char) -> OrtStatusPtr,
1403 pub KernelContext_GetAllocator:
1404 unsafe extern "system" fn(context: *const OrtKernelContext, mem_info: *const OrtMemoryInfo, out: *mut *mut OrtAllocator) -> OrtStatusPtr,
1405 #[doc = " \\brief Returns a null terminated string of the build info including git info and cxx flags\n\n \\return UTF-8 encoded version string. Do not deallocate the returned buffer.\n\n \\since Version 1.15."]
1406 pub GetBuildInfoString: unsafe extern "system" fn() -> *const core::ffi::c_char,
1407 pub CreateROCMProviderOptions: unsafe extern "system" fn(out: *mut *mut OrtROCMProviderOptions) -> OrtStatusPtr,
1408 pub UpdateROCMProviderOptions: unsafe extern "system" fn(
1409 rocm_options: *mut OrtROCMProviderOptions,
1410 provider_options_keys: *const *const core::ffi::c_char,
1411 provider_options_values: *const *const core::ffi::c_char,
1412 num_keys: usize
1413 ) -> OrtStatusPtr,
1414 pub GetROCMProviderOptionsAsString:
1415 unsafe extern "system" fn(rocm_options: *const OrtROCMProviderOptions, allocator: *mut OrtAllocator, ptr: *mut *mut core::ffi::c_char) -> OrtStatusPtr,
1416 #[doc = " \\brief Release an ::OrtROCMProviderOptions\n\n \\note This is an exception in the naming convention of other Release* functions, as the name of the method does not have the V2 suffix, but the type does\n\n \\since Version 1.16."]
1417 pub ReleaseROCMProviderOptions: unsafe extern "system" fn(input: *mut OrtROCMProviderOptions),
1418 pub CreateAndRegisterAllocatorV2: unsafe extern "system" fn(
1419 env: *mut OrtEnv,
1420 provider_type: *const core::ffi::c_char,
1421 mem_info: *const OrtMemoryInfo,
1422 arena_cfg: *const OrtArenaCfg,
1423 provider_options_keys: *const *const core::ffi::c_char,
1424 provider_options_values: *const *const core::ffi::c_char,
1425 num_keys: usize
1426 ) -> OrtStatusPtr,
1427 #[cfg(not(target_arch = "wasm32"))]
1428 pub RunAsync: unsafe extern "system" fn(
1429 session: *mut OrtSession,
1430 run_options: *const OrtRunOptions,
1431 input_names: *const *const core::ffi::c_char,
1432 input: *const *const OrtValue,
1433 input_len: usize,
1434 output_names: *const *const core::ffi::c_char,
1435 output_names_len: usize,
1436 output: *mut *mut OrtValue,
1437 run_async_callback: RunAsyncCallbackFn,
1438 user_data: *mut core::ffi::c_void
1439 ) -> OrtStatusPtr,
1440 #[cfg(target_arch = "wasm32")]
1441 pub RunAsync: unsafe fn(
1442 session: *mut OrtSession,
1443 run_options: *const OrtRunOptions,
1444 input_names: &[&str],
1445 inputs: &[*const OrtValue],
1446 output_names: &[&str],
1447 outputs: &mut [*mut OrtValue]
1448 ) -> core::pin::Pin<alloc::boxed::Box<dyn core::future::Future<Output = OrtStatusPtr>>>,
1449 pub UpdateTensorRTProviderOptionsWithValue: unsafe extern "system" fn(
1450 tensorrt_options: *mut OrtTensorRTProviderOptionsV2,
1451 key: *const core::ffi::c_char,
1452 value: *mut core::ffi::c_void
1453 ) -> OrtStatusPtr,
1454 pub GetTensorRTProviderOptionsByName: unsafe extern "system" fn(
1455 tensorrt_options: *const OrtTensorRTProviderOptionsV2,
1456 key: *const core::ffi::c_char,
1457 ptr: *mut *mut core::ffi::c_void
1458 ) -> OrtStatusPtr,
1459 pub UpdateCUDAProviderOptionsWithValue:
1460 unsafe extern "system" fn(cuda_options: *mut OrtCUDAProviderOptionsV2, key: *const core::ffi::c_char, value: *mut core::ffi::c_void) -> OrtStatusPtr,
1461 pub GetCUDAProviderOptionsByName: unsafe extern "system" fn(
1462 cuda_options: *const OrtCUDAProviderOptionsV2,
1463 key: *const core::ffi::c_char,
1464 ptr: *mut *mut core::ffi::c_void
1465 ) -> OrtStatusPtr,
1466 pub KernelContext_GetResource: unsafe extern "system" fn(
1467 context: *const OrtKernelContext,
1468 resouce_version: core::ffi::c_int,
1469 resource_id: core::ffi::c_int,
1470 resource: *mut *mut core::ffi::c_void
1471 ) -> OrtStatusPtr,
1472 pub SetUserLoggingFunction: unsafe extern "system" fn(
1473 options: *mut OrtSessionOptions,
1474 user_logging_function: OrtLoggingFunction,
1475 user_logging_param: *mut core::ffi::c_void
1476 ) -> OrtStatusPtr,
1477 pub ShapeInferContext_GetInputCount: unsafe extern "system" fn(context: *const OrtShapeInferContext, out: *mut usize) -> OrtStatusPtr,
1478 pub ShapeInferContext_GetInputTypeShape:
1479 unsafe extern "system" fn(context: *const OrtShapeInferContext, index: usize, info: *mut *mut OrtTensorTypeAndShapeInfo) -> OrtStatusPtr,
1480 pub ShapeInferContext_GetAttribute:
1481 unsafe extern "system" fn(context: *const OrtShapeInferContext, attr_name: *const core::ffi::c_char, attr: *mut *const OrtOpAttr) -> OrtStatusPtr,
1482 pub ShapeInferContext_SetOutputTypeShape:
1483 unsafe extern "system" fn(context: *const OrtShapeInferContext, index: usize, info: *const OrtTensorTypeAndShapeInfo) -> OrtStatusPtr,
1484 pub SetSymbolicDimensions:
1485 unsafe extern "system" fn(info: *mut OrtTensorTypeAndShapeInfo, dim_params: *mut *const core::ffi::c_char, dim_params_length: usize) -> OrtStatusPtr,
1486 pub ReadOpAttr:
1487 unsafe extern "system" fn(op_attr: *const OrtOpAttr, type_: OrtOpAttrType, data: *mut core::ffi::c_void, len: usize, out: *mut usize) -> OrtStatusPtr,
1488 pub SetDeterministicCompute: unsafe extern "system" fn(options: *mut OrtSessionOptions, value: bool) -> OrtStatusPtr,
1489 pub KernelContext_ParallelFor: unsafe extern "system" fn(
1490 context: *const OrtKernelContext,
1491 fn_: unsafe extern "system" fn(arg1: *mut core::ffi::c_void, arg2: usize),
1492 total: usize,
1493 num_batch: usize,
1494 usr_data: *mut core::ffi::c_void
1495 ) -> OrtStatusPtr,
1496 pub SessionOptionsAppendExecutionProvider_OpenVINO_V2: unsafe extern "system" fn(
1497 options: *mut OrtSessionOptions,
1498 provider_options_keys: *const *const core::ffi::c_char,
1499 provider_options_values: *const *const core::ffi::c_char,
1500 num_keys: usize
1501 ) -> OrtStatusPtr,
1502 pub SessionOptionsAppendExecutionProvider_VitisAI: unsafe extern "system" fn(
1503 options: *mut OrtSessionOptions,
1504 provider_options_keys: *const *const core::ffi::c_char,
1505 provider_options_values: *const *const core::ffi::c_char,
1506 num_keys: usize
1507 ) -> OrtStatusPtr,
1508 pub KernelContext_GetScratchBuffer: unsafe extern "system" fn(
1509 context: *const OrtKernelContext,
1510 mem_info: *const OrtMemoryInfo,
1511 count_or_bytes: usize,
1512 out: *mut *mut core::ffi::c_void
1513 ) -> OrtStatusPtr,
1514 pub KernelInfoGetAllocator: unsafe extern "system" fn(info: *const OrtKernelInfo, mem_type: OrtMemType, out: *mut *mut OrtAllocator) -> OrtStatusPtr,
1515 pub AddExternalInitializersFromMemory: unsafe extern "system" fn(
1516 options: *mut OrtSessionOptions,
1517 external_initializer_file_names: *const *const os_char,
1518 external_initializer_file_buffer_array: *const *mut core::ffi::c_char,
1519 external_initializer_file_lengths: *const usize,
1520 num_external_initializer_files: usize
1521 ) -> OrtStatusPtr,
1522 pub CreateLoraAdapter:
1523 unsafe extern "system" fn(adapter_file_path: *const os_char, allocator: *mut OrtAllocator, out: *mut *mut OrtLoraAdapter) -> OrtStatusPtr,
1524 pub CreateLoraAdapterFromArray: unsafe extern "system" fn(
1525 bytes: *const core::ffi::c_void,
1526 num_bytes: usize,
1527 allocator: *mut OrtAllocator,
1528 out: *mut *mut OrtLoraAdapter
1529 ) -> OrtStatusPtr,
1530 pub ReleaseLoraAdapter: unsafe extern "system" fn(input: *mut OrtLoraAdapter),
1531 pub RunOptionsAddActiveLoraAdapter: unsafe extern "system" fn(options: *mut OrtRunOptions, adapter: *const OrtLoraAdapter) -> OrtStatusPtr,
1532 pub SetEpDynamicOptions: unsafe extern "system" fn(
1533 sess: *mut OrtSession,
1534 keys: *const *const core::ffi::c_char,
1535 values: *const *const core::ffi::c_char,
1536 kv_len: usize
1537 ) -> OrtStatusPtr,
1538 pub ReleaseValueInfo: unsafe extern "system" fn(input: *mut OrtValueInfo),
1539 pub ReleaseNode: unsafe extern "system" fn(input: *mut OrtNode),
1540 pub ReleaseGraph: unsafe extern "system" fn(input: *mut OrtGraph),
1541 pub ReleaseModel: unsafe extern "system" fn(input: *mut OrtModel),
1542 pub GetValueInfoName: unsafe extern "system" fn(value_info: *const OrtValueInfo, name: *mut *const c_char) -> OrtStatusPtr,
1543 pub GetValueInfoTypeInfo: unsafe extern "system" fn(value_info: *const OrtValueInfo, type_info: *mut *const OrtTypeInfo) -> OrtStatusPtr,
1544 pub GetModelEditorApi: unsafe extern "system" fn() -> *const OrtModelEditorApi,
1545 pub CreateTensorWithDataAndDeleterAsOrtValue: unsafe extern "system" fn(
1546 deleter: *mut OrtAllocator,
1547 p_data: *mut c_void,
1548 p_data_len: usize,
1549 shape: *const i64,
1550 shape_len: usize,
1551 r#type: ONNXTensorElementDataType,
1552 out: *mut *mut OrtValue
1553 ) -> OrtStatusPtr,
1554 pub SessionOptionsSetLoadCancellationFlag: unsafe extern "system" fn(options: *mut OrtSessionOptions, cancel: bool) -> OrtStatusPtr,
1555 pub GetCompileApi: unsafe extern "system" fn() -> *const OrtCompileApi,
1556 pub CreateKeyValuePairs: unsafe extern "system" fn(out: *mut *mut OrtKeyValuePairs),
1557 pub AddKeyValuePair: unsafe extern "system" fn(kvps: *mut OrtKeyValuePairs, key: *const c_char, value: *const c_char),
1558 pub GetKeyValue: unsafe extern "system" fn(kvps: *const OrtKeyValuePairs, key: *const c_char) -> *const c_char,
1559 pub GetKeyValuePairs:
1560 unsafe extern "system" fn(kvps: *const OrtKeyValuePairs, keys: *mut *const *const c_char, values: *mut *const *const c_char, num_entries: *mut usize),
1561 pub RemoveKeyValuePair: unsafe extern "system" fn(kvps: *mut OrtKeyValuePairs, key: *const c_char),
1562 pub ReleaseKeyValuePairs: unsafe extern "system" fn(input: *mut OrtKeyValuePairs),
1563 pub RegisterExecutionProviderLibrary: unsafe extern "system" fn(env: *mut OrtEnv, registration_name: *const c_char, path: *const os_char) -> OrtStatusPtr,
1564 pub UnregisterExecutionProviderLibrary: unsafe extern "system" fn(env: *mut OrtEnv, registration_name: *const c_char) -> OrtStatusPtr,
1565 pub GetEpDevices: unsafe extern "system" fn(env: *const OrtEnv, ep_devices: *mut *const *const OrtEpDevice, num_ep_devices: *mut usize) -> OrtStatusPtr,
1566 pub SessionOptionsAppendExecutionProvider_V2: unsafe extern "system" fn(
1567 session_options: *mut OrtSessionOptions,
1568 env: *mut OrtEnv,
1569 ep_devices: *const *const OrtEpDevice,
1570 num_ep_devices: usize,
1571 ep_option_keys: *const *const c_char,
1572 ep_option_vals: *const *const c_char,
1573 num_ep_options: usize
1574 ) -> OrtStatusPtr,
1575 pub SessionOptionsSetEpSelectionPolicy:
1576 unsafe extern "system" fn(session_options: *mut OrtSessionOptions, policy: OrtExecutionProviderDevicePolicy) -> OrtStatusPtr,
1577 pub SessionOptionsSetEpSelectionPolicyDelegate:
1578 unsafe extern "system" fn(session_options: *mut OrtSessionOptions, delegate: EpSelectionDelegate, delegate_state: *mut c_void) -> OrtStatusPtr,
1579 pub HardwareDevice_Type: unsafe extern "system" fn(device: *const OrtHardwareDevice) -> OrtHardwareDeviceType,
1580 pub HardwareDevice_VendorId: unsafe extern "system" fn(device: *const OrtHardwareDevice) -> u32,
1581 pub HardwareDevice_Vendor: unsafe extern "system" fn(device: *const OrtHardwareDevice) -> *const c_char,
1582 pub HardwareDevice_DeviceId: unsafe extern "system" fn(device: *const OrtHardwareDevice) -> u32,
1583 pub HardwareDevice_Metadata: unsafe extern "system" fn(device: *const OrtHardwareDevice) -> *const OrtKeyValuePairs,
1584 pub EpDevice_EpName: unsafe extern "system" fn(ep_device: *const OrtEpDevice) -> *const c_char,
1585 pub EpDevice_EpVendor: unsafe extern "system" fn(ep_device: *const OrtEpDevice) -> *const c_char,
1586 pub EpDevice_EpMetadata: unsafe extern "system" fn(ep_device: *const OrtEpDevice) -> *const OrtKeyValuePairs,
1587 pub EpDevice_EpOptions: unsafe extern "system" fn(ep_device: *const OrtEpDevice) -> *const OrtKeyValuePairs,
1588 pub EpDevice_Device: unsafe extern "system" fn(ep_device: *const OrtEpDevice) -> *const OrtHardwareDevice,
1589 pub GetEpApi: unsafe extern "system" fn() -> *const OrtEpApi
1590}
1591#[repr(i32)]
1592#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
1593pub enum OrtCustomOpInputOutputCharacteristic {
1594 INPUT_OUTPUT_REQUIRED = 0,
1595 INPUT_OUTPUT_OPTIONAL = 1,
1596 INPUT_OUTPUT_VARIADIC = 2
1597}
1598#[repr(C)]
1599#[derive(Debug, Copy, Clone)]
1600pub struct OrtCustomOp {
1601 pub version: u32,
1602 pub CreateKernel: Option<unsafe extern "system" fn(op: *const OrtCustomOp, api: *const OrtApi, info: *const OrtKernelInfo) -> *mut core::ffi::c_void>,
1603 pub GetName: Option<unsafe extern "system" fn(op: *const OrtCustomOp) -> *const core::ffi::c_char>,
1604 pub GetExecutionProviderType: Option<unsafe extern "system" fn(op: *const OrtCustomOp) -> *const core::ffi::c_char>,
1605 pub GetInputType: Option<unsafe extern "system" fn(op: *const OrtCustomOp, index: usize) -> ONNXTensorElementDataType>,
1606 pub GetInputTypeCount: Option<unsafe extern "system" fn(op: *const OrtCustomOp) -> usize>,
1607 pub GetOutputType: Option<unsafe extern "system" fn(op: *const OrtCustomOp, index: usize) -> ONNXTensorElementDataType>,
1608 pub GetOutputTypeCount: Option<unsafe extern "system" fn(op: *const OrtCustomOp) -> usize>,
1609 pub KernelCompute: Option<unsafe extern "system" fn(op_kernel: *mut core::ffi::c_void, context: *mut OrtKernelContext)>,
1610 pub KernelDestroy: Option<unsafe extern "system" fn(op_kernel: *mut core::ffi::c_void)>,
1611 pub GetInputCharacteristic: Option<unsafe extern "system" fn(op: *const OrtCustomOp, index: usize) -> OrtCustomOpInputOutputCharacteristic>,
1612 pub GetOutputCharacteristic: Option<unsafe extern "system" fn(op: *const OrtCustomOp, index: usize) -> OrtCustomOpInputOutputCharacteristic>,
1613 pub GetInputMemoryType: Option<unsafe extern "system" fn(op: *const OrtCustomOp, index: usize) -> OrtMemType>,
1614 pub GetVariadicInputMinArity: Option<unsafe extern "system" fn(op: *const OrtCustomOp) -> core::ffi::c_int>,
1615 pub GetVariadicInputHomogeneity: Option<unsafe extern "system" fn(op: *const OrtCustomOp) -> core::ffi::c_int>,
1616 pub GetVariadicOutputMinArity: Option<unsafe extern "system" fn(op: *const OrtCustomOp) -> core::ffi::c_int>,
1617 pub GetVariadicOutputHomogeneity: Option<unsafe extern "system" fn(op: *const OrtCustomOp) -> core::ffi::c_int>,
1618 pub CreateKernelV2: Option<
1619 unsafe extern "system" fn(op: *const OrtCustomOp, api: *const OrtApi, info: *const OrtKernelInfo, kernel: *mut *mut core::ffi::c_void) -> OrtStatusPtr
1620 >,
1621 pub KernelComputeV2: Option<unsafe extern "system" fn(op_kernel: *mut core::ffi::c_void, context: *mut OrtKernelContext) -> OrtStatusPtr>,
1622 pub InferOutputShapeFn: Option<unsafe extern "system" fn(op: *const OrtCustomOp, arg1: *mut OrtShapeInferContext) -> OrtStatusPtr>,
1623 pub GetStartVersion: Option<unsafe extern "system" fn(op: *const OrtCustomOp) -> core::ffi::c_int>,
1624 pub GetEndVersion: Option<unsafe extern "system" fn(op: *const OrtCustomOp) -> core::ffi::c_int>,
1625 pub GetMayInplace: Option<unsafe extern "system" fn(input_index: *mut *mut core::ffi::c_int, output_index: *mut *mut core::ffi::c_int) -> usize>,
1626 pub ReleaseMayInplace: Option<unsafe extern "system" fn(input_index: *mut core::ffi::c_int, output_index: *mut *mut core::ffi::c_int)>,
1627 pub GetAliasMap: Option<unsafe extern "system" fn(input_index: *mut *mut core::ffi::c_int, output_index: *mut *mut core::ffi::c_int) -> usize>,
1628 pub ReleaseAliasMap: Option<unsafe extern "system" fn(input_index: *mut core::ffi::c_int, output_index: *mut *mut core::ffi::c_int)>
1629}
1630unsafe extern "system" {
1631 pub fn OrtSessionOptionsAppendExecutionProvider_CUDA(options: *mut OrtSessionOptions, device_id: core::ffi::c_int) -> OrtStatusPtr;
1632 pub fn OrtSessionOptionsAppendExecutionProvider_ROCM(options: *mut OrtSessionOptions, device_id: core::ffi::c_int) -> OrtStatusPtr;
1633 pub fn OrtSessionOptionsAppendExecutionProvider_MIGraphX(options: *mut OrtSessionOptions, device_id: core::ffi::c_int) -> OrtStatusPtr;
1634 pub fn OrtSessionOptionsAppendExecutionProvider_Dnnl(options: *mut OrtSessionOptions, use_arena: core::ffi::c_int) -> OrtStatusPtr;
1635 pub fn OrtSessionOptionsAppendExecutionProvider_Tensorrt(options: *mut OrtSessionOptions, device_id: core::ffi::c_int) -> OrtStatusPtr;
1636}