pub struct MemoryPool<T> { /* private fields */ }
Expand description
Memory pool for efficient tensor allocation and reuse
Implementations§
Source§impl<T> MemoryPool<T>
impl<T> MemoryPool<T>
Sourcepub fn get_tensor(&mut self, shape: &[usize]) -> ArrayD<T>
pub fn get_tensor(&mut self, shape: &[usize]) -> ArrayD<T>
Get a tensor from the pool or create a new one
Sourcepub fn return_tensor(&mut self, tensor: ArrayD<T>)
pub fn return_tensor(&mut self, tensor: ArrayD<T>)
Return a tensor to the pool
Sourcepub fn get_stats(&self) -> MemoryPoolStats
pub fn get_stats(&self) -> MemoryPoolStats
Get pool statistics
Auto Trait Implementations§
impl<T> Freeze for MemoryPool<T>
impl<T> RefUnwindSafe for MemoryPool<T>where
T: RefUnwindSafe,
impl<T> Send for MemoryPool<T>where
T: Send,
impl<T> Sync for MemoryPool<T>where
T: Sync,
impl<T> Unpin for MemoryPool<T>
impl<T> UnwindSafe for MemoryPool<T>where
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
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