# ort2
- onnxruntime wrapper for rust 2
- tested
| CPU | Y | Y | Y(aarch64) |
| CUDA | Y | Y | N/A |
## Pre-requirements
- download onnxruntime from onnxruntime github [Repo](https://github.com/microsoft/onnxruntime/releases), unzip it
- setup enviroment variable
- `ORT_INC_PATH=/opt/homebrew/opt/onnxruntime/include`
- `ORT_LIB_PATH=/opt/homebrew/opt/onnxruntime/lib`
## Getting Started
```rust
use ort2::prelude::*;
// load model stuff
let model = include_bytes!("models/mnist-8.onnx");
// create session
let session = Session::builder()
.build(model.as_ref())
.expect("failed to create session");
// dump input
let input = vec![0.0f32;28 * 28];
// create value from input
let value = Value::tensor()
.with_shape([1, 1, 28, 28])
.with_typ(ONNXTensorElementDataType::ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT)
.borrow(&input)
.expect("failed to build value");
// get output
let output = session.run([&value])
.expect("failed to run")
.into_iter()
.next()
.expect("failed to get outputs");
// output of session as ndarray Array
let output = output
.view::<f32>()
.expect("failed to view output");
assert_eq!(output.shape()[1], 10);
```