aboutsummaryrefslogtreecommitdiff
path: root/delegate/src/test/TestUtils.hpp
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.hpp
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.hpp')
-rw-r--r--delegate/src/test/TestUtils.hpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/delegate/src/test/TestUtils.hpp b/delegate/src/test/TestUtils.hpp
index 9bbab8f62b..d805f7092e 100644
--- a/delegate/src/test/TestUtils.hpp
+++ b/delegate/src/test/TestUtils.hpp
@@ -25,6 +25,13 @@ void FillInput(std::unique_ptr<tflite::Interpreter>& interpreter, int inputIndex
}
}
+// Can be used to compare data with a tolerance depending on their data type
+void CompareData(float tensor1[], float tensor2[], size_t tensorSize);
+void CompareData(int8_t tensor1[], int8_t tensor2[], size_t tensorSize);
+void CompareData(uint8_t tensor1[], uint8_t tensor2[], size_t tensorSize);
+void CompareData(int16_t tensor1[], int16_t tensor2[], size_t tensorSize);
+
+
// Can be used to compare the output tensor shape and values
// from armnnDelegateInterpreter and tfLiteInterpreter.
// Example usage can be found in ControlTestHelper.hpp
@@ -36,7 +43,7 @@ void CompareOutputData(std::unique_ptr<tflite::Interpreter>& tfLiteInterpreter,
{
auto tfLiteDelegateOutputId = tfLiteInterpreter->outputs()[0];
auto tfLiteDelegateOutputTensor = tfLiteInterpreter->tensor(tfLiteDelegateOutputId);
- auto tfLiteDelageOutputData = tfLiteInterpreter->typed_tensor<T>(tfLiteDelegateOutputId);
+ auto tfLiteDelegateOutputData = tfLiteInterpreter->typed_tensor<T>(tfLiteDelegateOutputId);
auto armnnDelegateOutputId = armnnDelegateInterpreter->outputs()[0];
auto armnnDelegateOutputTensor = armnnDelegateInterpreter->tensor(armnnDelegateOutputId);
auto armnnDelegateOutputData = armnnDelegateInterpreter->typed_tensor<T>(armnnDelegateOutputId);
@@ -48,12 +55,9 @@ void CompareOutputData(std::unique_ptr<tflite::Interpreter>& tfLiteInterpreter,
CHECK(tfLiteDelegateOutputTensor->dims->data[i] == armnnDelegateOutputTensor->dims->data[i]);
}
- for (size_t i = 0; i < expectedOutputValues.size(); i++)
- {
- CHECK(expectedOutputValues[i] == armnnDelegateOutputData[i]);
- CHECK(tfLiteDelageOutputData[i] == expectedOutputValues[i]);
- CHECK(tfLiteDelageOutputData[i] == armnnDelegateOutputData[i]);
- }
+ armnnDelegate::CompareData(expectedOutputValues.data(), armnnDelegateOutputData , expectedOutputValues.size());
+ armnnDelegate::CompareData(tfLiteDelegateOutputData , expectedOutputValues.data(), expectedOutputValues.size());
+ armnnDelegate::CompareData(tfLiteDelegateOutputData , armnnDelegateOutputData , expectedOutputValues.size());
}
} // namespace armnnDelegate