Skip to main content

Crate edgefirst_tflite

Crate edgefirst_tflite 

Source
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

FeatureDescription
dmabufDMA-BUF zero-copy inference via HAL Delegate API
camera_adaptorNPU-accelerated format conversion
metadataTFLite model metadata extraction
fullEnables 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-tflite crate.
interpreter
Interpreter and builder for TFLite model inference.
library
Safe wrapper around the TFLite shared-library handle.
model
Model loading for TFLite inference.
tensor
Type-safe tensor wrappers for the TensorFlow Lite C API.