Struct mnn::interpreter::Interpreter
source · pub struct Interpreter { /* private fields */ }
Implementations§
source§impl Interpreter
impl Interpreter
pub fn from_file(path: impl AsRef<Path>) -> Result<Self>
pub fn from_bytes(bytes: impl AsRef<[u8]>) -> Result<Self>
pub fn set_session_mode(&mut self, mode: SessionMode)
pub fn resize_session(&self, session: &mut Session)
pub fn resize_session_reallocate(&self, session: &mut Session)
pub fn resize_tensor<T: TensorType>( &self, tensor: &mut Tensor<T>, dims: impl AsTensorShape, )
pub fn resize_tensor_by_nchw<T: TensorType>( &self, tensor: &mut Tensor<T>, batch: i32, channel: i32, height: i32, width: i32, )
pub fn create_session(&mut self, schedule: ScheduleConfig) -> Result<Session>
pub fn create_multipath_session( &mut self, schedule: impl IntoIterator<Item = ScheduleConfig>, ) -> Result<Session>
pub fn model_print_io(path: impl AsRef<Path>) -> Result<()>
pub fn inputs(&self, session: &Session) -> TensorList<'_>
pub fn input<'s, H: HalideType>( &self, session: &'s Session, name: impl AsRef<str>, ) -> Result<Tensor<RefMut<'s, Device<H>>>>
pub fn raw_input<'s>( &self, session: &'s Session, name: impl AsRef<str>, ) -> Result<RawTensor<'s>>
sourcepub unsafe fn input_unresized<'s, H: HalideType>(
&self,
session: &'s Session,
name: impl AsRef<str>,
) -> Result<Tensor<RefMut<'s, Device<H>>>>
pub unsafe fn input_unresized<'s, H: HalideType>( &self, session: &'s Session, name: impl AsRef<str>, ) -> Result<Tensor<RefMut<'s, Device<H>>>>
§Safety
We Still don’t know the safety guarantees of this function so it’s marked unsafe
sourcepub unsafe fn input_unchecked<'s, H: HalideType>(
&self,
session: &'s Session,
name: impl AsRef<str>,
) -> Tensor<RefMut<'s, Device<H>>>
pub unsafe fn input_unchecked<'s, H: HalideType>( &self, session: &'s Session, name: impl AsRef<str>, ) -> Tensor<RefMut<'s, Device<H>>>
§Safety
Very unsafe since it doesn’t check the type of the tensor as well as the shape of the tensor
sourcepub fn output<'s, H: HalideType>(
&self,
session: &'s Session,
name: impl AsRef<str>,
) -> Result<Tensor<Ref<'s, Device<H>>>>
pub fn output<'s, H: HalideType>( &self, session: &'s Session, name: impl AsRef<str>, ) -> Result<Tensor<Ref<'s, Device<H>>>>
Get the output tensor of a session by name
pub fn raw_output<'s>( &self, session: &'s Session, name: impl AsRef<str>, ) -> Result<RawTensor<'s>>
pub fn run_session(&mut self, session: &Session) -> Result<()>
pub fn run_session_with_callback( &mut self, session: &Session, before: impl Fn(&[RawTensor<'_>], OperatorInfo<'_>) -> bool + 'static, end: impl Fn(&[RawTensor<'_>], OperatorInfo<'_>) -> bool + 'static, sync: bool, ) -> Result<()>
pub fn outputs(&self, session: &Session) -> TensorList<'_>
pub fn set_cache_file( &mut self, path: impl AsRef<Path>, key_size: usize, ) -> Result<()>
pub fn update_cache_file(&mut self, session: &mut Session) -> Result<()>
sourcepub fn wait(&self, session: &Session)
pub fn wait(&self, session: &Session)
Wait for all output tensors to be ready after computation
pub fn memory(&self, session: &Session) -> Result<f32>
pub fn flops(&self, session: &Session) -> Result<f32>
pub fn resize_status(&self, session: &Session) -> Result<ResizeStatus>
Trait Implementations§
source§impl Drop for Interpreter
impl Drop for Interpreter
impl Send for Interpreter
Auto Trait Implementations§
impl Freeze for Interpreter
impl RefUnwindSafe for Interpreter
impl !Sync for Interpreter
impl Unpin for Interpreter
impl UnwindSafe for Interpreter
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