Skip to main content

edgefirst_tflite/
lib.rs

1// SPDX-License-Identifier: Apache-2.0
2// Copyright (c) 2025 Au-Zone Technologies. All Rights Reserved.
3
4//! Ergonomic Rust API for TensorFlow Lite inference.
5//!
6//! This crate provides a safe, idiomatic wrapper around the `TFLite` C API
7//! with support for hardware-accelerated inference via delegates, DMA-BUF
8//! zero-copy, and NPU preprocessing.
9//!
10//! # Quick Start
11//!
12//! ```no_run
13//! use edgefirst_tflite::{Library, Model, Interpreter};
14//!
15//! let lib = Library::new()?;
16//! let model = Model::from_file(&lib, "model.tflite")?;
17//!
18//! let mut interpreter = Interpreter::builder(&lib)?
19//!     .num_threads(4)
20//!     .build(&model)?;
21//!
22//! // Populate input tensors...
23//! interpreter.invoke()?;
24//!
25//! let outputs = interpreter.outputs()?;
26//! # Ok::<(), edgefirst_tflite::Error>(())
27//! ```
28//!
29//! # Feature Flags
30//!
31//! | Feature | Description |
32//! |---------|-------------|
33//! | `dmabuf` | DMA-BUF zero-copy inference via HAL Delegate API |
34//! | `camera_adaptor` | NPU-accelerated format conversion |
35//! | `metadata` | `TFLite` model metadata extraction |
36//! | `full` | Enables all optional features |
37
38pub mod delegate;
39pub mod error;
40pub mod interpreter;
41pub mod library;
42pub mod model;
43pub mod tensor;
44
45#[cfg(feature = "dmabuf")]
46pub mod dmabuf;
47
48#[cfg(feature = "camera_adaptor")]
49pub mod camera_adaptor;
50
51#[cfg(feature = "metadata")]
52pub mod metadata;
53
54// Public re-exports for convenience.
55pub use delegate::{Delegate, DelegateOptions};
56pub use error::{Error, StatusCode};
57pub use interpreter::{Interpreter, InterpreterBuilder};
58pub use library::Library;
59pub use model::Model;
60pub use tensor::{QuantizationParams, Tensor, TensorMut, TensorType};