mlua-tract

Crates.iomlua-tract
lib.rsmlua-tract
version0.1.2
sourcesrc
created_at2024-01-07 19:03:12.18341
updated_at2024-02-17 15:05:35.09743
descriptionLua bindings for tract, the tiny, no-nonsense, self-contained, Rust-based Tensorflow and ONNX inference runtime.
homepagehttps://on-prem.net
repositoryhttps://gitlab.com/megalithic-llc/mlua-tract.git
max_upload_size
id1091966
size133,238
David Rauschenbach (drauschenbach)

documentation

README

mlua-tract

Lua bindings for tract, the tiny, no-nonsense, self-contained, Rust-based Tensorflow and ONNX inference runtime.

License Arch Lua

Installing

Add to your Rust project using one of MLua's features: [lua51, lua52, lua53, lua54, luajit, luajit52].

$ cargo add mlua-tract --features luajit

Using

use mlua::Lua;
use mlua_tract;

let lua = Lua::new();
mlua_tract::preload(&lua)?;
let script = r#"
    local tract_onnx = require('tract.onnx')
    local model = tract_onnx.model_for_path('testdata/keras-tract-tf2-example.onnx')
    return tostring(model:input_fact(1))
"#;
let result: String = lua.load(script).eval()?; // returns: "unk__6,100,F32"

Testing

$ make check
Commit count: 0

cargo fmt