Skip to content

Commit

Permalink
Round tract-onnx expected output to avoid false test failures
Browse files Browse the repository at this point in the history
Rounds classification scores to 2 decimal places and also
modifies the corresponding expected output.
  • Loading branch information
jlb6740 committed Aug 14, 2024
1 parent 3adb762 commit 1e9a139
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[Classification { label: "tiger", score: 17.559244 }, Classification { label: "tiger cat", score: 14.740076 }, Classification { label: "zebra", score: 12.357242 }]
[Classification { label: "tiger", score: 17.56 }, Classification { label: "tiger cat", score: 14.74 }, Classification { label: "zebra", score: 12.36 }]
Binary file modified benchmarks/tract-onnx-image-classification/benchmark.wasm
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ fn classify(image: &[u8]) -> Result<Vec<Classification>, anyhow::Error> {
.take(3)
.map(|(score, i)| Classification {
label: LABELS[*i as usize].to_string(),
score: **score,
score: format!("{:.*}", 2, **score).parse().unwrap(),
})
.collect();
Ok(labels)
Expand Down

0 comments on commit 1e9a139

Please sign in to comment.