Skip to content

Commit

Permalink
fix: use ort rc
Browse files Browse the repository at this point in the history
  • Loading branch information
mosure committed Mar 10, 2024
1 parent 7ef12fc commit 2a92c93
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ features = [

[dependencies.ort]
version = "2.0.0-rc.0"
git = "https://github.com/pykeio/ort.git"
default-features = false
features = [
"cuda",
Expand Down
2 changes: 1 addition & 1 deletion benches/modnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ fn modnet_output_to_luma_images_benchmark(c: &mut Criterion) {

let session = Session::builder().unwrap()
.with_optimization_level(GraphOptimizationLevel::Level3).unwrap()
.commit_from_file("assets/modnet_photographic_portrait_matting.onnx").unwrap();
.with_model_from_file("assets/modnet_photographic_portrait_matting.onnx").unwrap();

let data = vec![0u8; (1920 * 1080 * 4) as usize];
let image: Image = Image::new(
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ impl AssetLoader for OnnxLoader {
// TODO: add session configuration
let session = Session::builder()?
.with_optimization_level(GraphOptimizationLevel::Level3)?
.commit_from_memory(&bytes)?;
.with_model_from_memory(&bytes)?;

Ok(Onnx {
session: Arc::new(Mutex::new(Some(session))),
Expand Down
3 changes: 2 additions & 1 deletion src/models/modnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ use rayon::prelude::*;
pub fn modnet_output_to_luma_images(
output_value: &ort::Value,
) -> Vec<Image> {
let data = output_value.extract_tensor::<f32>().unwrap();
let tensor = output_value.extract_tensor::<f32>().unwrap();
let data = tensor.view();

let shape = data.shape();
let batch_size = shape[0];
Expand Down

0 comments on commit 2a92c93

Please sign in to comment.