menoh-sys

Crates.iomenoh-sys
lib.rsmenoh-sys
version0.2.2
sourcesrc
created_at2018-07-11 13:00:19.904433
updated_at2019-01-29 08:16:18.13573
descriptionLow-level binding for Menoh.
homepage
repositoryhttps://github.com/pfnet-research/menoh-rs
max_upload_size
id73756
size12,067
Toru Ogawa (Hakuyume)

documentation

README

menoh-rs

crates.io docs.rs Travis CI AppVeyor

Rust binding for Menoh
Documentation

Requirements

Demo

$ git clone https://github.com/pfnet-research/menoh-rs.git
$ cd menoh-rs/menoh

$ curl -L https://www.dropbox.com/s/bjfn9kehukpbmcm/VGG16.onnx?dl=1 -o VGG16.onnx
$ curl -LO https://raw.githubusercontent.com/HoldenCaulfieldRye/caffe/master/data/ilsvrc12/synset_words.txt
$ curl -LO https://upload.wikimedia.org/wikipedia/commons/5/54/Light_sussex_hen.jpg

$ cargo run --example vgg16  # use Light_sussex_hen.jpg
$ cargo run --example vgg16 -- --image <image>  # use your image

Example (edition = "2018")

fn main() -> Result<(), menoh::Error> {
    let mut model = menoh::Builder::from_onnx("MLP.onnx")?
        .add_input::<f32>("input", &[2, 3])?
        .add_output("fc2")?
        .build("mkldnn", "")?;

    let (in_dims, in_buf) = model.get_variable_mut::<f32>("input")?;
    in_buf.copy_from_slice(&[0., 1., 2., 3., 4., 5.]);
    println!("in:");
    println!("    dims: {:?}", in_dims);
    println!("    buf: {:?}", in_buf);

    model.run()?;

    let (out_dims, out_buf) = model.get_variable::<f32>("fc2")?;
    println!("out:");
    println!("    dims: {:?}", out_dims);
    println!("    buf: {:?}", out_buf);
    Ok(())
}
Commit count: 300

cargo fmt