Struct mnn::interpreter::Interpreter

source ·
pub struct Interpreter { /* private fields */ }

Implementations§

source§

impl Interpreter

source

pub fn from_file(path: impl AsRef<Path>) -> Result<Self>

source

pub fn from_bytes(bytes: impl AsRef<[u8]>) -> Result<Self>

source

pub fn set_session_mode(&mut self, mode: SessionMode)

source

pub fn resize_session(&self, session: &mut Session)

source

pub fn resize_session_reallocate(&self, session: &mut Session)

source

pub fn resize_tensor<T: TensorType>( &self, tensor: &mut Tensor<T>, dims: impl AsTensorShape, )

source

pub fn resize_tensor_by_nchw<T: TensorType>( &self, tensor: &mut Tensor<T>, batch: i32, channel: i32, height: i32, width: i32, )

source

pub fn create_session(&mut self, schedule: ScheduleConfig) -> Result<Session>

source

pub fn create_multipath_session( &mut self, schedule: impl IntoIterator<Item = ScheduleConfig>, ) -> Result<Session>

source

pub fn model_print_io(path: impl AsRef<Path>) -> Result<()>

source

pub fn inputs(&self, session: &Session) -> TensorList<'_>

source

pub fn input<'s, H: HalideType>( &self, session: &'s Session, name: impl AsRef<str>, ) -> Result<Tensor<RefMut<'s, Device<H>>>>

source

pub fn raw_input<'s>( &self, session: &'s Session, name: impl AsRef<str>, ) -> Result<RawTensor<'s>>

source

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

source

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

source

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

source

pub fn raw_output<'s>( &self, session: &'s Session, name: impl AsRef<str>, ) -> Result<RawTensor<'s>>

source

pub fn run_session(&mut self, session: &Session) -> Result<()>

source

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<()>

source

pub fn outputs(&self, session: &Session) -> TensorList<'_>

source

pub fn set_cache_file( &mut self, path: impl AsRef<Path>, key_size: usize, ) -> Result<()>

source

pub fn update_cache_file(&mut self, session: &mut Session) -> Result<()>

source

pub fn wait(&self, session: &Session)

Wait for all output tensors to be ready after computation

source

pub fn memory(&self, session: &Session) -> Result<f32>

source

pub fn flops(&self, session: &Session) -> Result<f32>

source

pub fn resize_status(&self, session: &Session) -> Result<ResizeStatus>

Trait Implementations§

source§

impl Drop for Interpreter

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl Send for Interpreter

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.