Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
sbalandi committed Feb 21, 2024
1 parent fd78fb2 commit 2087297
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/tests/test_utils/common_test_utils/src/ov_tensor_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,16 @@ 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];
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) ? (abs / std::fabs(expected_value)) : 0 <<
", diff: " << (expected_value != 0.0 ? std::to_string(abs((expected_value - actual_value) / 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;
Expand Down Expand Up @@ -459,7 +469,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
Expand Down

0 comments on commit 2087297

Please sign in to comment.