From 0b51d5ad533f8ecde71f957077690195eea29ffc Mon Sep 17 00:00:00 2001 From: Narumol Prangnawarat Date: Wed, 20 Jan 2021 15:58:29 +0000 Subject: IVGCVSW-5619 Add OptimizerOptions and NetworkProperties to ArmNN Delegate * Add OptimizerOptions, NetworkProperties, DebugCallbackFunction to DelegateOptions * Enable OptimizerOptions when the network is being optimized * Enable NetworkProperties when loading network * Enable DebugCallbackFunction * Add error message when loading network * Log warning instead of error when operator is not supported but could fallback to another backend * Improve uint16_t CompareData * Unit tests Signed-off-by: Narumol Prangnawarat Change-Id: I353035afb442774bfeb1c62570a90755c2ceaf38 --- delegate/src/test/TestUtils.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'delegate/src/test/TestUtils.cpp') diff --git a/delegate/src/test/TestUtils.cpp b/delegate/src/test/TestUtils.cpp index 2787147639..1bc5786112 100644 --- a/delegate/src/test/TestUtils.cpp +++ b/delegate/src/test/TestUtils.cpp @@ -71,17 +71,22 @@ void CompareData(Half tensor1[], Half tensor2[], size_t tensorSize) void CompareData(TfLiteFloat16 tensor1[], TfLiteFloat16 tensor2[], size_t tensorSize) { + uint16_t tolerance = 1; for (size_t i = 0; i < tensorSize; i++) { - CHECK(tensor1[i].data == tensor2[i].data); + uint16_t tensor1Data = tensor1[i].data; + uint16_t tensor2Data = tensor2[i].data; + CHECK(std::max(tensor1Data, tensor2Data) - std::min(tensor1Data, tensor2Data) <= tolerance); } } -void CompareData(TfLiteFloat16 tensor1[], Half tensor2[], size_t tensorSize) -{ +void CompareData(TfLiteFloat16 tensor1[], Half tensor2[], size_t tensorSize) { + uint16_t tolerance = 1; for (size_t i = 0; i < tensorSize; i++) { - CHECK(tensor1[i].data == half_float::detail::float2half(tensor2[i])); + uint16_t tensor1Data = tensor1[i].data; + uint16_t tensor2Data = half_float::detail::float2half(tensor2[i]); + CHECK(std::max(tensor1Data, tensor2Data) - std::min(tensor1Data, tensor2Data) <= tolerance); } } -- cgit v1.2.1