aboutsummaryrefslogtreecommitdiff
path: root/src/armnn/test/TensorHelpers.hpp
diff options
context:
space:
mode:
authorFrancis Murtagh <francis.murtagh@arm.com>2018-08-30 17:18:37 +0100
committerMatthew Bentham <matthew.bentham@arm.com>2018-09-17 17:21:25 +0100
commit8c5e3dc9f04ac15aa926d1a1214610760830dbe2 (patch)
tree354518d6b2db9c46e4b698fcfbedb629a5569b48 /src/armnn/test/TensorHelpers.hpp
parente7a86a4a3363993fb41b1ea62f23b3643b8b0c78 (diff)
downloadarmnn-8c5e3dc9f04ac15aa926d1a1214610760830dbe2.tar.gz
IVGCVSW-1786 - Division by zero
* Added logic for different cases of division by zero for ref * Added DivisionByZeroTest * Updated SelectiveComparer to compare NAN and INFINITY Change-Id: Iec6f89264b17a0b03fad5d7ec4b2dafc31fea5df
Diffstat (limited to 'src/armnn/test/TensorHelpers.hpp')
-rw-r--r--src/armnn/test/TensorHelpers.hpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/armnn/test/TensorHelpers.hpp b/src/armnn/test/TensorHelpers.hpp
index ec38940a44..13ae1008cd 100644
--- a/src/armnn/test/TensorHelpers.hpp
+++ b/src/armnn/test/TensorHelpers.hpp
@@ -44,6 +44,17 @@ struct SelectiveComparer<T, false>
{
return std::abs(a - b) <= g_FloatCloseToZeroTolerance;
}
+
+ if (std::isinf(a) && a == b)
+ {
+ return true;
+ }
+
+ if (std::isnan(a) && std::isnan(b))
+ {
+ return true;
+ }
+
// For unquantized floats we use a tolerance of 1%.
boost::math::fpc::close_at_tolerance<float> comparer(boost::math::fpc::percent_tolerance(1.0f));
return comparer(a, b);