Skip to content

Commit 0a7da39

Browse files
committed
Add Session::make_runner()
1 parent acdc209 commit 0a7da39

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

onnxruntime/src/session.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use std::os::windows::ffi::OsStrExt;
1010
#[cfg(feature = "model-fetching")]
1111
use std::env;
1212

13-
use ndarray::Array;
13+
use ndarray::{Array, Dimension};
1414
use tracing::{debug, error};
1515

1616
use onnxruntime_sys as sys;
@@ -21,6 +21,7 @@ use crate::{
2121
error::{status_to_result, NonMatchingDimensionsError, OrtError, Result},
2222
g_ort,
2323
memory::MemoryInfo,
24+
runner::{Element, RunnerBuilder},
2425
tensor::{
2526
ort_owned_tensor::{OrtOwnedTensor, OrtOwnedTensorExtractor},
2627
OrtTensor,
@@ -361,6 +362,13 @@ impl Drop for Session {
361362
}
362363

363364
impl Session {
365+
pub fn make_runner<T: Element, D: Dimension, I: IntoIterator<Item = Array<T, D>>>(
366+
&self,
367+
input_arrays: I,
368+
) -> RunnerBuilder<'_, T, D> {
369+
RunnerBuilder::new(self, input_arrays)
370+
}
371+
364372
/// Run the input data through the ONNX graph, performing inference.
365373
///
366374
/// Note that ONNX models can have multiple inputs; a `Vec<_>` is thus

0 commit comments

Comments
 (0)