Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/marian-nmt/intgemm/intgemm.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/test.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/test/test.h b/test/test.h
index a1ca724..ac4a8f6 100644
--- a/test/test.h
+++ b/test/test.h
@@ -38,7 +38,9 @@ template <typename Type>
void CompareEps(const Type* reference, const Type* actual, Index size, Type epsilon) {
for (Index i = 0; i < size; ++i) {
INFO("Inaccurate at " << i << ' ' << reference[i] << ' ' << actual[i]);
- CHECK(fabs(reference[i] - actual[i]) < epsilon);
+ // Ratio to maximum value.
+ float threshold = epsilon * std::max(0.01f, fabs(reference[i]));
+ CHECK(fabs(reference[i] - actual[i]) < threshold);
}
}