feat: relax bounds for copy functions

Allows `DynTensor` to be copied/cloned
This commit is contained in:
Carson M.
2026-03-11 13:46:21 -05:00
parent d5eb59f2ff
commit 26f656b9a5
2 changed files with 4 additions and 5 deletions

View File

@@ -4,13 +4,12 @@
use alloc::{format, string::ToString};
use core::ops::{Deref, DerefMut};
use super::DefiniteTensorValueTypeMarker;
use crate::{
Error, OnceLock, Result, ep,
memory::{AllocationDevice, AllocatorType, MemoryInfo, MemoryType},
session::{IoBinding, NoSelectedOutputs, RunOptions, Session, builder::GraphOptimizationLevel},
util::{MiniMap, Mutex, MutexGuard},
value::Value
value::{TensorValueTypeMarker, Value}
};
#[derive(Debug, Clone, PartialEq, Eq)]
@@ -66,7 +65,7 @@ fn ep_for_device(device: AllocationDevice, device_id: i32) -> Result<ep::Executi
})
}
impl<Type: DefiniteTensorValueTypeMarker + ?Sized> Value<Type> {
impl<Type: TensorValueTypeMarker + ?Sized> Value<Type> {
/// Copies the contents of this tensor to another device, returning the newly created tensor value.
///
/// ```
@@ -235,7 +234,7 @@ impl<Type: DefiniteTensorValueTypeMarker + ?Sized> Value<Type> {
}
#[cfg_attr(docsrs, doc(cfg(not(target_arch = "wasm32"))))]
impl<Type: DefiniteTensorValueTypeMarker + ?Sized> Clone for Value<Type> {
impl<Type: TensorValueTypeMarker + ?Sized> Clone for Value<Type> {
/// Creates a copy of this tensor and its data on the same device it resides on.
///
/// ```

View File

@@ -152,7 +152,7 @@ impl DynTensor {
}
}
impl<Type: DefiniteTensorValueTypeMarker + ?Sized> Value<Type> {
impl<Type: TensorValueTypeMarker + ?Sized> Value<Type> {
/// Returns a mutable pointer to the tensor's data. The pointer may be null in the case of zero-sized tensors.
///
/// It's important to note that the resulting pointer may not point to CPU-accessible memory. In the case of a