Skip to content

Commit 8a035d7

Browse files
authored
Switch from .into_iter() to .iter()
This probably runs faster.
1 parent 63f16ed commit 8a035d7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

onnxruntime/tests/integration_tests.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ mod download {
103103
// and iterate on resulting probabilities, creating an index to later access labels.
104104
let mut probabilities: Vec<(usize, f32)> = outputs[0]
105105
.softmax(ndarray::Axis(1))
106-
.into_iter()
106+
.iter()
107+
.copied()
107108
.enumerate()
108109
.collect::<Vec<_>>();
109110
// Sort probabilities so highest is at beginning of vector.
@@ -191,7 +192,8 @@ mod download {
191192

192193
let mut probabilities: Vec<(usize, f32)> = outputs[0]
193194
.softmax(ndarray::Axis(1))
194-
.into_iter()
195+
.iter()
196+
.copied()
195197
.enumerate()
196198
.collect::<Vec<_>>();
197199

0 commit comments

Comments
 (0)