pub struct Model { /* private fields */ }Expand description
An ML inference model session.
Wraps a TFLM MicroInterpreter with automatic cleanup.
Implementations§
Source§impl Model
impl Model
Sourcepub fn new(config: &ModelConfig<'_>) -> Result<Self>
pub fn new(config: &ModelConfig<'_>) -> Result<Self>
Create a new model via heap allocation.
Sourcepub unsafe fn from_static(
storage: *mut ove_model_storage_t,
arena: *mut u8,
config: &ModelConfig<'_>,
) -> Result<Self>
pub unsafe fn from_static( storage: *mut ove_model_storage_t, arena: *mut u8, config: &ModelConfig<'_>, ) -> Result<Self>
Create from caller-provided storage and arena.
Available in both heap and zero-heap modes. Useful when the same storage/arena must be reused for different models (e.g. two-stage inference pipelines).
§Safety
Caller must ensure storage and arena outlive the Model and are
not shared with another primitive.
Sourcepub fn input(&self, index: u32) -> Result<TensorInfo>
pub fn input(&self, index: u32) -> Result<TensorInfo>
Get tensor info for an input tensor.
Sourcepub fn output(&self, index: u32) -> Result<TensorInfo>
pub fn output(&self, index: u32) -> Result<TensorInfo>
Get tensor info for an output tensor.
Sourcepub fn last_inference_us(&self) -> u64
pub fn last_inference_us(&self) -> u64
Return last inference duration in microseconds.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Model
impl RefUnwindSafe for Model
impl Unpin for Model
impl UnsafeUnpin for Model
impl UnwindSafe for Model
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