Skip to content

Commit

Permalink
Add Session::make_runner()
Browse files Browse the repository at this point in the history
  • Loading branch information
aldanor committed Nov 28, 2020
1 parent 4874fc1 commit a20bea6
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion onnxruntime/src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use std::os::windows::ffi::OsStrExt;
#[cfg(feature = "model-fetching")]
use std::env;

use ndarray::Array;
use ndarray::{Array, Dimension};
use tracing::{debug, error};

use onnxruntime_sys as sys;
Expand All @@ -21,6 +21,7 @@ use crate::{
error::{status_to_result, NonMatchingDimensionsError, OrtError, Result},
g_ort,
memory::MemoryInfo,
runner::{Element, RunnerBuilder},
tensor::{
ort_owned_tensor::{OrtOwnedTensor, OrtOwnedTensorExtractor},
OrtTensor,
Expand Down Expand Up @@ -361,6 +362,13 @@ impl Drop for Session {
}

impl Session {
pub fn make_runner<T: Element, D: Dimension, I: IntoIterator<Item = Array<T, D>>>(
&self,
input_arrays: I,
) -> RunnerBuilder<'_, T, D> {
RunnerBuilder::new(self, input_arrays)
}

/// Run the input data through the ONNX graph, performing inference.
///
/// Note that ONNX models can have multiple inputs; a `Vec<_>` is thus
Expand Down

0 comments on commit a20bea6

Please sign in to comment.