aboutsummaryrefslogtreecommitdiff
path: root/delegate/src/test/TestUtils.cpp
diff options
context:
space:
mode:
authorJan Eilers <jan.eilers@arm.com>2020-11-17 19:06:35 +0000
committerFrancis Murtagh <francis.murtagh@arm.com>2020-11-18 13:28:01 +0000
commit3812fbc78080a9b2493deeaf210d9580417c6c1c (patch)
tree6c737f8345dedfb95ab84bbe0a6fd07b53cfb6af /delegate/src/test/TestUtils.cpp
parent06d2d1b2012389a22688e070dadb9639f80fbec8 (diff)
downloadarmnn-3812fbc78080a9b2493deeaf210d9580417c6c1c.tar.gz
IVGCVSW-5543 Fix delegate Pooling2d failures on CpuAcc/GpuAcc
* Added tolerance when comparing data * Removed unsupported int16 tests Signed-off-by: Jan Eilers <jan.eilers@arm.com> Change-Id: I10f3ac26b894bb1da3af61bfe2d2a41c2f5d2bb1
Diffstat (limited to 'delegate/src/test/TestUtils.cpp')
-rw-r--r--delegate/src/test/TestUtils.cpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/delegate/src/test/TestUtils.cpp b/delegate/src/test/TestUtils.cpp
new file mode 100644
index 0000000000..cf3e1fee6b
--- /dev/null
+++ b/delegate/src/test/TestUtils.cpp
@@ -0,0 +1,46 @@
+//
+// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
+// SPDX-License-Identifier: MIT
+//
+
+#include "TestUtils.hpp"
+
+namespace armnnDelegate
+{
+
+void CompareData(float tensor1[], float tensor2[], size_t tensorSize)
+{
+ for (size_t i = 0; i < tensorSize; i++)
+ {
+ CHECK(tensor1[i] == doctest::Approx( tensor2[i] ));
+ }
+}
+
+void CompareData(uint8_t tensor1[], uint8_t tensor2[], size_t tensorSize)
+{
+ uint8_t tolerance = 1;
+ for (size_t i = 0; i < tensorSize; i++)
+ {
+ CHECK(std::max(tensor1[i], tensor2[i]) - std::min(tensor1[i], tensor2[i]) <= tolerance);
+ }
+}
+
+void CompareData(int16_t tensor1[], int16_t tensor2[], size_t tensorSize)
+{
+ int16_t tolerance = 1;
+ for (size_t i = 0; i < tensorSize; i++)
+ {
+ CHECK(std::max(tensor1[i], tensor2[i]) - std::min(tensor1[i], tensor2[i]) <= tolerance);
+ }
+}
+
+void CompareData(int8_t tensor1[], int8_t tensor2[], size_t tensorSize)
+{
+ int8_t tolerance = 1;
+ for (size_t i = 0; i < tensorSize; i++)
+ {
+ CHECK(std::max(tensor1[i], tensor2[i]) - std::min(tensor1[i], tensor2[i]) <= tolerance);
+ }
+}
+
+} // namespace armnnDelegate \ No newline at end of file