Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
sbalandi committed Feb 20, 2024
1 parent fd78fb2 commit 1ef76c6
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/tests/test_utils/common_test_utils/src/ov_tensor_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 1ef76c6

Please sign in to comment.