Crate hotg_runecoral
source · [−]Expand description
Bindings for exposing the functionality of librunecoral
Example
use hotg_runecoral::{Tensor, TensorMut, InferenceContext, AccelerationBackend};
// load the model
let model: &[u8] = load_model();
// set aside some arrays for our inputs and outputs
let input = [0.0_f32];
let mut output = [0.0_f32];
// And create tensors which point to them
let input_tensor = Tensor::from_slice(&input, &[1]);
let output_tensor = TensorMut::from_slice(&mut output, &[1]);
// load our inference backend
let mut ctx = InferenceContext::create_context(
"application/tflite-context",
model,
AccelerationBackend::NONE,
)?;
// Now we can run inference
ctx.infer(&[input_tensor], &mut [output_tensor])?;
// and look at the results
println!("{:?} => {:?}", input, output);
Modules
The raw bindings generated by bindgen
.
Structs
A backend which can run inference on a model.
An immutable reference to a tensor’s backing buffer.
The shape and element type of a Tensor
.
A mutable reference to a tensor’s backing buffer.
Enums
Traits
A Rust type that can be used as the element of a tensor.
Functions
The mimetype used by this crate to represent TensorFlow Lite models.