From cc0c5e5612024d3429b0e4bcca75aef824bdc98d Mon Sep 17 00:00:00 2001 From: Changming Sun Date: Wed, 24 May 2023 22:59:28 -0700 Subject: [PATCH] Fix an error in test/shared_lib/test_inference.cc (#16090) ### Description Fix an error in test/shared_lib/test_inference.cc. It should use ASSERT_NEAR to test float values. ### Motivation and Context Our OpenVino pipeline is failing because of this. --- onnxruntime/test/shared_lib/test_inference.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/onnxruntime/test/shared_lib/test_inference.cc b/onnxruntime/test/shared_lib/test_inference.cc index f53a93225b..c352077e34 100644 --- a/onnxruntime/test/shared_lib/test_inference.cc +++ b/onnxruntime/test/shared_lib/test_inference.cc @@ -81,7 +81,11 @@ void RunSession(OrtAllocator* allocator, Ort::Session& session_object, OutT* f = output_tensor->GetTensorMutableData(); for (size_t i = 0; i != total_len; ++i) { - ASSERT_EQ(values_y[i], f[i]); + if constexpr (std::is_same::value || std::is_same::value) { + ASSERT_NEAR(values_y[i], f[i], 1e-3); + } else { + ASSERT_EQ(values_y[i], f[i]); + } } }