[IE][TESTS] Fix compareRawBuffers and compareBlobData methods (#2222)
Use `<=` comparison instead of `<` with thresholds. This allows to use `0` threshold for bit-exact comparison.
This commit is contained in:
parent
89a6f926a4
commit
a0938a92d4
@ -66,7 +66,7 @@ static void inline compareRawBuffers(const dType *res, const dType *ref,
|
|||||||
case CompareType::ABS:
|
case CompareType::ABS:
|
||||||
for (size_t i = 0; i < refSize; i++) {
|
for (size_t i = 0; i < refSize; i++) {
|
||||||
float absDiff = std::abs(res[i] - ref[i]);
|
float absDiff = std::abs(res[i] - ref[i]);
|
||||||
ASSERT_LT(absDiff, thr1) << "Relative comparison of values ref: " << ref[i] << " and res: "
|
ASSERT_LE(absDiff, thr1) << "Relative comparison of values ref: " << ref[i] << " and res: "
|
||||||
<< res[i] << " , index in blobs: " << i << " failed!";
|
<< res[i] << " , index in blobs: " << i << " failed!";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -74,7 +74,7 @@ static void inline compareRawBuffers(const dType *res, const dType *ref,
|
|||||||
for (size_t i = 0; i < refSize; i++) {
|
for (size_t i = 0; i < refSize; i++) {
|
||||||
float absDiff = std::abs(res[i] - ref[i]);
|
float absDiff = std::abs(res[i] - ref[i]);
|
||||||
float relDiff = absDiff / std::max(res[i], ref[i]);
|
float relDiff = absDiff / std::max(res[i], ref[i]);
|
||||||
ASSERT_LT(relDiff, thr2) << "Relative comparison of values ref: " << ref[i] << " and res: "
|
ASSERT_LE(relDiff, thr2) << "Relative comparison of values ref: " << ref[i] << " and res: "
|
||||||
<< res[i] << " , index in blobs: " << i << " failed!";
|
<< res[i] << " , index in blobs: " << i << " failed!";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -83,7 +83,7 @@ static void inline compareRawBuffers(const dType *res, const dType *ref,
|
|||||||
float absDiff = std::abs(res[i] - ref[i]);
|
float absDiff = std::abs(res[i] - ref[i]);
|
||||||
if (absDiff > thr1) {
|
if (absDiff > thr1) {
|
||||||
float relDiff = absDiff / std::max(res[i], ref[i]);
|
float relDiff = absDiff / std::max(res[i], ref[i]);
|
||||||
ASSERT_LT(relDiff, thr2) << "Comparison of values ref: " << ref[i] << " and res: "
|
ASSERT_LE(relDiff, thr2) << "Comparison of values ref: " << ref[i] << " and res: "
|
||||||
<< res[i] << " , index in blobs: " << i << " failed!";
|
<< res[i] << " , index in blobs: " << i << " failed!";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -234,7 +234,7 @@ compareBlobData(const InferenceEngine::Blob::Ptr &res, const InferenceEngine::Bl
|
|||||||
float absDiff = std::abs(resVal - refVal);
|
float absDiff = std::abs(resVal - refVal);
|
||||||
if (absDiff > max_diff) {
|
if (absDiff > max_diff) {
|
||||||
float relDiff = absDiff / std::max(res_ptr[i], ref_ptr[i]);
|
float relDiff = absDiff / std::max(res_ptr[i], ref_ptr[i]);
|
||||||
ASSERT_LT(relDiff, max_diff) << "Relative comparison of values ref: " << ref_ptr[i] << " and res: "
|
ASSERT_LE(relDiff, max_diff) << "Relative comparison of values ref: " << ref_ptr[i] << " and res: "
|
||||||
<< res_ptr[i] << " , index in blobs: " << i << " failed!" << assertDetails;
|
<< res_ptr[i] << " , index in blobs: " << i << " failed!" << assertDetails;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user