aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Bentham <Matthew.Bentham@arm.com>2024-06-17 15:59:02 +0000
committerCathal Corbett <cathal.corbett@arm.com>2024-06-18 08:38:03 +0000
commitc02f0d3d7b50638269bc8697d71c11f90b2857a3 (patch)
tree77dd6d193a5cebb54a8d9aae36f5e1693cd39272
parent43c9e9a80f30c3ca1e2388053cbc4e834a632885 (diff)
downloadarmnn-c02f0d3d7b50638269bc8697d71c11f90b2857a3.tar.gz
Fix segfault when using TfLite executor and output files are not specified
Signed-off-by: Matthew Bentham <Matthew.Bentham@arm.com> Change-Id: I559111f479b577695ef71000c62a704cbe636238
-rw-r--r--tests/ExecuteNetwork/TfliteExecutor.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/ExecuteNetwork/TfliteExecutor.cpp b/tests/ExecuteNetwork/TfliteExecutor.cpp
index 94ff57320f..7a4ff55237 100644
--- a/tests/ExecuteNetwork/TfliteExecutor.cpp
+++ b/tests/ExecuteNetwork/TfliteExecutor.cpp
@@ -248,8 +248,10 @@ std::vector<const void *> TfLiteExecutor::Execute()
TfLiteIntArray* outputDims = m_TfLiteInterpreter->tensor(tfLiteDelegateOutputId)->dims;
// If we've been asked to write to a file then set a file output stream. Otherwise use stdout.
FILE* outputTensorFile = stdout;
+ bool isNumpyOutput = false;
if (!m_Params.m_OutputTensorFiles.empty())
{
+ isNumpyOutput = m_Params.m_OutputTensorFiles[outputIndex].find(".npy") != std::string::npos;
outputTensorFile = fopen(m_Params.m_OutputTensorFiles[outputIndex].c_str(), "w");
if (outputTensorFile == NULL)
{
@@ -269,7 +271,6 @@ std::vector<const void *> TfLiteExecutor::Execute()
outputSize *= outputDims->data[dim];
}
- bool isNumpyOutput = m_Params.m_OutputTensorFiles[outputIndex].find(".npy") != std::string::npos;
armnn::TensorShape shape(static_cast<unsigned int>(outputDims->size), outputDims->data);
armnn::DataType dataType(GetDataType(*m_TfLiteInterpreter->tensor(tfLiteDelegateOutputId)));