Expand description
Ergonomic Rust API for TensorFlow Lite inference.
This crate provides a safe, idiomatic wrapper around the TFLite C API
with support for hardware-accelerated inference via delegates, DMA-BUF
zero-copy, and NPU preprocessing.
§Quick Start
use edgefirst_tflite::{Library, Model, Interpreter};
let lib = Library::new()?;
let model = Model::from_file(&lib, "model.tflite")?;
let mut interpreter = Interpreter::builder(&lib)?
.num_threads(4)
.build(&model)?;
// Populate input tensors...
interpreter.invoke()?;
let outputs = interpreter.outputs()?;§Feature Flags
| Feature | Description |
|---|---|
dmabuf | DMA-BUF zero-copy inference via HAL Delegate API |
camera_adaptor | NPU-accelerated format conversion |
metadata | TFLite model metadata extraction |
full | Enables all optional features |
Re-exports§
pub use delegate::Delegate;pub use delegate::DelegateOptions;pub use error::Error;pub use error::StatusCode;pub use interpreter::Interpreter;pub use interpreter::InterpreterBuilder;pub use library::Library;pub use model::Model;pub use tensor::QuantizationParams;pub use tensor::Tensor;pub use tensor::TensorMut;pub use tensor::TensorType;
Modules§
- delegate
- Delegate loading with configuration options.
- error
- Error types for the
edgefirst-tflitecrate. - interpreter
- Interpreter and builder for
TFLitemodel inference. - library
- Safe wrapper around the
TFLiteshared-library handle. - model
- Model loading for
TFLiteinference. - tensor
- Type-safe tensor wrappers for the TensorFlow Lite C API.