pub struct Model { /* private fields */ }Expand description
A TensorFlow Lite model loaded from a .tflite flatbuffer file.
The underlying TfLiteModel* is released when this value is dropped.
Cloning the Arc<TfLiteLibrary> is cheap and keeps the loaded shared
object alive for as long as any Model or interpreter still uses it.
Implementations§
Source§impl Model
impl Model
Sourcepub fn from_file<P: AsRef<Path>>(
path: P,
lib: Arc<TfLiteLibrary>,
) -> Result<Self>
pub fn from_file<P: AsRef<Path>>( path: P, lib: Arc<TfLiteLibrary>, ) -> Result<Self>
Load a .tflite flatbuffer from disk.
Internally calls TfLiteModelCreateFromFile. Returns
Error::ModelLoadFailed if the C API returns NULL (commonly: the
file does not exist, is unreadable, or is not a valid TFLite model).
Sourcepub fn as_ptr(&self) -> *const TfLiteModel
pub fn as_ptr(&self) -> *const TfLiteModel
Returns the raw TfLiteModel*. Mostly useful for advanced FFI scenarios.
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