pub struct CpuBuffer<T> { /* private fields */ }Expand description
CPU buffer implementation using Vec
Implementations§
Trait Implementations§
Source§impl<T: Clone + Send + Sync + 'static> TensorBuffer for CpuBuffer<T>
impl<T: Clone + Send + Sync + 'static> TensorBuffer for CpuBuffer<T>
type Elem = T
Source§fn size_bytes(&self) -> usize
fn size_bytes(&self) -> usize
Get the size in bytes
Source§fn clone_buffer(&self) -> Result<Box<dyn TensorBuffer<Elem = Self::Elem>>>
fn clone_buffer(&self) -> Result<Box<dyn TensorBuffer<Elem = Self::Elem>>>
Clone the buffer (may involve device memory copy)
Source§fn view(
&self,
offset: usize,
len: usize,
) -> Result<Box<dyn TensorBuffer<Elem = Self::Elem>>>
fn view( &self, offset: usize, len: usize, ) -> Result<Box<dyn TensorBuffer<Elem = Self::Elem>>>
Create a view into this buffer (zero-copy when possible)
Source§unsafe fn as_ptr(&self) -> *const Self::Elem
unsafe fn as_ptr(&self) -> *const Self::Elem
Get raw pointer (unsafe - for FFI and low-level ops) Read more
Auto Trait Implementations§
impl<T> Freeze for CpuBuffer<T>
impl<T> RefUnwindSafe for CpuBuffer<T>where
Vec<T>: RefUnwindSafe,
impl<T> Send for CpuBuffer<T>
impl<T> Sync for CpuBuffer<T>
impl<T> Unpin for CpuBuffer<T>
impl<T> UnsafeUnpin for CpuBuffer<T>where
Vec<T>: UnsafeUnpin,
impl<T> UnwindSafe for CpuBuffer<T>where
Vec<T>: UnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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