From 26f656b9a5156fbe0ebd9d580172a66f2666c98a Mon Sep 17 00:00:00 2001 From: "Carson M." Date: Wed, 11 Mar 2026 13:46:21 -0500 Subject: [PATCH] feat: relax bounds for copy functions Allows `DynTensor` to be copied/cloned --- src/value/impl_tensor/copy.rs | 7 +++---- src/value/impl_tensor/mod.rs | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/value/impl_tensor/copy.rs b/src/value/impl_tensor/copy.rs index 5922548..f9c66b5 100644 --- a/src/value/impl_tensor/copy.rs +++ b/src/value/impl_tensor/copy.rs @@ -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 Value { +impl Value { /// Copies the contents of this tensor to another device, returning the newly created tensor value. /// /// ``` @@ -235,7 +234,7 @@ impl Value { } #[cfg_attr(docsrs, doc(cfg(not(target_arch = "wasm32"))))] -impl Clone for Value { +impl Clone for Value { /// Creates a copy of this tensor and its data on the same device it resides on. /// /// ``` diff --git a/src/value/impl_tensor/mod.rs b/src/value/impl_tensor/mod.rs index d45d921..fe72188 100644 --- a/src/value/impl_tensor/mod.rs +++ b/src/value/impl_tensor/mod.rs @@ -152,7 +152,7 @@ impl DynTensor { } } -impl Value { +impl Value { /// 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