pub struct HptAllocator<B: BackendTy> { /* private fields */ }Expand description
Built-in allocator for Hpt
Trait Implementations§
Source§impl Allocator for HptAllocator<Cpu>
impl Allocator for HptAllocator<Cpu>
Source§type CpuAllocator = HptAllocator<Cpu>
type CpuAllocator = HptAllocator<Cpu>
cpu type of the allocator
Source§fn allocate(
&mut self,
layout: Layout,
device_id: usize,
) -> Result<Self::Output, TensorError>
fn allocate( &mut self, layout: Layout, device_id: usize, ) -> Result<Self::Output, TensorError>
allocate memory by using lru cache strategy Read more
Source§fn allocate_zeroed(
&mut self,
layout: Layout,
device_id: usize,
) -> Result<Self::Output, TensorError>
fn allocate_zeroed( &mut self, layout: Layout, device_id: usize, ) -> Result<Self::Output, TensorError>
similar to
allocate, but the memory is zeroedSource§fn deallocate(
&mut self,
ptr: *mut u8,
layout: &Layout,
should_drop: bool,
device_id: usize,
)
fn deallocate( &mut self, ptr: *mut u8, layout: &Layout, should_drop: bool, device_id: usize, )
deallocate memory by using lru cache strategy Read more
Source§impl<B: BackendTy> Clone for HptAllocator<B>
impl<B: BackendTy> Clone for HptAllocator<B>
impl<B: BackendTy> Send for HptAllocator<B>
impl<B: BackendTy> Sync for HptAllocator<B>
Auto Trait Implementations§
impl<B> Freeze for HptAllocator<B>
impl<B> RefUnwindSafe for HptAllocator<B>where
B: RefUnwindSafe,
impl<B> Unpin for HptAllocator<B>where
B: Unpin,
impl<B> UnwindSafe for HptAllocator<B>where
B: 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