mirror of
https://github.com/pykeio/ort
synced 2026-04-25 16:34:55 +02:00
feat: support older ONNX Runtime versions (#524)
This commit is contained in:
16
.github/workflows/other-checks.yml
vendored
16
.github/workflows/other-checks.yml
vendored
@@ -49,3 +49,19 @@ jobs:
|
||||
run: |
|
||||
cargo check -p ort
|
||||
cargo check -p ort --features load-dynamic
|
||||
multiversion:
|
||||
name: Multiversion
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- name: Install stable Rust toolchain
|
||||
uses: dtolnay/rust-toolchain@1.88
|
||||
- uses: Swatinem/rust-cache@v2.7.8
|
||||
- name: Run checks
|
||||
run: |
|
||||
cargo check -p ort --no-default-features --features api-17
|
||||
cargo check -p ort --no-default-features --features api-18
|
||||
cargo check -p ort --no-default-features --features api-19
|
||||
cargo check -p ort --no-default-features --features api-20
|
||||
cargo check -p ort --no-default-features --features api-21
|
||||
cargo check -p ort --no-default-features --features api-22
|
||||
|
||||
10
Cargo.toml
10
Cargo.toml
@@ -47,7 +47,7 @@ targets = ["x86_64-unknown-linux-gnu", "wasm32-unknown-unknown"]
|
||||
rustdoc-args = [ "--cfg", "docsrs" ]
|
||||
|
||||
[features]
|
||||
default = [ "std", "ndarray", "tracing", "download-binaries", "tls-native", "copy-dylibs" ]
|
||||
default = [ "std", "ndarray", "tracing", "download-binaries", "tls-native", "copy-dylibs", "api-23" ]
|
||||
|
||||
std = [ "ort-sys/std", "ndarray/std", "tracing?/std" ]
|
||||
training = [ "ort-sys/training" ]
|
||||
@@ -64,6 +64,14 @@ load-dynamic = [ "std", "preload-dylibs", "ort-sys/disable-linking" ]
|
||||
copy-dylibs = [ "ort-sys/copy-dylibs" ]
|
||||
pkg-config = [ "ort-sys/pkg-config" ]
|
||||
|
||||
api-17 = [ "ort-sys/api-17" ]
|
||||
api-18 = [ "ort-sys/api-18", "api-17" ]
|
||||
api-19 = [ "ort-sys/api-19", "api-18" ]
|
||||
api-20 = [ "ort-sys/api-20", "api-19" ]
|
||||
api-21 = [ "ort-sys/api-21", "api-20" ]
|
||||
api-22 = [ "ort-sys/api-22", "api-21" ]
|
||||
api-23 = [ "ort-sys/api-23", "api-22" ]
|
||||
|
||||
tls-rustls = [ "ort-sys/tls-rustls", "ureq?/rustls" ]
|
||||
tls-rustls-no-provider = [ "ort-sys/tls-rustls-no-provider", "ureq?/rustls-no-provider" ]
|
||||
tls-native = [ "ort-sys/tls-native", "ureq?/native-tls" ]
|
||||
|
||||
@@ -31,7 +31,7 @@ path = "lib.rs"
|
||||
[features]
|
||||
|
||||
[workspace.dependencies]
|
||||
ort-sys = { version = "=2.0.0-rc.11", path = "../../ort-sys", default-features = false }
|
||||
ort-sys = { version = "=2.0.0-rc.11", path = "../../ort-sys", default-features = false, features = [ "api-17" ] }
|
||||
|
||||
[dependencies]
|
||||
ort-sys = { workspace = true }
|
||||
@@ -40,7 +40,7 @@ candle-onnx = { version = "=0.9.2" }
|
||||
prost = { version = "0.14.1", default-features = false }
|
||||
|
||||
[dev-dependencies]
|
||||
ort = { version = "=2.0.0-rc.11", path = "../../", default-features = false, features = [ "alternative-backend", "fetch-models", "tls-rustls" ] }
|
||||
ort = { version = "=2.0.0-rc.11", path = "../../", default-features = false, features = [ "alternative-backend", "fetch-models", "tls-rustls", "api-17" ] }
|
||||
|
||||
[[test]]
|
||||
name = "memory"
|
||||
|
||||
@@ -9,7 +9,7 @@ unsafe extern "system" fn get_version_string() -> *const ort_sys::c_char {
|
||||
}
|
||||
|
||||
unsafe extern "system" fn get_api(version: u32) -> *const ort_sys::OrtApi {
|
||||
if version <= 23 { &API as *const _ } else { core::ptr::null() }
|
||||
if version <= ort_sys::ORT_API_VERSION { &API as *const _ } else { core::ptr::null() }
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
|
||||
@@ -31,7 +31,7 @@ path = "lib.rs"
|
||||
[features]
|
||||
|
||||
[workspace.dependencies]
|
||||
ort-sys = { version = "=2.0.0-rc.11", path = "../../ort-sys", default-features = false }
|
||||
ort-sys = { version = "=2.0.0-rc.11", path = "../../ort-sys", default-features = false, features = [ "api-17" ] }
|
||||
|
||||
[dependencies]
|
||||
ort-sys = { workspace = true }
|
||||
@@ -39,7 +39,7 @@ tract-onnx = "0.22"
|
||||
parking_lot = "0.12"
|
||||
|
||||
[dev-dependencies]
|
||||
ort = { version = "=2.0.0-rc.11", path = "../../", default-features = false, features = [ "alternative-backend", "fetch-models", "tls-rustls", "ndarray" ] }
|
||||
ort = { version = "=2.0.0-rc.11", path = "../../", default-features = false, features = [ "alternative-backend", "fetch-models", "tls-rustls", "ndarray", "api-17" ] }
|
||||
image = "0.25"
|
||||
ndarray = "0.17"
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ unsafe extern "system" fn get_version_string() -> *const ort_sys::c_char {
|
||||
}
|
||||
|
||||
unsafe extern "system" fn get_api(version: u32) -> *const ort_sys::OrtApi {
|
||||
if version <= 23 { &API as *const _ } else { core::ptr::null() }
|
||||
if version <= ort_sys::ORT_API_VERSION { &API as *const _ } else { core::ptr::null() }
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
|
||||
@@ -23,8 +23,8 @@ path = "lib.rs"
|
||||
|
||||
[dependencies]
|
||||
js-sys = "0.3"
|
||||
ort = { path = "../../", version = "=2.0.0-rc.11", default-features = false, features = [ "alternative-backend" ] }
|
||||
ort-sys = { path = "../../ort-sys", version = "=2.0.0-rc.11", default-features = false, features = [ "disable-linking" ] }
|
||||
ort = { path = "../../", version = "=2.0.0-rc.11", default-features = false, features = [ "alternative-backend", "api-17" ] }
|
||||
ort-sys = { path = "../../ort-sys", version = "=2.0.0-rc.11", default-features = false, features = [ "disable-linking", "api-17" ] }
|
||||
serde = { version = "1.0", features = [ "derive" ] }
|
||||
serde-wasm-bindgen = "0.6"
|
||||
wasm-bindgen = "0.2"
|
||||
|
||||
@@ -20,15 +20,22 @@ build = "build/main.rs"
|
||||
status = "actively-developed"
|
||||
|
||||
[features]
|
||||
default = [ "std" ]
|
||||
default = [ "std", "api-17" ]
|
||||
std = []
|
||||
pkg-config = [ "dep:pkg-config" ]
|
||||
training = []
|
||||
download-binaries = [ "dep:ureq", "dep:lzma-rust2", "dep:hmac-sha256" ]
|
||||
copy-dylibs = []
|
||||
|
||||
disable-linking = []
|
||||
|
||||
api-17 = []
|
||||
api-18 = [ "api-17" ]
|
||||
api-19 = [ "api-18" ]
|
||||
api-20 = [ "api-19" ]
|
||||
api-21 = [ "api-20" ]
|
||||
api-22 = [ "api-21" ]
|
||||
api-23 = [ "api-22" ]
|
||||
|
||||
cuda = []
|
||||
tensorrt = []
|
||||
openvino = []
|
||||
|
||||
@@ -1502,19 +1502,23 @@ pub struct OrtApi {
|
||||
provider_options_values: *const *const core::ffi::c_char,
|
||||
num_keys: usize
|
||||
) -> OrtStatusPtr,
|
||||
#[cfg(feature = "api-18")]
|
||||
pub SessionOptionsAppendExecutionProvider_VitisAI: unsafe extern "system" fn(
|
||||
options: *mut OrtSessionOptions,
|
||||
provider_options_keys: *const *const core::ffi::c_char,
|
||||
provider_options_values: *const *const core::ffi::c_char,
|
||||
num_keys: usize
|
||||
) -> OrtStatusPtr,
|
||||
#[cfg(feature = "api-18")]
|
||||
pub KernelContext_GetScratchBuffer: unsafe extern "system" fn(
|
||||
context: *const OrtKernelContext,
|
||||
mem_info: *const OrtMemoryInfo,
|
||||
count_or_bytes: usize,
|
||||
out: *mut *mut core::ffi::c_void
|
||||
) -> OrtStatusPtr,
|
||||
#[cfg(feature = "api-18")]
|
||||
pub KernelInfoGetAllocator: unsafe extern "system" fn(info: *const OrtKernelInfo, mem_type: OrtMemType, out: *mut *mut OrtAllocator) -> OrtStatusPtr,
|
||||
#[cfg(feature = "api-18")]
|
||||
pub AddExternalInitializersFromMemory: unsafe extern "system" fn(
|
||||
options: *mut OrtSessionOptions,
|
||||
external_initializer_file_names: *const *const os_char,
|
||||
@@ -1522,29 +1526,42 @@ pub struct OrtApi {
|
||||
external_initializer_file_lengths: *const usize,
|
||||
num_external_initializer_files: usize
|
||||
) -> OrtStatusPtr,
|
||||
#[cfg(feature = "api-20")]
|
||||
pub CreateLoraAdapter:
|
||||
unsafe extern "system" fn(adapter_file_path: *const os_char, allocator: *mut OrtAllocator, out: *mut *mut OrtLoraAdapter) -> OrtStatusPtr,
|
||||
#[cfg(feature = "api-20")]
|
||||
pub CreateLoraAdapterFromArray: unsafe extern "system" fn(
|
||||
bytes: *const core::ffi::c_void,
|
||||
num_bytes: usize,
|
||||
allocator: *mut OrtAllocator,
|
||||
out: *mut *mut OrtLoraAdapter
|
||||
) -> OrtStatusPtr,
|
||||
#[cfg(feature = "api-20")]
|
||||
pub ReleaseLoraAdapter: unsafe extern "system" fn(input: *mut OrtLoraAdapter),
|
||||
#[cfg(feature = "api-20")]
|
||||
pub RunOptionsAddActiveLoraAdapter: unsafe extern "system" fn(options: *mut OrtRunOptions, adapter: *const OrtLoraAdapter) -> OrtStatusPtr,
|
||||
#[cfg(feature = "api-20")]
|
||||
pub SetEpDynamicOptions: unsafe extern "system" fn(
|
||||
sess: *mut OrtSession,
|
||||
keys: *const *const core::ffi::c_char,
|
||||
values: *const *const core::ffi::c_char,
|
||||
kv_len: usize
|
||||
) -> OrtStatusPtr,
|
||||
#[cfg(feature = "api-22")]
|
||||
pub ReleaseValueInfo: unsafe extern "system" fn(input: *mut OrtValueInfo),
|
||||
#[cfg(feature = "api-22")]
|
||||
pub ReleaseNode: unsafe extern "system" fn(input: *mut OrtNode),
|
||||
#[cfg(feature = "api-22")]
|
||||
pub ReleaseGraph: unsafe extern "system" fn(input: *mut OrtGraph),
|
||||
#[cfg(feature = "api-22")]
|
||||
pub ReleaseModel: unsafe extern "system" fn(input: *mut OrtModel),
|
||||
#[cfg(feature = "api-22")]
|
||||
pub GetValueInfoName: unsafe extern "system" fn(value_info: *const OrtValueInfo, name: *mut *const c_char) -> OrtStatusPtr,
|
||||
#[cfg(feature = "api-22")]
|
||||
pub GetValueInfoTypeInfo: unsafe extern "system" fn(value_info: *const OrtValueInfo, type_info: *mut *const OrtTypeInfo) -> OrtStatusPtr,
|
||||
#[cfg(feature = "api-22")]
|
||||
pub GetModelEditorApi: unsafe extern "system" fn() -> *const OrtModelEditorApi,
|
||||
#[cfg(feature = "api-22")]
|
||||
pub CreateTensorWithDataAndDeleterAsOrtValue: unsafe extern "system" fn(
|
||||
deleter: *mut OrtAllocator,
|
||||
p_data: *mut c_void,
|
||||
@@ -1554,18 +1571,30 @@ pub struct OrtApi {
|
||||
r#type: ONNXTensorElementDataType,
|
||||
out: *mut *mut OrtValue
|
||||
) -> OrtStatusPtr,
|
||||
#[cfg(feature = "api-22")]
|
||||
pub SessionOptionsSetLoadCancellationFlag: unsafe extern "system" fn(options: *mut OrtSessionOptions, cancel: bool) -> OrtStatusPtr,
|
||||
#[cfg(feature = "api-22")]
|
||||
pub GetCompileApi: unsafe extern "system" fn() -> *const OrtCompileApi,
|
||||
#[cfg(feature = "api-22")]
|
||||
pub CreateKeyValuePairs: unsafe extern "system" fn(out: *mut *mut OrtKeyValuePairs),
|
||||
#[cfg(feature = "api-22")]
|
||||
pub AddKeyValuePair: unsafe extern "system" fn(kvps: *mut OrtKeyValuePairs, key: *const c_char, value: *const c_char),
|
||||
#[cfg(feature = "api-22")]
|
||||
pub GetKeyValue: unsafe extern "system" fn(kvps: *const OrtKeyValuePairs, key: *const c_char) -> *const c_char,
|
||||
#[cfg(feature = "api-22")]
|
||||
pub GetKeyValuePairs:
|
||||
unsafe extern "system" fn(kvps: *const OrtKeyValuePairs, keys: *mut *const *const c_char, values: *mut *const *const c_char, num_entries: *mut usize),
|
||||
#[cfg(feature = "api-22")]
|
||||
pub RemoveKeyValuePair: unsafe extern "system" fn(kvps: *mut OrtKeyValuePairs, key: *const c_char),
|
||||
#[cfg(feature = "api-22")]
|
||||
pub ReleaseKeyValuePairs: unsafe extern "system" fn(input: *mut OrtKeyValuePairs),
|
||||
#[cfg(feature = "api-22")]
|
||||
pub RegisterExecutionProviderLibrary: unsafe extern "system" fn(env: *mut OrtEnv, registration_name: *const c_char, path: *const os_char) -> OrtStatusPtr,
|
||||
#[cfg(feature = "api-22")]
|
||||
pub UnregisterExecutionProviderLibrary: unsafe extern "system" fn(env: *mut OrtEnv, registration_name: *const c_char) -> OrtStatusPtr,
|
||||
#[cfg(feature = "api-22")]
|
||||
pub GetEpDevices: unsafe extern "system" fn(env: *const OrtEnv, ep_devices: *mut *const *const OrtEpDevice, num_ep_devices: *mut usize) -> OrtStatusPtr,
|
||||
#[cfg(feature = "api-22")]
|
||||
pub SessionOptionsAppendExecutionProvider_V2: unsafe extern "system" fn(
|
||||
session_options: *mut OrtSessionOptions,
|
||||
env: *mut OrtEnv,
|
||||
@@ -1575,20 +1604,33 @@ pub struct OrtApi {
|
||||
ep_option_vals: *const *const c_char,
|
||||
num_ep_options: usize
|
||||
) -> OrtStatusPtr,
|
||||
#[cfg(feature = "api-22")]
|
||||
pub SessionOptionsSetEpSelectionPolicy:
|
||||
unsafe extern "system" fn(session_options: *mut OrtSessionOptions, policy: OrtExecutionProviderDevicePolicy) -> OrtStatusPtr,
|
||||
#[cfg(feature = "api-22")]
|
||||
pub SessionOptionsSetEpSelectionPolicyDelegate:
|
||||
unsafe extern "system" fn(session_options: *mut OrtSessionOptions, delegate: EpSelectionDelegate, delegate_state: *mut c_void) -> OrtStatusPtr,
|
||||
#[cfg(feature = "api-22")]
|
||||
pub HardwareDevice_Type: unsafe extern "system" fn(device: *const OrtHardwareDevice) -> OrtHardwareDeviceType,
|
||||
#[cfg(feature = "api-22")]
|
||||
pub HardwareDevice_VendorId: unsafe extern "system" fn(device: *const OrtHardwareDevice) -> u32,
|
||||
#[cfg(feature = "api-22")]
|
||||
pub HardwareDevice_Vendor: unsafe extern "system" fn(device: *const OrtHardwareDevice) -> *const c_char,
|
||||
#[cfg(feature = "api-22")]
|
||||
pub HardwareDevice_DeviceId: unsafe extern "system" fn(device: *const OrtHardwareDevice) -> u32,
|
||||
#[cfg(feature = "api-22")]
|
||||
pub HardwareDevice_Metadata: unsafe extern "system" fn(device: *const OrtHardwareDevice) -> *const OrtKeyValuePairs,
|
||||
#[cfg(feature = "api-22")]
|
||||
pub EpDevice_EpName: unsafe extern "system" fn(ep_device: *const OrtEpDevice) -> *const c_char,
|
||||
#[cfg(feature = "api-22")]
|
||||
pub EpDevice_EpVendor: unsafe extern "system" fn(ep_device: *const OrtEpDevice) -> *const c_char,
|
||||
#[cfg(feature = "api-22")]
|
||||
pub EpDevice_EpMetadata: unsafe extern "system" fn(ep_device: *const OrtEpDevice) -> *const OrtKeyValuePairs,
|
||||
#[cfg(feature = "api-22")]
|
||||
pub EpDevice_EpOptions: unsafe extern "system" fn(ep_device: *const OrtEpDevice) -> *const OrtKeyValuePairs,
|
||||
#[cfg(feature = "api-22")]
|
||||
pub EpDevice_Device: unsafe extern "system" fn(ep_device: *const OrtEpDevice) -> *const OrtHardwareDevice,
|
||||
#[cfg(feature = "api-22")]
|
||||
pub GetEpApi: unsafe extern "system" fn() -> *const OrtEpApi
|
||||
}
|
||||
#[repr(i32)]
|
||||
|
||||
@@ -1655,6 +1655,7 @@ unsafe extern "system" fn SessionOptionsAppendExecutionProvider_OpenVINO_V2(
|
||||
Error::new_sys(OrtErrorCode::ORT_NOT_IMPLEMENTED, "Unimplemented")
|
||||
}
|
||||
|
||||
#[cfg(feature = "api-18")]
|
||||
unsafe extern "system" fn SessionOptionsAppendExecutionProvider_VitisAI(
|
||||
options: *mut OrtSessionOptions,
|
||||
provider_options_keys: *const *const ::core::ffi::c_char,
|
||||
@@ -1664,6 +1665,7 @@ unsafe extern "system" fn SessionOptionsAppendExecutionProvider_VitisAI(
|
||||
Error::new_sys(OrtErrorCode::ORT_NOT_IMPLEMENTED, "Unimplemented")
|
||||
}
|
||||
|
||||
#[cfg(feature = "api-18")]
|
||||
unsafe extern "system" fn KernelContext_GetScratchBuffer(
|
||||
context: *const OrtKernelContext,
|
||||
mem_info: *const OrtMemoryInfo,
|
||||
@@ -1673,10 +1675,12 @@ unsafe extern "system" fn KernelContext_GetScratchBuffer(
|
||||
Error::new_sys(OrtErrorCode::ORT_NOT_IMPLEMENTED, "Unimplemented")
|
||||
}
|
||||
|
||||
#[cfg(feature = "api-18")]
|
||||
unsafe extern "system" fn KernelInfoGetAllocator(info: *const OrtKernelInfo, mem_type: OrtMemType, out: *mut *mut OrtAllocator) -> OrtStatusPtr {
|
||||
Error::new_sys(OrtErrorCode::ORT_NOT_IMPLEMENTED, "Unimplemented")
|
||||
}
|
||||
|
||||
#[cfg(feature = "api-18")]
|
||||
unsafe extern "system" fn AddExternalInitializersFromMemory(
|
||||
options: *mut OrtSessionOptions,
|
||||
external_initializer_file_names: *const *const os_char,
|
||||
@@ -1687,10 +1691,12 @@ unsafe extern "system" fn AddExternalInitializersFromMemory(
|
||||
Error::new_sys(OrtErrorCode::ORT_NOT_IMPLEMENTED, "Unimplemented")
|
||||
}
|
||||
|
||||
#[cfg(feature = "api-20")]
|
||||
unsafe extern "system" fn CreateLoraAdapter(adapter_file_path: *const os_char, allocator: *mut OrtAllocator, out: *mut *mut OrtLoraAdapter) -> OrtStatusPtr {
|
||||
Error::new_sys(OrtErrorCode::ORT_NOT_IMPLEMENTED, "Unimplemented")
|
||||
}
|
||||
|
||||
#[cfg(feature = "api-20")]
|
||||
unsafe extern "system" fn CreateLoraAdapterFromArray(
|
||||
bytes: *const ::core::ffi::c_void,
|
||||
num_bytes: usize,
|
||||
@@ -1700,12 +1706,15 @@ unsafe extern "system" fn CreateLoraAdapterFromArray(
|
||||
Error::new_sys(OrtErrorCode::ORT_NOT_IMPLEMENTED, "Unimplemented")
|
||||
}
|
||||
|
||||
#[cfg(feature = "api-20")]
|
||||
unsafe extern "system" fn ReleaseLoraAdapter(input: *mut OrtLoraAdapter) {}
|
||||
|
||||
#[cfg(feature = "api-20")]
|
||||
unsafe extern "system" fn RunOptionsAddActiveLoraAdapter(options: *mut OrtRunOptions, adapter: *const OrtLoraAdapter) -> OrtStatusPtr {
|
||||
Error::new_sys(OrtErrorCode::ORT_NOT_IMPLEMENTED, "Unimplemented")
|
||||
}
|
||||
|
||||
#[cfg(feature = "api-20")]
|
||||
unsafe extern "system" fn SetEpDynamicOptions(
|
||||
sess: *mut OrtSession,
|
||||
keys: *const *const ::core::ffi::c_char,
|
||||
@@ -1715,26 +1724,34 @@ unsafe extern "system" fn SetEpDynamicOptions(
|
||||
Error::new_sys(OrtErrorCode::ORT_NOT_IMPLEMENTED, "Unimplemented")
|
||||
}
|
||||
|
||||
#[cfg(feature = "api-22")]
|
||||
unsafe extern "system" fn ReleaseValueInfo(input: *mut OrtValueInfo) {}
|
||||
|
||||
#[cfg(feature = "api-22")]
|
||||
unsafe extern "system" fn ReleaseNode(input: *mut OrtNode) {}
|
||||
|
||||
#[cfg(feature = "api-22")]
|
||||
unsafe extern "system" fn ReleaseGraph(input: *mut OrtGraph) {}
|
||||
|
||||
#[cfg(feature = "api-22")]
|
||||
unsafe extern "system" fn ReleaseModel(input: *mut OrtModel) {}
|
||||
|
||||
#[cfg(feature = "api-22")]
|
||||
unsafe extern "system" fn GetValueInfoName(value_info: *const OrtValueInfo, name: *mut *const ::core::ffi::c_char) -> OrtStatusPtr {
|
||||
Error::new_sys(OrtErrorCode::ORT_NOT_IMPLEMENTED, "Unimplemented")
|
||||
}
|
||||
|
||||
#[cfg(feature = "api-22")]
|
||||
unsafe extern "system" fn GetValueInfoTypeInfo(value_info: *const OrtValueInfo, type_info: *mut *const OrtTypeInfo) -> OrtStatusPtr {
|
||||
Error::new_sys(OrtErrorCode::ORT_NOT_IMPLEMENTED, "Unimplemented")
|
||||
}
|
||||
|
||||
#[cfg(feature = "api-22")]
|
||||
unsafe extern "system" fn GetModelEditorApi() -> *const OrtModelEditorApi {
|
||||
ptr::null()
|
||||
}
|
||||
|
||||
#[cfg(feature = "api-22")]
|
||||
unsafe extern "system" fn CreateTensorWithDataAndDeleterAsOrtValue(
|
||||
deleter: *mut OrtAllocator,
|
||||
p_data: *mut ::core::ffi::c_void,
|
||||
@@ -1747,24 +1764,30 @@ unsafe extern "system" fn CreateTensorWithDataAndDeleterAsOrtValue(
|
||||
Error::new_sys(OrtErrorCode::ORT_NOT_IMPLEMENTED, "Unimplemented")
|
||||
}
|
||||
|
||||
#[cfg(feature = "api-22")]
|
||||
unsafe extern "system" fn SessionOptionsSetLoadCancellationFlag(options: *mut OrtSessionOptions, cancel: bool) -> OrtStatusPtr {
|
||||
Error::new_sys(OrtErrorCode::ORT_NOT_IMPLEMENTED, "Unimplemented")
|
||||
}
|
||||
|
||||
#[cfg(feature = "api-22")]
|
||||
unsafe extern "system" fn GetCompileApi() -> *const OrtCompileApi {
|
||||
ptr::null_mut()
|
||||
}
|
||||
|
||||
#[cfg(feature = "api-22")]
|
||||
unsafe extern "system" fn CreateKeyValuePairs(out: *mut *mut OrtKeyValuePairs) {
|
||||
unsafe { *out = ptr::null_mut() };
|
||||
}
|
||||
|
||||
#[cfg(feature = "api-22")]
|
||||
unsafe extern "system" fn AddKeyValuePair(kvps: *mut OrtKeyValuePairs, key: *const ::core::ffi::c_char, value: *const ::core::ffi::c_char) {}
|
||||
|
||||
#[cfg(feature = "api-22")]
|
||||
unsafe extern "system" fn GetKeyValue(kvps: *const OrtKeyValuePairs, key: *const ::core::ffi::c_char) -> *const ::core::ffi::c_char {
|
||||
ptr::null()
|
||||
}
|
||||
|
||||
#[cfg(feature = "api-22")]
|
||||
unsafe extern "system" fn GetKeyValuePairs(
|
||||
kvps: *const OrtKeyValuePairs,
|
||||
keys: *mut *const *const ::core::ffi::c_char,
|
||||
@@ -1773,10 +1796,13 @@ unsafe extern "system" fn GetKeyValuePairs(
|
||||
) {
|
||||
}
|
||||
|
||||
#[cfg(feature = "api-22")]
|
||||
unsafe extern "system" fn RemoveKeyValuePair(kvps: *mut OrtKeyValuePairs, key: *const ::core::ffi::c_char) {}
|
||||
|
||||
#[cfg(feature = "api-22")]
|
||||
unsafe extern "system" fn ReleaseKeyValuePairs(input: *mut OrtKeyValuePairs) {}
|
||||
|
||||
#[cfg(feature = "api-22")]
|
||||
unsafe extern "system" fn RegisterExecutionProviderLibrary(
|
||||
env: *mut OrtEnv,
|
||||
registration_name: *const ::core::ffi::c_char,
|
||||
@@ -1785,14 +1811,17 @@ unsafe extern "system" fn RegisterExecutionProviderLibrary(
|
||||
Error::new_sys(OrtErrorCode::ORT_NOT_IMPLEMENTED, "Unimplemented")
|
||||
}
|
||||
|
||||
#[cfg(feature = "api-22")]
|
||||
unsafe extern "system" fn UnregisterExecutionProviderLibrary(env: *mut OrtEnv, registration_name: *const ::core::ffi::c_char) -> OrtStatusPtr {
|
||||
Error::new_sys(OrtErrorCode::ORT_NOT_IMPLEMENTED, "Unimplemented")
|
||||
}
|
||||
|
||||
#[cfg(feature = "api-22")]
|
||||
unsafe extern "system" fn GetEpDevices(env: *const OrtEnv, ep_devices: *mut *const *const OrtEpDevice, num_ep_devices: *mut usize) -> OrtStatusPtr {
|
||||
Error::new_sys(OrtErrorCode::ORT_NOT_IMPLEMENTED, "Unimplemented")
|
||||
}
|
||||
|
||||
#[cfg(feature = "api-22")]
|
||||
unsafe extern "system" fn SessionOptionsAppendExecutionProvider_V2(
|
||||
session_options: *mut OrtSessionOptions,
|
||||
env: *mut OrtEnv,
|
||||
@@ -1805,6 +1834,7 @@ unsafe extern "system" fn SessionOptionsAppendExecutionProvider_V2(
|
||||
Error::new_sys(OrtErrorCode::ORT_NOT_IMPLEMENTED, "Unimplemented")
|
||||
}
|
||||
|
||||
#[cfg(feature = "api-22")]
|
||||
unsafe extern "system" fn SessionOptionsSetEpSelectionPolicy(
|
||||
session_options: *mut OrtSessionOptions,
|
||||
policy: OrtExecutionProviderDevicePolicy
|
||||
@@ -1812,6 +1842,7 @@ unsafe extern "system" fn SessionOptionsSetEpSelectionPolicy(
|
||||
Error::new_sys(OrtErrorCode::ORT_NOT_IMPLEMENTED, "Unimplemented")
|
||||
}
|
||||
|
||||
#[cfg(feature = "api-22")]
|
||||
unsafe extern "system" fn SessionOptionsSetEpSelectionPolicyDelegate(
|
||||
session_options: *mut OrtSessionOptions,
|
||||
delegate: EpSelectionDelegate,
|
||||
@@ -1820,46 +1851,57 @@ unsafe extern "system" fn SessionOptionsSetEpSelectionPolicyDelegate(
|
||||
Error::new_sys(OrtErrorCode::ORT_NOT_IMPLEMENTED, "Unimplemented")
|
||||
}
|
||||
|
||||
#[cfg(feature = "api-22")]
|
||||
unsafe extern "system" fn HardwareDevice_Type(device: *const OrtHardwareDevice) -> OrtHardwareDeviceType {
|
||||
OrtHardwareDeviceType::OrtHardwareDeviceType_CPU
|
||||
}
|
||||
|
||||
#[cfg(feature = "api-22")]
|
||||
unsafe extern "system" fn HardwareDevice_VendorId(device: *const OrtHardwareDevice) -> u32 {
|
||||
0
|
||||
}
|
||||
|
||||
#[cfg(feature = "api-22")]
|
||||
unsafe extern "system" fn HardwareDevice_Vendor(device: *const OrtHardwareDevice) -> *const ::core::ffi::c_char {
|
||||
ptr::null()
|
||||
}
|
||||
|
||||
#[cfg(feature = "api-22")]
|
||||
unsafe extern "system" fn HardwareDevice_DeviceId(device: *const OrtHardwareDevice) -> u32 {
|
||||
0
|
||||
}
|
||||
|
||||
#[cfg(feature = "api-22")]
|
||||
unsafe extern "system" fn HardwareDevice_Metadata(device: *const OrtHardwareDevice) -> *const OrtKeyValuePairs {
|
||||
ptr::null()
|
||||
}
|
||||
|
||||
#[cfg(feature = "api-22")]
|
||||
unsafe extern "system" fn EpDevice_EpName(ep_device: *const OrtEpDevice) -> *const ::core::ffi::c_char {
|
||||
ptr::null()
|
||||
}
|
||||
|
||||
#[cfg(feature = "api-22")]
|
||||
unsafe extern "system" fn EpDevice_EpVendor(ep_device: *const OrtEpDevice) -> *const ::core::ffi::c_char {
|
||||
ptr::null()
|
||||
}
|
||||
|
||||
#[cfg(feature = "api-22")]
|
||||
unsafe extern "system" fn EpDevice_EpMetadata(ep_device: *const OrtEpDevice) -> *const OrtKeyValuePairs {
|
||||
ptr::null()
|
||||
}
|
||||
|
||||
#[cfg(feature = "api-22")]
|
||||
unsafe extern "system" fn EpDevice_EpOptions(ep_device: *const OrtEpDevice) -> *const OrtKeyValuePairs {
|
||||
ptr::null()
|
||||
}
|
||||
|
||||
#[cfg(feature = "api-22")]
|
||||
unsafe extern "system" fn EpDevice_Device(ep_device: *const OrtEpDevice) -> *const OrtHardwareDevice {
|
||||
ptr::null()
|
||||
}
|
||||
|
||||
#[cfg(feature = "api-22")]
|
||||
unsafe extern "system" fn GetEpApi() -> *const OrtEpApi {
|
||||
ptr::null()
|
||||
}
|
||||
@@ -2142,47 +2184,89 @@ pub const fn api() -> OrtApi {
|
||||
SetDeterministicCompute,
|
||||
KernelContext_ParallelFor,
|
||||
SessionOptionsAppendExecutionProvider_OpenVINO_V2,
|
||||
#[cfg(feature = "api-18")]
|
||||
SessionOptionsAppendExecutionProvider_VitisAI,
|
||||
#[cfg(feature = "api-18")]
|
||||
KernelContext_GetScratchBuffer,
|
||||
#[cfg(feature = "api-18")]
|
||||
KernelInfoGetAllocator,
|
||||
#[cfg(feature = "api-18")]
|
||||
AddExternalInitializersFromMemory,
|
||||
#[cfg(feature = "api-20")]
|
||||
CreateLoraAdapter,
|
||||
#[cfg(feature = "api-20")]
|
||||
CreateLoraAdapterFromArray,
|
||||
#[cfg(feature = "api-20")]
|
||||
ReleaseLoraAdapter,
|
||||
#[cfg(feature = "api-20")]
|
||||
RunOptionsAddActiveLoraAdapter,
|
||||
#[cfg(feature = "api-20")]
|
||||
SetEpDynamicOptions,
|
||||
#[cfg(feature = "api-22")]
|
||||
ReleaseValueInfo,
|
||||
#[cfg(feature = "api-22")]
|
||||
ReleaseNode,
|
||||
#[cfg(feature = "api-22")]
|
||||
ReleaseGraph,
|
||||
#[cfg(feature = "api-22")]
|
||||
ReleaseModel,
|
||||
#[cfg(feature = "api-22")]
|
||||
GetValueInfoName,
|
||||
#[cfg(feature = "api-22")]
|
||||
GetValueInfoTypeInfo,
|
||||
#[cfg(feature = "api-22")]
|
||||
GetModelEditorApi,
|
||||
#[cfg(feature = "api-22")]
|
||||
CreateTensorWithDataAndDeleterAsOrtValue,
|
||||
#[cfg(feature = "api-22")]
|
||||
SessionOptionsSetLoadCancellationFlag,
|
||||
#[cfg(feature = "api-22")]
|
||||
GetCompileApi,
|
||||
#[cfg(feature = "api-22")]
|
||||
CreateKeyValuePairs,
|
||||
#[cfg(feature = "api-22")]
|
||||
AddKeyValuePair,
|
||||
#[cfg(feature = "api-22")]
|
||||
GetKeyValue,
|
||||
#[cfg(feature = "api-22")]
|
||||
GetKeyValuePairs,
|
||||
#[cfg(feature = "api-22")]
|
||||
RemoveKeyValuePair,
|
||||
#[cfg(feature = "api-22")]
|
||||
ReleaseKeyValuePairs,
|
||||
#[cfg(feature = "api-22")]
|
||||
RegisterExecutionProviderLibrary,
|
||||
#[cfg(feature = "api-22")]
|
||||
UnregisterExecutionProviderLibrary,
|
||||
#[cfg(feature = "api-22")]
|
||||
GetEpDevices,
|
||||
#[cfg(feature = "api-22")]
|
||||
SessionOptionsAppendExecutionProvider_V2,
|
||||
#[cfg(feature = "api-22")]
|
||||
SessionOptionsSetEpSelectionPolicy,
|
||||
#[cfg(feature = "api-22")]
|
||||
SessionOptionsSetEpSelectionPolicyDelegate,
|
||||
#[cfg(feature = "api-22")]
|
||||
HardwareDevice_Type,
|
||||
#[cfg(feature = "api-22")]
|
||||
HardwareDevice_VendorId,
|
||||
#[cfg(feature = "api-22")]
|
||||
HardwareDevice_Vendor,
|
||||
#[cfg(feature = "api-22")]
|
||||
HardwareDevice_DeviceId,
|
||||
#[cfg(feature = "api-22")]
|
||||
HardwareDevice_Metadata,
|
||||
#[cfg(feature = "api-22")]
|
||||
EpDevice_EpName,
|
||||
#[cfg(feature = "api-22")]
|
||||
EpDevice_EpVendor,
|
||||
#[cfg(feature = "api-22")]
|
||||
EpDevice_EpMetadata,
|
||||
#[cfg(feature = "api-22")]
|
||||
EpDevice_EpOptions,
|
||||
#[cfg(feature = "api-22")]
|
||||
EpDevice_Device,
|
||||
#[cfg(feature = "api-22")]
|
||||
GetEpApi
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +1,10 @@
|
||||
pub const ORT_API_VERSION: u32 = 23;
|
||||
const V18: u32 = cfg!(feature = "api-18") as u32;
|
||||
const V19: u32 = cfg!(feature = "api-19") as u32;
|
||||
const V20: u32 = cfg!(feature = "api-20") as u32;
|
||||
const V21: u32 = cfg!(feature = "api-21") as u32;
|
||||
const V22: u32 = cfg!(feature = "api-22") as u32;
|
||||
const V23: u32 = cfg!(feature = "api-23") as u32;
|
||||
|
||||
#[rustfmt::skip]
|
||||
pub const ORT_API_VERSION: u32 = 17 // minimum version
|
||||
+ V18 + V19 + V20 + V21 + V22 + V23; // We can do this because each API also enables the one before it.
|
||||
|
||||
@@ -25,7 +25,11 @@ pub mod __private {
|
||||
#[macro_use]
|
||||
pub(crate) mod private;
|
||||
|
||||
#[cfg(feature = "api-22")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "api-22")))]
|
||||
pub mod compiler;
|
||||
#[cfg(feature = "api-22")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "api-22")))]
|
||||
pub mod editor;
|
||||
pub mod environment;
|
||||
pub mod ep;
|
||||
@@ -41,9 +45,11 @@ pub mod util;
|
||||
pub mod value;
|
||||
#[doc(hidden)]
|
||||
pub mod api {
|
||||
pub use super::api as ort;
|
||||
#[cfg(feature = "training")]
|
||||
pub use super::training::training_api as training;
|
||||
pub use super::{api as ort, compiler::compile_api as compile, editor::editor_api as editor};
|
||||
#[cfg(feature = "api-22")]
|
||||
pub use super::{compiler::compile_api as compile, editor::editor_api as editor};
|
||||
}
|
||||
|
||||
#[deprecated = "import execution providers from `ort::ep` instead"]
|
||||
|
||||
@@ -104,6 +104,8 @@ impl KernelAttributes {
|
||||
Ok(CString::from_vec_with_nul(name)?.into_string()?)
|
||||
}
|
||||
|
||||
#[cfg(feature = "api-18")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
|
||||
pub fn allocator(&self, mem_type: MemoryType) -> Result<Allocator> {
|
||||
let mut ptr: *mut ort_sys::OrtAllocator = ptr::null_mut();
|
||||
ortsys![unsafe KernelInfoGetAllocator(self.ptr.as_ptr(), mem_type.into(), &mut ptr)?; nonNull(ptr)];
|
||||
|
||||
@@ -88,6 +88,7 @@ impl Drop for AdapterInner {
|
||||
/// session run.
|
||||
///
|
||||
/// [`RunOptions::add_adapter`]: crate::session::RunOptions::add_adapter
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Adapter {
|
||||
pub(crate) inner: Arc<AdapterInner>
|
||||
|
||||
@@ -15,7 +15,9 @@ use std::path::PathBuf;
|
||||
|
||||
use smallvec::SmallVec;
|
||||
|
||||
use super::{EditableSession, SessionBuilder};
|
||||
#[cfg(feature = "api-22")]
|
||||
use super::EditableSession;
|
||||
use super::SessionBuilder;
|
||||
#[cfg(any(target_arch = "wasm32", feature = "std"))]
|
||||
use crate::error::{Error, ErrorCode};
|
||||
#[cfg(all(feature = "std", not(target_arch = "wasm32")))]
|
||||
@@ -284,8 +286,8 @@ impl SessionBuilder {
|
||||
})
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
|
||||
#[cfg(all(feature = "std", feature = "api-22"))]
|
||||
#[cfg_attr(docsrs, doc(cfg(all(feature = "std", feature = "api-22"))))]
|
||||
pub fn edit_from_file<P>(self, model_filepath: P) -> Result<EditableSession>
|
||||
where
|
||||
P: AsRef<Path>
|
||||
@@ -306,6 +308,8 @@ impl SessionBuilder {
|
||||
EditableSession::new(session_ptr, self)
|
||||
}
|
||||
|
||||
#[cfg(feature = "api-22")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "api-22")))]
|
||||
pub fn edit_from_memory(self, model_bytes: &[u8]) -> Result<EditableSession> {
|
||||
let mut session_ptr: *mut ort_sys::OrtSession = ptr::null_mut();
|
||||
|
||||
|
||||
@@ -185,8 +185,8 @@ impl SessionBuilder {
|
||||
Ok(self)
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
|
||||
#[cfg(all(feature = "std", feature = "api-20"))]
|
||||
#[cfg_attr(docsrs, doc(cfg(all(feature = "std", feature = "api-20"))))]
|
||||
pub fn with_external_initializer_file_in_memory(mut self, file_name: impl AsRef<Path>, buffer: alloc::borrow::Cow<'static, [u8]>) -> Result<Self> {
|
||||
let file_name = path_to_os_char(file_name);
|
||||
let sizes = [buffer.len()];
|
||||
|
||||
@@ -18,15 +18,17 @@ use crate::{
|
||||
value::DynValue
|
||||
};
|
||||
|
||||
#[cfg(feature = "api-22")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "api-22")))]
|
||||
mod editable;
|
||||
mod impl_commit;
|
||||
mod impl_config_keys;
|
||||
mod impl_options;
|
||||
|
||||
pub use self::{
|
||||
editable::EditableSession,
|
||||
impl_options::{GraphOptimizationLevel, PrepackedWeights}
|
||||
};
|
||||
#[cfg(feature = "api-22")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "api-22")))]
|
||||
pub use self::editable::EditableSession;
|
||||
pub use self::impl_options::{GraphOptimizationLevel, PrepackedWeights};
|
||||
|
||||
/// Creates a session using the builder pattern.
|
||||
///
|
||||
|
||||
@@ -41,6 +41,7 @@ use crate::{
|
||||
value::{DynValue, Outlet, Value, ValueType}
|
||||
};
|
||||
|
||||
#[cfg(feature = "api-20")]
|
||||
mod adapter;
|
||||
#[cfg(all(feature = "std", not(target_arch = "wasm32")))]
|
||||
mod r#async;
|
||||
@@ -50,19 +51,21 @@ mod io_binding;
|
||||
mod metadata;
|
||||
mod output;
|
||||
mod run_options;
|
||||
#[cfg(feature = "api-20")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
|
||||
pub use self::adapter::Adapter;
|
||||
#[cfg(all(feature = "std", not(target_arch = "wasm32")))]
|
||||
pub use self::r#async::InferenceFut;
|
||||
#[cfg(all(feature = "std", not(target_arch = "wasm32")))]
|
||||
use self::r#async::{AsyncInferenceContext, InferenceFutInner};
|
||||
use self::{builder::SessionBuilder, run_options::UntypedRunOptions};
|
||||
pub use self::{
|
||||
adapter::Adapter,
|
||||
input::{SessionInputValue, SessionInputs},
|
||||
io_binding::IoBinding,
|
||||
metadata::ModelMetadata,
|
||||
output::SessionOutputs,
|
||||
run_options::{HasSelectedOutputs, NoSelectedOutputs, OutputSelector, RunOptions, SelectedOutputMarker}
|
||||
};
|
||||
use self::{builder::SessionBuilder, run_options::UntypedRunOptions};
|
||||
|
||||
/// Holds onto an [`ort_sys::OrtSession`] pointer and its associated allocator.
|
||||
///
|
||||
@@ -628,6 +631,8 @@ impl Session {
|
||||
/// # Ok(())
|
||||
/// # }
|
||||
/// ```
|
||||
#[cfg(feature = "api-20")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
|
||||
pub fn set_workload_type(&mut self, workload_type: WorkloadType) -> Result<()> {
|
||||
static KEY: &[u8] = b"ep.dynamic.workload_type\0";
|
||||
match workload_type {
|
||||
@@ -636,11 +641,14 @@ impl Session {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "api-20")]
|
||||
pub(crate) fn set_dynamic_option(&mut self, key: *const c_char, value: *const c_char) -> Result<()> {
|
||||
ortsys![unsafe SetEpDynamicOptions(self.inner.session_ptr.as_ptr(), &key, &value, 1)?];
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(feature = "api-22")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "api-22")))]
|
||||
pub fn opset_for_domain(&self, domain: impl AsRef<str>) -> Result<u32> {
|
||||
with_cstr(domain.as_ref().as_bytes(), &|domain| {
|
||||
let mut opset = 0;
|
||||
|
||||
@@ -8,15 +8,14 @@ use core::{
|
||||
|
||||
use smallvec::SmallVec;
|
||||
|
||||
#[cfg(feature = "api-20")]
|
||||
use crate::session::adapter::{Adapter, AdapterInner};
|
||||
use crate::{
|
||||
AsPointer,
|
||||
error::Result,
|
||||
logging::LogLevel,
|
||||
ortsys,
|
||||
session::{
|
||||
Outlet,
|
||||
adapter::{Adapter, AdapterInner}
|
||||
},
|
||||
session::Outlet,
|
||||
util::{MiniMap, STACK_SESSION_OUTPUTS, with_cstr},
|
||||
value::{DynValue, Value, ValueTypeMarker}
|
||||
};
|
||||
@@ -150,6 +149,7 @@ impl SelectedOutputMarker for HasSelectedOutputs {}
|
||||
pub(crate) struct UntypedRunOptions {
|
||||
pub(crate) ptr: NonNull<ort_sys::OrtRunOptions>,
|
||||
pub(crate) outputs: OutputSelector,
|
||||
#[cfg(feature = "api-20")]
|
||||
adapters: Vec<Arc<AdapterInner>>
|
||||
}
|
||||
|
||||
@@ -215,6 +215,7 @@ impl RunOptions {
|
||||
inner: Arc::new(UntypedRunOptions {
|
||||
ptr,
|
||||
outputs: OutputSelector::default(),
|
||||
#[cfg(feature = "api-20")]
|
||||
adapters: Vec::new()
|
||||
}),
|
||||
_marker: PhantomData
|
||||
@@ -357,6 +358,8 @@ impl<O: SelectedOutputMarker> RunOptions<O> {
|
||||
})
|
||||
}
|
||||
|
||||
#[cfg(feature = "api-20")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
|
||||
pub fn add_adapter(&mut self, adapter: &Adapter) -> Result<()> {
|
||||
let Some(inner) = Arc::get_mut(&mut self.inner) else {
|
||||
panic!("Expected RunOptions to have exclusive access");
|
||||
|
||||
@@ -173,6 +173,7 @@ impl ValueType {
|
||||
|
||||
/// Converts this type to an [`ort_sys::OrtTypeInfo`] using the Model Editor API, so it shouldn't be used outside of
|
||||
/// `crate::editor`
|
||||
#[cfg(feature = "api-22")]
|
||||
pub(crate) fn to_type_info(&self) -> Result<*mut ort_sys::OrtTypeInfo> {
|
||||
let mut info_ptr: *mut ort_sys::OrtTypeInfo = ptr::null_mut();
|
||||
match self {
|
||||
@@ -311,6 +312,7 @@ impl Outlet {
|
||||
&self.dtype
|
||||
}
|
||||
|
||||
#[cfg(feature = "api-22")]
|
||||
pub(crate) fn into_editor_value_info(self) -> Result<NonNull<ort_sys::OrtValueInfo>> {
|
||||
let type_info = self.dtype.to_type_info()?;
|
||||
let _guard = run_on_drop(|| ortsys![unsafe ReleaseTypeInfo(type_info)]);
|
||||
|
||||
Reference in New Issue
Block a user