pub struct Allocator { /* private fields */ }
Expand description
An ONNX Runtime allocator, used to manage the allocation of crate::Value
s.
Implementations§
source§impl Allocator
impl Allocator
sourcepub fn new(session: &Session, memory_info: MemoryInfo) -> Result<Self>
pub fn new(session: &Session, memory_info: MemoryInfo) -> Result<Self>
Creates a new Allocator
for the given session, to allocate memory on the device described in the
MemoryInfo
.
For example, to create an allocator to allocate pinned memory for CUDA:
let allocator = Allocator::new(
&session,
MemoryInfo::new(AllocationDevice::CUDAPinned, 0, AllocatorType::Device, MemoryType::CPUInput)?
)?;
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Allocator
impl RefUnwindSafe for Allocator
impl !Send for Allocator
impl !Sync for Allocator
impl Unpin for Allocator
impl UnwindSafe for Allocator
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