From 0dfb2658ce521571aa0f9e859f813c60fda9d8d6 Mon Sep 17 00:00:00 2001 From: Colm Donelan Date: Thu, 22 Jun 2023 10:19:17 +0100 Subject: IVGCVSW-7666 Add a FileComparisonExecutor to ExecuteNetwork. * Implement the "-C" command line option of executenetwork. * Add a FileComparisonExecutorFile which will read tensors from a previously written text file and compare them to the execution output. Signed-off-by: Colm Donelan Change-Id: I8380fd263028af13d65a67fb6afd89626d1b07b8 --- tests/NetworkExecutionUtils/NetworkExecutionUtils.hpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'tests/NetworkExecutionUtils') diff --git a/tests/NetworkExecutionUtils/NetworkExecutionUtils.hpp b/tests/NetworkExecutionUtils/NetworkExecutionUtils.hpp index 2136c446fb..0df3bf5ef5 100644 --- a/tests/NetworkExecutionUtils/NetworkExecutionUtils.hpp +++ b/tests/NetworkExecutionUtils/NetworkExecutionUtils.hpp @@ -1,5 +1,5 @@ // -// Copyright © 2022 Arm Ltd and Contributors. All rights reserved. +// Copyright © 2022, 2023 Arm Ltd and Contributors. All rights reserved. // SPDX-License-Identifier: MIT // @@ -184,13 +184,14 @@ template void WriteToFile(const std::string& outputTensorFileName, const std::string& outputName, const T* const array, - const unsigned int numElements) + const unsigned int numElements, + armnn::DataType dataType) { std::ofstream outputTensorFile; outputTensorFile.open(outputTensorFileName, std::ofstream::out | std::ofstream::trunc); if (outputTensorFile.is_open()) { - outputTensorFile << outputName << ": "; + outputTensorFile << outputName << ", "<< GetDataTypeName(dataType) << " : "; for (std::size_t i = 0; i < numElements; ++i) { outputTensorFile << +array[i] << " "; @@ -209,6 +210,7 @@ struct OutputWriteInfo const std::string& m_OutputName; const armnn::Tensor& m_Tensor; const bool m_PrintTensor; + const armnn::DataType m_DataType; }; template @@ -221,7 +223,8 @@ void PrintTensor(OutputWriteInfo& info, const char* formatString) WriteToFile(info.m_OutputTensorFile.value(), info.m_OutputName, array, - info.m_Tensor.GetNumElements()); + info.m_Tensor.GetNumElements(), + info.m_DataType); } if (info.m_PrintTensor) @@ -248,7 +251,8 @@ void PrintQuantizedTensor(OutputWriteInfo& info) WriteToFile(info.m_OutputTensorFile.value(), info.m_OutputName, dequantizedValues.data(), - tensor.GetNumElements()); + tensor.GetNumElements(), + info.m_DataType); } if (info.m_PrintTensor) -- cgit v1.2.1