diff options
author | Jan Eilers <jan.eilers@arm.com> | 2020-11-18 10:36:46 +0000 |
---|---|---|
committer | Jim Flynn <jim.flynn@arm.com> | 2020-11-19 23:43:11 +0000 |
commit | fe73b04129697dfeaebfb37015ce1b19c9a56101 (patch) | |
tree | de19447f9d070e2726e951cb7679655ea04b23da /delegate/src/test/TestUtils.hpp | |
parent | be25d94aefe53f221304b1f5f344913b708f808b (diff) | |
download | armnn-fe73b04129697dfeaebfb37015ce1b19c9a56101.tar.gz |
IVGCVSW-5545 Fix delegate Comparison failures on CpuAcc/GpuAcc
* Create backend test suite structure
* Add special compare function for boolean values
Signed-off-by: Jan Eilers <jan.eilers@arm.com>
Change-Id: I55a2ae1ac6ad21cdcdd5ae99ef56ed00fa24776f
Diffstat (limited to 'delegate/src/test/TestUtils.hpp')
-rw-r--r-- | delegate/src/test/TestUtils.hpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/delegate/src/test/TestUtils.hpp b/delegate/src/test/TestUtils.hpp index d805f7092e..57ae3ce6fe 100644 --- a/delegate/src/test/TestUtils.hpp +++ b/delegate/src/test/TestUtils.hpp @@ -25,16 +25,28 @@ void FillInput(std::unique_ptr<tflite::Interpreter>& interpreter, int inputIndex } } -// Can be used to compare data with a tolerance depending on their data type +/// Can be used to compare bool data coming from a tflite interpreter +/// Boolean types get converted to a bit representation in a vector. vector.data() returns a void pointer +/// instead of a pointer to bool. Therefore a special function to compare to vector of bool is required +void CompareData(std::vector<bool>& tensor1, bool tensor2[], size_t tensorSize); +void CompareData(bool tensor1[], bool tensor2[], size_t tensorSize); + +/// Can be used to compare float data coming from a tflite interpreter with a tolerance of limit_of_float*100 void CompareData(float tensor1[], float tensor2[], size_t tensorSize); + +/// Can be used to compare int8_t data coming from a tflite interpreter with a tolerance of 1 void CompareData(int8_t tensor1[], int8_t tensor2[], size_t tensorSize); + +/// Can be used to compare uint8_t data coming from a tflite interpreter with a tolerance of 1 void CompareData(uint8_t tensor1[], uint8_t tensor2[], size_t tensorSize); + +/// Can be used to compare int16_t data coming from a tflite interpreter with a tolerance of 1 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 +/// Can be used to compare the output tensor shape and values +/// from armnnDelegateInterpreter and tfLiteInterpreter. +/// Example usage can be found in ControlTestHelper.hpp template <typename T> void CompareOutputData(std::unique_ptr<tflite::Interpreter>& tfLiteInterpreter, std::unique_ptr<tflite::Interpreter>& armnnDelegateInterpreter, |