pub struct TensorView<'a> { /* private fields */ }Expand description
Lifetime-bound, zero-copy view of host-accessible tensor storage.
Implementations§
Source§impl<'a> TensorView<'a>
impl<'a> TensorView<'a>
Sourcepub fn try_new(
bytes: &'a [u8],
descriptor: TensorDescriptor,
) -> Result<Self, TensorError>
pub fn try_new( bytes: &'a [u8], descriptor: TensorDescriptor, ) -> Result<Self, TensorError>
Validates and borrows a host allocation without copying it.
Sourcepub const fn allocation_bytes(&self) -> &'a [u8] ⓘ
pub const fn allocation_bytes(&self) -> &'a [u8] ⓘ
Returns the complete borrowed allocation slice.
Sourcepub const fn descriptor(&self) -> &TensorDescriptor
pub const fn descriptor(&self) -> &TensorDescriptor
Returns tensor metadata.
Sourcepub fn to_owned_copy(&self) -> TensorBuffer
pub fn to_owned_copy(&self) -> TensorBuffer
Performs an explicit host-to-host copy retaining the same layout.
Trait Implementations§
Source§impl<'a> Clone for TensorView<'a>
impl<'a> Clone for TensorView<'a>
Source§fn clone(&self) -> TensorView<'a>
fn clone(&self) -> TensorView<'a>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<'a> Freeze for TensorView<'a>
impl<'a> RefUnwindSafe for TensorView<'a>
impl<'a> Send for TensorView<'a>
impl<'a> Sync for TensorView<'a>
impl<'a> Unpin for TensorView<'a>
impl<'a> UnsafeUnpin for TensorView<'a>
impl<'a> UnwindSafe for TensorView<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more