8 releases
0.2.2 | Jan 29, 2019 |
---|---|
0.2.1 | Jan 29, 2019 |
0.2.0 | Oct 15, 2018 |
0.1.4 | Aug 19, 2018 |
0.1.3 | Jul 12, 2018 |
#678 in Machine learning
Used in menoh
13KB
301 lines
menoh-rs
Rust binding for Menoh
Documentation
Requirements
- Rust 1.31+
- Menoh 1.1+
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(())
}
No runtime deps
~5KB