Crates.io | menoh |
lib.rs | menoh |
version | 0.2.2 |
source | src |
created_at | 2018-07-11 13:08:28.362092 |
updated_at | 2019-01-29 08:16:46.912803 |
description | Binding for Menoh. |
homepage | |
repository | https://github.com/pfnet-research/menoh-rs |
max_upload_size | |
id | 73758 |
size | 33,464 |
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(())
}