diff options
author | Colm Donelan <colm.donelan@arm.com> | 2023-06-22 10:19:17 +0100 |
---|---|---|
committer | Colm Donelan <colm.donelan@arm.com> | 2023-06-30 14:20:56 +0100 |
commit | 0dfb2658ce521571aa0f9e859f813c60fda9d8d6 (patch) | |
tree | ef4605cebb29c6754da8dfea0decd4250288e2a5 /tests/NetworkExecutionUtils/NetworkExecutionUtils.hpp | |
parent | 16e27cf81424dcad05d129f9ba368a8c446cd25f (diff) | |
download | armnn-0dfb2658ce521571aa0f9e859f813c60fda9d8d6.tar.gz |
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 <colm.donelan@arm.com>
Change-Id: I8380fd263028af13d65a67fb6afd89626d1b07b8
Diffstat (limited to 'tests/NetworkExecutionUtils/NetworkExecutionUtils.hpp')
-rw-r--r-- | tests/NetworkExecutionUtils/NetworkExecutionUtils.hpp | 14 |
1 files changed, 9 insertions, 5 deletions
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<typename T> 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 <typename T> @@ -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) |