Trait NDAllocator

Source
pub unsafe trait NDAllocator: 'static {
    const MIN_ALIGN: usize;

    // Required methods
    unsafe fn alloc_data(&mut self, prototype: &DLTensor) -> *mut c_void;
    unsafe fn free_data(&mut self, tensor: &DLTensor);
}
Expand description

Trait for n-dimensional array allocators

Required Associated Constants§

Source

const MIN_ALIGN: usize

The minimum alignment of the data allocated by the allocator

Required Methods§

Source

unsafe fn alloc_data(&mut self, prototype: &DLTensor) -> *mut c_void

Allocate data for the given DLTensor

§Arguments
  • tensor - The DLTensor to allocate data for

This method should fill in the data pointer of the DLTensor.

Source

unsafe fn free_data(&mut self, tensor: &DLTensor)

Free data for the given DLTensor

§Arguments
  • tensor - The DLTensor to free data for

This method should free the data pointer of the DLTensor.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§