pub struct GContext { /* private fields */ }
Implementations§
Source§impl GContext
impl GContext
pub fn estimate_tensor_size<const DIMS: usize>( &self, typ: GType, shape: [usize; DIMS], ) -> Result<GMemoryRequest>
Sourcepub fn tensor<const DIMS: usize>(
&self,
typ: GType,
shape: [usize; DIMS],
) -> Result<GTensor<DIMS>>
pub fn tensor<const DIMS: usize>( &self, typ: GType, shape: [usize; DIMS], ) -> Result<GTensor<DIMS>>
Create a new tensor with the specified type and shape.
This uses const generics to determine the new tensor’s dimensions. The tensor dimensions
will be equal to the number of items in the shape
array.
Sourcepub fn register_scratch_buffer(&mut self, buf: ScratchBuffer) -> Result<usize>
pub fn register_scratch_buffer(&mut self, buf: ScratchBuffer) -> Result<usize>
Register a scratch buffer. The return value is the scratch buffer id which can be used with Self::set_scratch_buffer.
Sourcepub fn set_scratch_buffer(&self, maybebufid: Option<usize>) -> Result<()>
pub fn set_scratch_buffer(&self, maybebufid: Option<usize>) -> Result<()>
Set or clear the current scratch buffer. A valid id as returned by Self::register_scratch_buffer must be supplied.
Note: Scratch buffers cannot be removed directly and are only freed when the GContext structure is dropped.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GContext
impl RefUnwindSafe for GContext
impl Send for GContext
impl Sync for GContext
impl Unpin for GContext
impl UnwindSafe for GContext
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