From 67cc5fc08da79933361e7cd0af3b6452d2424a61 Mon Sep 17 00:00:00 2001 From: David Monahan Date: Wed, 3 Nov 2021 12:56:41 +0000 Subject: Revert "IVGCVSW-6359 Added support for Float16 (Half) to Execute Network" This reverts commit 2d9956162dd002a41f7fb4fa6753195d33524c7f. Reason for revert: After some discussion, this does technically implement Float16 support for ExecuteNetwork, but not in a way which matches most use cases and is likely to cause issues in the future. Reverting for now. Change-Id: I4ce6de6879216e694631f5dc68e46fb793fae0a9 --- include/armnnUtils/TContainer.hpp | 13 +++------- tests/ExecuteNetwork/ExecuteNetwork.cpp | 15 +---------- .../ExecuteNetworkProgramOptions.cpp | 4 +-- tests/InferenceTest.inl | 8 ------ .../NetworkExecutionUtils.cpp | 29 ---------------------- .../NetworkExecutionUtils.hpp | 2 -- 6 files changed, 7 insertions(+), 64 deletions(-) diff --git a/include/armnnUtils/TContainer.hpp b/include/armnnUtils/TContainer.hpp index d2a868ac18..a55f9df488 100644 --- a/include/armnnUtils/TContainer.hpp +++ b/include/armnnUtils/TContainer.hpp @@ -6,20 +6,15 @@ #pragma once #include -#include #include namespace armnnUtils { -// Standard declaration of TContainer used by ArmNN -// Changes to this declaration constitute an api/abi break, new types should be added as a separate declaration and -// merged on the next planned api/abi update. -using TContainer = mapbox::util::variant, - std::vector, - std::vector, - std::vector, - std::vector>; +// Standard definition of TContainer used by ArmNN, use this definition or add alternative definitions here instead of +// defining your own. + using TContainer = + mapbox::util::variant, std::vector, std::vector, std::vector>; } // namespace armnnUtils diff --git a/tests/ExecuteNetwork/ExecuteNetwork.cpp b/tests/ExecuteNetwork/ExecuteNetwork.cpp index 0d5271158b..a0a08d31b0 100644 --- a/tests/ExecuteNetwork/ExecuteNetwork.cpp +++ b/tests/ExecuteNetwork/ExecuteNetwork.cpp @@ -12,7 +12,6 @@ #include #include #include -#include #if defined(ARMNN_SERIALIZER) #include "armnnDeserializer/IDeserializer.hpp" @@ -485,7 +484,7 @@ int MainImpl(const ExecuteNetworkParams& params, armnn::DataType type = model.GetOutputBindingInfo(outputIdx).second.GetDataType(); switch (type) { - // --output-type only supports float, float16, int, qasymms8 or qasymmu8. + // --output-type only supports float, int, qasymms8 or qasymmu8. case armnn::DataType::Float32: if (params.m_OutputTypes[outputIdx].compare("float") != 0) { @@ -494,14 +493,6 @@ 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) { @@ -539,10 +530,6 @@ int MainImpl(const ExecuteNetworkParams& params, { outputDataContainers.push_back(std::vector(model.GetOutputSize(i))); } - else if (params.m_OutputTypes[i].compare("float16") == 0) - { - outputDataContainers.push_back(std::vector(model.GetOutputSize(i))); - } else if (params.m_OutputTypes[i].compare("int") == 0) { outputDataContainers.push_back(std::vector(model.GetOutputSize(i))); diff --git a/tests/ExecuteNetwork/ExecuteNetworkProgramOptions.cpp b/tests/ExecuteNetwork/ExecuteNetworkProgramOptions.cpp index 25dbe91455..8ee66cf64b 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, float16, int, qasymms8 or qasymmu8).", + "Accepted values (float, int, qasymms8 or qasymmu8).", cxxopts::value()) ("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, float16, int, qasymms8 or qasymmu8).", + "Accepted values (float, int, qasymms8 or qasymmu8).", cxxopts::value()) ("T,tflite-executor", diff --git a/tests/InferenceTest.inl b/tests/InferenceTest.inl index 94dbfe78b8..b6087c5e5a 100644 --- a/tests/InferenceTest.inl +++ b/tests/InferenceTest.inl @@ -67,14 +67,6 @@ struct ClassifierResultProcessor }); } - void operator()(const std::vector& values) - { - SortPredictions(values, [](armnn::Half value) - { - return value; - }); - } - void operator()(const std::vector& values) { SortPredictions(values, [](int8_t value) diff --git a/tests/NetworkExecutionUtils/NetworkExecutionUtils.cpp b/tests/NetworkExecutionUtils/NetworkExecutionUtils.cpp index 00ed55caaf..6c74aaa6ed 100644 --- a/tests/NetworkExecutionUtils/NetworkExecutionUtils.cpp +++ b/tests/NetworkExecutionUtils/NetworkExecutionUtils.cpp @@ -33,15 +33,6 @@ auto ParseDataArray(std::istream& stream) return ParseArrayImpl(stream, [](const std::string& s) { return std::stof(s); }); } -template<> -auto ParseDataArray(std::istream& stream) -{ - return ParseArrayImpl(stream, [](const std::string& s) - { - return armnn::Half(std::stof(s)); - }); -} - template<> auto ParseDataArray(std::istream& stream) { @@ -148,20 +139,6 @@ void TensorPrinter::operator()(const std::vector& values) WriteToFile(values); } -void TensorPrinter::operator()(const std::vector& values) -{ - if (m_PrintToConsole) - { - std::cout << m_OutputBinding << ": "; - ForEachValue(values, [](armnn::Half value) - { - printf("%f ", static_cast(value)); - }); - printf("\n"); - } - WriteToFile(values); -} - void TensorPrinter::operator()(const std::vector& values) { if(m_DequantizeOutput) @@ -284,12 +261,6 @@ void PopulateTensorWithData(armnnUtils::TContainer& tensorData, GenerateDummyTensorData(numElements); } } - else if (dataTypeStr.compare("float16") == 0) - { - tensorData = readFromFile ? - ParseDataArray(inputTensorFile) : - GenerateDummyTensorData(numElements); - } else if (dataTypeStr.compare("int") == 0) { tensorData = readFromFile ? diff --git a/tests/NetworkExecutionUtils/NetworkExecutionUtils.hpp b/tests/NetworkExecutionUtils/NetworkExecutionUtils.hpp index 8cd5c5b310..bc2868ab35 100644 --- a/tests/NetworkExecutionUtils/NetworkExecutionUtils.hpp +++ b/tests/NetworkExecutionUtils/NetworkExecutionUtils.hpp @@ -36,8 +36,6 @@ struct TensorPrinter void operator()(const std::vector& values); - void operator()(const std::vector& values); - private: template void ForEachValue(const Container& c, Delegate delegate); -- cgit v1.2.1