chore: fix unused warnings with --no-default-features

This commit is contained in:
Carson M.
2025-03-20 00:51:28 -05:00
parent 072e162ce0
commit 4e9813dacc
5 changed files with 15 additions and 35 deletions

View File

@@ -274,7 +274,7 @@ macro_rules! get_ep_register {
pub(crate) use get_ep_register;
pub(crate) fn apply_execution_providers(session_builder: &mut SessionBuilder, eps: &[ExecutionProviderDispatch], source: &'static str) -> Result<()> {
fn register_inner(session_builder: &mut SessionBuilder, ep: &ExecutionProviderDispatch, source: &'static str) -> Result<bool> {
fn register_inner(session_builder: &mut SessionBuilder, ep: &ExecutionProviderDispatch, #[allow(unused)] source: &'static str) -> Result<bool> {
if let Err(e) = ep.inner.register(session_builder) {
if ep.error_on_failure {
return Err(e);

View File

@@ -1,11 +1,7 @@
use alloc::{borrow::Cow, rc::Rc, sync::Arc};
use core::{
any::Any,
ffi::{c_char, c_void},
ptr
};
use alloc::{rc::Rc, sync::Arc};
use core::{any::Any, ffi::c_void, ptr};
#[cfg(feature = "std")]
use std::path::Path;
use std::{borrow::Cow, path::Path};
use super::SessionBuilder;
#[cfg(feature = "std")]
@@ -175,7 +171,7 @@ impl SessionBuilder {
pub fn with_external_initializer_file_in_memory(mut self, file_name: impl AsRef<Path>, buffer: Cow<'static, [u8]>) -> Result<Self> {
let file_name = path_to_os_char(file_name);
let sizes = [buffer.len()];
ortsys![unsafe AddExternalInitializersFromMemory(self.ptr_mut(), &file_name.as_ptr(), &buffer.as_ptr().cast::<c_char>().cast_mut(), sizes.as_ptr(), 1)?];
ortsys![unsafe AddExternalInitializersFromMemory(self.ptr_mut(), &file_name.as_ptr(), &buffer.as_ptr().cast::<core::ffi::c_char>().cast_mut(), sizes.as_ptr(), 1)?];
self.external_initializer_buffers.push(buffer);
Ok(self)
}

View File

@@ -1,7 +1,7 @@
use alloc::{borrow::Cow, sync::Arc, vec::Vec};
use alloc::{borrow::Cow, vec::Vec};
use core::ops::Deref;
use crate::value::{DynValueTypeMarker, Value, ValueInner, ValueRef, ValueRefMut, ValueTypeMarker};
use crate::value::{DynValueTypeMarker, Value, ValueRef, ValueRefMut, ValueTypeMarker};
pub enum SessionInputValue<'v> {
ViewMut(ValueRefMut<'v, DynValueTypeMarker>),
@@ -9,16 +9,6 @@ pub enum SessionInputValue<'v> {
Owned(Value<DynValueTypeMarker>)
}
impl SessionInputValue<'_> {
pub(crate) fn inner(&self) -> &Arc<ValueInner> {
match self {
Self::ViewMut(v) => v.inner(),
Self::View(v) => v.inner(),
Self::Owned(v) => v.inner()
}
}
}
impl Deref for SessionInputValue<'_> {
type Target = Value;

View File

@@ -10,7 +10,7 @@
//! # }
//! ```
use alloc::{boxed::Box, ffi::CString, format, string::String, sync::Arc, vec::Vec};
use alloc::{boxed::Box, format, string::String, sync::Arc, vec::Vec};
use core::{
any::Any,
ffi::{CStr, c_char},
@@ -20,6 +20,8 @@ use core::{
ptr::{self, NonNull},
slice
};
#[cfg(feature = "std")]
use std::ffi::CString;
use smallvec::SmallVec;
@@ -434,7 +436,11 @@ impl Session {
let mut input_ort_values = SmallVec::with_capacity(input_values.len());
for input in input_values {
input_ort_values.push(input.ptr());
input_inner_holders.push(Arc::clone(input.inner()));
input_inner_holders.push(Arc::clone(match input {
SessionInputValue::ViewMut(v) => &(**v).inner,
SessionInputValue::View(v) => &(**v).inner,
SessionInputValue::Owned(v) => &v.inner
}));
}
let (output_names, mut output_tensors) = run_options.outputs.resolve_outputs(&self.outputs);

View File

@@ -96,10 +96,6 @@ impl<'v, Type: ValueTypeMarker + ?Sized> ValueRef<'v, Type> {
}
}
pub(crate) fn inner(&self) -> &Arc<ValueInner> {
&self.inner.inner
}
/// Attempts to downcast a temporary dynamic value (like [`DynValue`] or [`DynTensor`]) to a more strongly typed
/// variant, like [`TensorRef<T>`].
#[inline]
@@ -153,10 +149,6 @@ impl<'v, Type: ValueTypeMarker + ?Sized> ValueRefMut<'v, Type> {
}
}
pub(crate) fn inner(&self) -> &Arc<ValueInner> {
&self.inner.inner
}
/// Attempts to downcast a temporary mutable dynamic value (like [`DynValue`] or [`DynTensor`]) to a more
/// strongly typed variant, like [`TensorRefMut<T>`].
#[inline]
@@ -312,10 +304,6 @@ unsafe impl<Type: ValueTypeMarker + ?Sized> Send for Value<Type> {}
unsafe impl<Type: ValueTypeMarker + ?Sized> Sync for Value<Type> {}
impl<Type: ValueTypeMarker + ?Sized> Value<Type> {
pub(crate) fn inner(&self) -> &Arc<ValueInner> {
&self.inner
}
/// Returns the data type of this [`Value`].
pub fn dtype(&self) -> &ValueType {
&self.inner.dtype