-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Op Conformance] Update compare accuracy function #21783
Conversation
Part of PR: #21347 with changes in code of tests. |
@sbalandi What is the status of the PR? |
the failed check is passed, so I think we can merge it |
@sbalandi what about failed macos jobs? |
I rerun it here based on that pr: https://openvino-ci.toolbox.iotg.sclab.intel.com/job/private-ci/job/ie/job/build-linux-macos_arm64/6276/ and it pass |
@@ -281,13 +294,33 @@ void compare(const ov::Tensor& expected, | |||
if (abs_threshold == std::numeric_limits<double>::max() && rel_threshold == std::numeric_limits<double>::max()) { | |||
if (sizeof(ExpectedT) == 1 || sizeof(ActualT) == 1) { | |||
abs_threshold = 1.; | |||
rel_threshold = 1.; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sbalandi Please check the changes on all platforms and skip tests per platform (in case some test is failed only on one platform)
In general, PR LGTM. Anyway, we should check all platforms |
@eshoguli Please add a comment related to rel_threshold and 0 handling |
1256b23
to
6358216
Compare
df230eb
to
bc33f4e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please fix
@@ -363,14 +409,14 @@ void compare(const ov::Tensor& expected, | |||
throw std::runtime_error(out_stream.str()); | |||
} | |||
double abs = std::fabs(expected_value - actual_value); | |||
double rel = expected_value ? (abs / std::fabs(expected_value)) : abs; | |||
double rel = expected_value && !std::isinf(expected_value) ? (abs / std::fabs(expected_value)) : abs; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my understanding: we can not use relative error if value is zero.
Imagine next situations:
case #1: expected = 0.0, actual = 0.1, rel = 0.1 <= only 10%, it's not correct
case #2: expected = 0.01 (slightly enlarged than in case #1), actual (the same) = 0.1, rel = abs(0.01 - 0.1)/0.01=9 <= 900%
In the case #2 difference is smaller, but rel
is much larger then in case #1. It's not correct. Don't use relative error if value is zero.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed, rel error is calculated now as:
double rel =
expected_value && actual_value && !std::isinf(expected_value) ? (abs / std::fabs(expected_value)) : 0;
7958781
to
9fae912
Compare
9fae912
to
4533a71
Compare
@sbalandi Is PR ready to merge? |
not yet, post merge is failed and i try to understand why |
abs_error.update(abs, i); | ||
rel_error.update(rel, i); | ||
} | ||
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.max, rel_threshold))) { | ||
if (!(less_or_equal(abs_error.max, abs_threshold) || less_or_equal(rel_error.mean, rel_threshold))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@iefode This PR leads to some failures of plugin unit test pass. Would you please check again?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ceciliapeng2011 In your case, please update your branch to latest master. Commit was reverted
continue; | ||
} else if ((std::isinf(expected_value) || expected_value <= min_type_expected) && | ||
(std::isinf(actual_value) || actual_value <= min_type_actual)) { | ||
continue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::numeric_limits<float>::min()
is smallest positive number representable by float, here all negative values can pass the check, which is not correct behavior, maybe you mean std::numeric_limits<float>::lowest()
?
Details:
Tickets: