pub struct TensorStorage<T, A: TensorAllocator> { /* private fields */ }Expand description
Definition of the buffer for a tensor.
Implementations§
Source§impl<T, A: TensorAllocator> TensorStorage<T, A>
impl<T, A: TensorAllocator> TensorStorage<T, A>
Sourcepub fn as_mut_ptr(&mut self) -> *mut T
pub fn as_mut_ptr(&mut self) -> *mut T
Returns the pointer to the tensor memory.
Sourcepub fn as_mut_slice(&mut self) -> &mut [T]
pub fn as_mut_slice(&mut self) -> &mut [T]
Returns the data pointer as a mutable slice.
Sourcepub unsafe fn from_raw_parts(data: *const T, len: usize, alloc: A) -> Self
pub unsafe fn from_raw_parts(data: *const T, len: usize, alloc: A) -> Self
Creates a new tensor buffer from a raw pointer.
§Safety
The pointer must be non-null and the length must be valid.
Trait Implementations§
Source§impl<T, A> Clone for TensorStorage<T, A>where
T: Clone,
A: TensorAllocator,
A new TensorStorage instance with cloned data if successful, otherwise an error.
impl<T, A> Clone for TensorStorage<T, A>where
T: Clone,
A: TensorAllocator,
A new TensorStorage instance with cloned data if successful, otherwise an error.
Source§impl<T, A: TensorAllocator> Drop for TensorStorage<T, A>
impl<T, A: TensorAllocator> Drop for TensorStorage<T, A>
impl<T, A: TensorAllocator> Send for TensorStorage<T, A>
impl<T, A: TensorAllocator> Sync for TensorStorage<T, A>
Auto Trait Implementations§
impl<T, A> Freeze for TensorStorage<T, A>where
A: Freeze,
impl<T, A> RefUnwindSafe for TensorStorage<T, A>where
A: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, A> Unpin for TensorStorage<T, A>where
A: Unpin,
impl<T, A> UnwindSafe for TensorStorage<T, A>where
A: UnwindSafe,
T: RefUnwindSafe,
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