pub struct DefaultAllocator;Expand description
Default allocator.
Will allocate exact byte_size bytes of datatype data_type of requested_memory_type for each output.
Trait Implementations§
Source§impl Allocator for DefaultAllocator
impl Allocator for DefaultAllocator
Source§fn allocate<'life0, 'async_trait>(
&'life0 mut self,
_tensor_name: String,
requested_mem_type: MemoryType,
byte_size: usize,
data_type: DataType,
) -> Pin<Box<dyn Future<Output = Result<Buffer, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn allocate<'life0, 'async_trait>(
&'life0 mut self,
_tensor_name: String,
requested_mem_type: MemoryType,
byte_size: usize,
data_type: DataType,
) -> Pin<Box<dyn Future<Output = Result<Buffer, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Allocate output buffer for output with name
tensor_name. Read moreSource§fn enable_queries(&self) -> bool
fn enable_queries(&self) -> bool
Unable or not a pre allocation queriing. For more info about queriing see Allocator::pre_allocation_query.
Default is false.
Default is false.
Source§fn pre_allocation_query<'life0, 'async_trait>(
&'life0 mut self,
tensor_name: Option<String>,
byte_size: Option<usize>,
requested_memory_type: MemoryType,
) -> Pin<Box<dyn Future<Output = MemoryType> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn pre_allocation_query<'life0, 'async_trait>(
&'life0 mut self,
tensor_name: Option<String>,
byte_size: Option<usize>,
requested_memory_type: MemoryType,
) -> Pin<Box<dyn Future<Output = MemoryType> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
If self.enable_queries() is true,
this function will be called to query the allocator’s preferred memory type.
As much as possible, the allocator should attempt to return the same memory_type values that will be returned by the subsequent call to Allocator::allocate. But the allocator is not required to do so. Read more
As much as possible, the allocator should attempt to return the same memory_type values that will be returned by the subsequent call to Allocator::allocate. But the allocator is not required to do so. Read more
Source§impl Clone for DefaultAllocator
impl Clone for DefaultAllocator
Source§fn clone(&self) -> DefaultAllocator
fn clone(&self) -> DefaultAllocator
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DefaultAllocator
impl Debug for DefaultAllocator
Source§impl Default for DefaultAllocator
impl Default for DefaultAllocator
Source§fn default() -> DefaultAllocator
fn default() -> DefaultAllocator
Returns the “default value” for a type. Read more
impl Copy for DefaultAllocator
Auto Trait Implementations§
impl Freeze for DefaultAllocator
impl RefUnwindSafe for DefaultAllocator
impl Send for DefaultAllocator
impl Sync for DefaultAllocator
impl Unpin for DefaultAllocator
impl UnwindSafe for DefaultAllocator
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