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.
This commit is contained in:
Changming Sun 2023-05-24 22:59:28 -07:00 committed by GitHub
parent 76fd9aa745
commit cc0c5e5612
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -81,7 +81,11 @@ void RunSession(OrtAllocator* allocator, Ort::Session& session_object,
OutT* f = output_tensor->GetTensorMutableData<OutT>();
for (size_t i = 0; i != total_len; ++i) {
ASSERT_EQ(values_y[i], f[i]);
if constexpr (std::is_same<OutT, float>::value || std::is_same<OutT, double>::value) {
ASSERT_NEAR(values_y[i], f[i], 1e-3);
} else {
ASSERT_EQ(values_y[i], f[i]);
}
}
}