pub struct Storage { /* private fields */ }Expand description
Raw storage for tensor data Separate from Tensor to enable zero-copy views
Implementations§
Source§impl Storage
impl Storage
Sourcepub fn from_slice<T: TensorElement>(data: &[T]) -> Self
pub fn from_slice<T: TensorElement>(data: &[T]) -> Self
Create storage from typed data
Sourcepub fn size_bytes(&self) -> usize
pub fn size_bytes(&self) -> usize
Size in bytes
Sourcepub fn as_slice<T: TensorElement>(&self) -> StorageReadGuard<'_, T>
pub fn as_slice<T: TensorElement>(&self) -> StorageReadGuard<'_, T>
Get read access to data as typed slice
Sourcepub fn as_slice_mut<T: TensorElement>(&self) -> StorageWriteGuard<'_, T>
pub fn as_slice_mut<T: TensorElement>(&self) -> StorageWriteGuard<'_, T>
Get write access to data as typed slice
Sourcepub fn deep_clone(&self) -> Self
pub fn deep_clone(&self) -> Self
Clone the storage (deep copy)
Check if this storage is shared (has multiple references)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Storage
impl !RefUnwindSafe for Storage
impl Send for Storage
impl Sync for Storage
impl Unpin for Storage
impl !UnwindSafe for Storage
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more