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..7eb03436e9eeaa 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 @@ -430,6 +430,20 @@ void compare(const ov::Tensor& expected, for (size_t i = 0; i < shape_size_cnt; ++i) { double expected_value = expected_data[i]; double actual_value = actual_data[i]; + + double abs2 = std::fabs(expected_value - actual_value); + double max_val = std::max(std::fabs(expected_value), std::fabs(actual_value)); + if (i < 16) { + std::cout << i << + ": act: " << actual_value << + ", exp: " << expected_value << + ", abs: " << std::fabs(expected_value - actual_value) << + ", real rel: " << (expected_value && actual_value && !std::isinf(expected_value) ? std::to_string(abs2 / std::fabs(expected_value)) : 0) << + ", real rel max: " << (expected_value && actual_value && !std::isinf(expected_value) ? std::to_string(abs2 / max_val) : 0) << + ", diff: " << (expected_value != 0.0 ? std::to_string(abs2 / expected_value) : "n/a") << std::endl; + } else if (i == 16) { + std::cout << "..." << std::endl; + } if ((std::isinf(expected_value) || expected_value >= max_type_expected) && (std::isinf(actual_value) || actual_value >= max_type_actual)) { continue; @@ -459,7 +473,7 @@ void compare(const ov::Tensor& expected, abs_error.mean /= shape_size_cnt; rel_error.mean /= shape_size_cnt; - if (!(less_or_equal(abs_error.max, abs_threshold) || less_or_equal(rel_error.mean, rel_threshold))) { + if (!(less_or_equal(abs_error.max, abs_threshold) || (rel_error.max != 0 && less_or_equal(rel_error.mean, rel_threshold)))) { std::ostringstream out_stream; out_stream << "abs_max < abs_threshold && rel_max < rel_threshold" << "\n\t abs_max: " << abs_error.max << "\n\t\t coordinate " << abs_error.max_coordinate