From 1ef76c67898752aa95ac2d46ffa4035d1c9a2d86 Mon Sep 17 00:00:00 2001 From: sbalandi Date: Tue, 20 Feb 2024 19:54:06 +0100 Subject: [PATCH] test --- .../common_test_utils/src/ov_tensor_utils.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/tests/test_utils/common_test_utils/src/ov_tensor_utils.cpp b/src/tests/test_utils/common_test_utils/src/ov_tensor_utils.cpp index 832bb6b618f5f7..6c15eef56e8563 100644 --- a/src/tests/test_utils/common_test_utils/src/ov_tensor_utils.cpp +++ b/src/tests/test_utils/common_test_utils/src/ov_tensor_utils.cpp @@ -451,8 +451,21 @@ void compare(const ov::Tensor& expected, } double abs = std::fabs(expected_value - actual_value); - double rel = - expected_value && actual_value && !std::isinf(expected_value) ? (abs / std::fabs(expected_value)) : 0; + // double rel = + // expected_value && actual_value && !std::isinf(expected_value) ? (abs / std::fabs(expected_value)) : 0; + + double rel = 0; + if (expected_value == 0 || actual_value == 0) { + if (expected_value >= 1 || expected_value <= -1 || actual_value >= 1 || actual_value <= -1) { + rel = abs / 100; + } else if ((expected_value != 0 && expected_value > -1 && expected_value < 1) || + (actual_value != 0 && actual_value > -1 && actual_value < 1)) { + rel = abs; + } + } else if (!std::isinf(expected_value)) { + rel = (abs / std::fabs(expected_value)); + } + abs_error.update(abs, i); rel_error.update(rel, i); }