aboutsummaryrefslogtreecommitdiff
path: root/tests/ExecuteNetwork/TfliteExecutor.cpp
diff options
context:
space:
mode:
authorColm Donelan <colm.donelan@arm.com>2023-03-06 12:34:54 +0000
committerColm Donelan <colm.donelan@arm.com>2023-03-06 22:06:38 +0000
commitd047262b7fb68ad1fe0a2273ee79ab7952c72a6e (patch)
tree5e35dd8938cea094218fd84abb14d6418711df7d /tests/ExecuteNetwork/TfliteExecutor.cpp
parent0e5a1317156f97c56baf556ddc8a638228dbec74 (diff)
downloadarmnn-d047262b7fb68ad1fe0a2273ee79ab7952c72a6e.tar.gz
Fixing compare output feature in ExecuteNetwork
The -A -B -C options in execute network were attempting to calculate the RMS error over output tensors. However, the calculation was mixing tensor elements and bytes when doing the calculation. This patch changes the calculation to use a per byte RMS error calculation. Signed-off-by: Colm Donelan <colm.donelan@arm.com> Change-Id: If30230a16cfed1a8804b4d54ed1abcd371f26664
Diffstat (limited to 'tests/ExecuteNetwork/TfliteExecutor.cpp')
-rw-r--r--tests/ExecuteNetwork/TfliteExecutor.cpp44
1 files changed, 4 insertions, 40 deletions
diff --git a/tests/ExecuteNetwork/TfliteExecutor.cpp b/tests/ExecuteNetwork/TfliteExecutor.cpp
index fc9c21a559..f365623d62 100644
--- a/tests/ExecuteNetwork/TfliteExecutor.cpp
+++ b/tests/ExecuteNetwork/TfliteExecutor.cpp
@@ -230,45 +230,9 @@ void TfLiteExecutor::CompareAndPrintResult(std::vector<const void*> otherOutput)
for (unsigned int outputIndex = 0; outputIndex < m_TfLiteInterpreter->outputs().size(); ++outputIndex)
{
auto tfLiteDelegateOutputId = m_TfLiteInterpreter->outputs()[outputIndex];
- float result = 0;
- switch (m_TfLiteInterpreter->tensor(tfLiteDelegateOutputId)->type)
- {
- case kTfLiteFloat32:
- {
- result = ComputeRMSE<float>(m_TfLiteInterpreter->tensor(tfLiteDelegateOutputId)->allocation,
- otherOutput[outputIndex],
- m_TfLiteInterpreter->tensor(tfLiteDelegateOutputId)->bytes);
-
- break;
- }
- case kTfLiteInt32:
- {
- result = ComputeRMSE<int32_t>(m_TfLiteInterpreter->tensor(tfLiteDelegateOutputId)->allocation,
- otherOutput[outputIndex],
- m_TfLiteInterpreter->tensor(tfLiteDelegateOutputId)->bytes);
- break;
- }
- case kTfLiteUInt8:
- {
- result = ComputeRMSE<uint8_t>(m_TfLiteInterpreter->tensor(tfLiteDelegateOutputId)->allocation,
- otherOutput[outputIndex],
- m_TfLiteInterpreter->tensor(tfLiteDelegateOutputId)->bytes);
- break;
- }
- case kTfLiteInt8:
- {
- result = ComputeRMSE<int8_t>(m_TfLiteInterpreter->tensor(tfLiteDelegateOutputId)->allocation,
- otherOutput[outputIndex],
- m_TfLiteInterpreter->tensor(tfLiteDelegateOutputId)->bytes);
- break;
- }
- default:
- {
- }
- }
-
- std::cout << "RMSE of "
- << m_TfLiteInterpreter->tensor(tfLiteDelegateOutputId)->name
- << ": " << result << std::endl;
+ size_t size = m_TfLiteInterpreter->tensor(tfLiteDelegateOutputId)->bytes;
+ double result = ComputeByteLevelRMSE(m_TfLiteInterpreter->tensor(tfLiteDelegateOutputId)->allocation,
+ otherOutput[outputIndex], size);
+ std::cout << "Byte level root mean square error: " << result << "\n";
}
};