aboutsummaryrefslogtreecommitdiff
path: root/tests/ExecuteNetwork
diff options
context:
space:
mode:
authorDavid Monahan <David.Monahan@arm.com>2021-11-01 10:16:37 +0000
committerDavid Monahan <david.monahan@arm.com>2021-11-01 16:32:24 +0000
commit2d9956162dd002a41f7fb4fa6753195d33524c7f (patch)
tree35b88472ff1bc5374c40365785c626cfb1ddec2c /tests/ExecuteNetwork
parent6b9eba2f785093747f04af245da0cec7aca3931c (diff)
downloadarmnn-2d9956162dd002a41f7fb4fa6753195d33524c7f.tar.gz
IVGCVSW-6359 Added support for Float16 (Half) to Execute Network
* Allows the user to specify float16 as a datatype * Does not contain support for float16 on the TfLiteDelegate via ExecuteNetwork Signed-off-by: David Monahan <David.Monahan@arm.com> Change-Id: Icba56feedab32662e2cf671cc46ada899cf40c6c
Diffstat (limited to 'tests/ExecuteNetwork')
-rw-r--r--tests/ExecuteNetwork/ExecuteNetwork.cpp15
-rw-r--r--tests/ExecuteNetwork/ExecuteNetworkProgramOptions.cpp4
2 files changed, 16 insertions, 3 deletions
diff --git a/tests/ExecuteNetwork/ExecuteNetwork.cpp b/tests/ExecuteNetwork/ExecuteNetwork.cpp
index a0a08d31b0..0d5271158b 100644
--- a/tests/ExecuteNetwork/ExecuteNetwork.cpp
+++ b/tests/ExecuteNetwork/ExecuteNetwork.cpp
@@ -12,6 +12,7 @@
#include <armnnUtils/Filesystem.hpp>
#include <armnnUtils/TContainer.hpp>
#include <InferenceTest.hpp>
+#include <Half.hpp>
#if defined(ARMNN_SERIALIZER)
#include "armnnDeserializer/IDeserializer.hpp"
@@ -484,7 +485,7 @@ int MainImpl(const ExecuteNetworkParams& params,
armnn::DataType type = model.GetOutputBindingInfo(outputIdx).second.GetDataType();
switch (type)
{
- // --output-type only supports float, int, qasymms8 or qasymmu8.
+ // --output-type only supports float, float16, int, qasymms8 or qasymmu8.
case armnn::DataType::Float32:
if (params.m_OutputTypes[outputIdx].compare("float") != 0)
{
@@ -493,6 +494,14 @@ int MainImpl(const ExecuteNetworkParams& params,
". This may cause unexpected problems or random failures.";
}
break;
+ case armnn::DataType::Float16:
+ if (params.m_OutputTypes[outputIdx].compare("float16") != 0)
+ {
+ ARMNN_LOG(warning) << "Model output index: " << outputIdx << " has data type Float16. The " <<
+ "corresponding --output-type is " << params.m_OutputTypes[outputIdx] <<
+ ". This may cause unexpected problems or random failures.";
+ }
+ break;
case armnn::DataType::QAsymmU8:
if (params.m_OutputTypes[outputIdx].compare("qasymmu8") != 0)
{
@@ -530,6 +539,10 @@ int MainImpl(const ExecuteNetworkParams& params,
{
outputDataContainers.push_back(std::vector<float>(model.GetOutputSize(i)));
}
+ else if (params.m_OutputTypes[i].compare("float16") == 0)
+ {
+ outputDataContainers.push_back(std::vector<armnn::Half>(model.GetOutputSize(i)));
+ }
else if (params.m_OutputTypes[i].compare("int") == 0)
{
outputDataContainers.push_back(std::vector<int>(model.GetOutputSize(i)));
diff --git a/tests/ExecuteNetwork/ExecuteNetworkProgramOptions.cpp b/tests/ExecuteNetwork/ExecuteNetworkProgramOptions.cpp
index 8ee66cf64b..25dbe91455 100644
--- a/tests/ExecuteNetwork/ExecuteNetworkProgramOptions.cpp
+++ b/tests/ExecuteNetwork/ExecuteNetworkProgramOptions.cpp
@@ -294,13 +294,13 @@ ProgramOptions::ProgramOptions() : m_CxxOptions{"ExecuteNetwork",
("y,input-type",
"The type of the input tensors in the network separated by comma. "
"If unset, defaults to \"float\" for all defined inputs. "
- "Accepted values (float, int, qasymms8 or qasymmu8).",
+ "Accepted values (float, float16, int, qasymms8 or qasymmu8).",
cxxopts::value<std::string>())
("z,output-type",
"The type of the output tensors in the network separated by comma. "
"If unset, defaults to \"float\" for all defined outputs. "
- "Accepted values (float, int, qasymms8 or qasymmu8).",
+ "Accepted values (float, float16, int, qasymms8 or qasymmu8).",
cxxopts::value<std::string>())
("T,tflite-executor",