pub struct Storage<T: Scalar> { /* private fields */ }Expand description
Raw memory storage for tensor data.
Storage is the fundamental building block for tensors. It manages a contiguous block of memory on a specific device and is reference-counted to allow efficient sharing between tensor views.
Implementations§
Source§impl<T: Scalar> Storage<T>
impl<T: Scalar> Storage<T>
Sourcepub fn from_slice(data: &[T], device: Device) -> Self
pub fn from_slice(data: &[T], device: Device) -> Self
Sourcepub fn size_bytes(&self) -> usize
pub fn size_bytes(&self) -> usize
Returns the size in bytes of this storage.
Sourcepub fn as_slice(&self) -> StorageReadGuard<'_, T>
pub fn as_slice(&self) -> StorageReadGuard<'_, T>
Sourcepub fn as_slice_mut(&self) -> StorageWriteGuard<'_, T>
pub fn as_slice_mut(&self) -> StorageWriteGuard<'_, T>
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Storage<T>
impl<T> !RefUnwindSafe for Storage<T>
impl<T> Send for Storage<T>
impl<T> Sync for Storage<T>
impl<T> Unpin for Storage<T>
impl<T> !UnwindSafe for Storage<T>
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