Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/pfnet-research/menoh-rs

Rust binding for Menoh
https://github.com/pfnet-research/menoh-rs

mkl-dnn rust

Last synced: about 2 months ago
JSON representation

Rust binding for Menoh

Awesome Lists containing this project

README

        

# menoh-rs

[![crates.io](https://img.shields.io/crates/v/menoh.svg)](https://crates.io/crates/menoh)
[![docs.rs](https://docs.rs/menoh/badge.svg)](https://docs.rs/menoh)
[![Travis CI](https://travis-ci.org/pfnet-research/menoh-rs.svg?branch=master)](https://travis-ci.org/pfnet-research/menoh-rs)
[![AppVeyor](https://ci.appveyor.com/api/projects/status/y33xqwwlhtarirwd/branch/master?svg=true)](https://ci.appveyor.com/project/pfnet-research/menoh-rs/branch/master)

Rust binding for [Menoh](https://github.com/pfnet-research/menoh)
[Documentation](https://docs.rs/menoh)

## Requirements
- Rust 1.31+
- [Menoh](https://github.com/pfnet-research/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 # use your image
```

## Example (edition = "2018")

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

let (in_dims, in_buf) = model.get_variable_mut::("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::("fc2")?;
println!("out:");
println!(" dims: {:?}", out_dims);
println!(" buf: {:?}", out_buf);
Ok(())
}
```