11use ndarray:: { Array2 , ArrayView , Dim , IxDynImpl } ;
2+ use ort:: session:: SessionOutputs ;
23
34use crate :: pooling;
45
@@ -10,7 +11,7 @@ use super::{OutputKey, OutputPrecedence};
1011/// pooling etc. This struct should contain all the necessary information for the
1112/// post-processing to be performed.
1213pub struct SingleBatchOutput < ' r , ' s > {
13- pub session_outputs : ort :: SessionOutputs < ' r , ' s > ,
14+ pub session_outputs : SessionOutputs < ' r , ' s > ,
1415 pub attention_mask_array : Array2 < i64 > ,
1516}
1617
@@ -23,17 +24,12 @@ impl<'r, 's> SingleBatchOutput<'r, 's> {
2324 & self ,
2425 precedence : & impl OutputPrecedence ,
2526 ) -> anyhow:: Result < ArrayView < f32 , Dim < IxDynImpl > > > {
26- let ort_output = precedence
27+ let ort_output: & ort :: value :: Value = precedence
2728 . key_precedence ( )
2829 . find_map ( |key| match key {
29- OutputKey :: OnlyOne => {
30- // Only export the value if there is only one output available.
31- if self . session_outputs . len ( ) == 1 {
32- self . session_outputs . values ( ) . next ( )
33- } else {
34- None
35- }
36- }
30+ OutputKey :: OnlyOne => self
31+ . session_outputs
32+ . get ( self . session_outputs . keys ( ) . nth ( 0 ) ?) ,
3733 OutputKey :: ByOrder ( idx) => {
3834 let x = self
3935 . session_outputs
0 commit comments