Crates.io | menoh-sys |
lib.rs | menoh-sys |
version | 0.2.2 |
source | src |
created_at | 2018-07-11 13:00:19.904433 |
updated_at | 2019-01-29 08:16:18.13573 |
description | Low-level binding for Menoh. |
homepage | |
repository | https://github.com/pfnet-research/menoh-rs |
max_upload_size | |
id | 73756 |
size | 12,067 |
Rust binding for Menoh
Documentation
$ 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
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(())
}