From f806c4d075814a9dc9d206a4db123d3060ad7ebd Mon Sep 17 00:00:00 2001 From: Finn Williams Date: Mon, 22 Feb 2021 15:13:12 +0000 Subject: IVGCVSW-5612 Fix tiny_wav2letter_relu_fixed_int8 delegate output * fix delegate perchannel quantization * change delegate to check reshape options before inputs * Add int8 "qsymms8" option to ExecuteNetwork * Add option to run ExecuteNetwork on tflite w/o delegate !referencetests:301301 Signed-off-by: Finn Williams Change-Id: If3e12599b17aff1199d7ab0a55e1c901e480083d --- .../NetworkExecutionUtils.cpp | 28 +++++++++++++++++++++- .../NetworkExecutionUtils.hpp | 5 +++- 2 files changed, 31 insertions(+), 2 deletions(-) (limited to 'tests/NetworkExecutionUtils') diff --git a/tests/NetworkExecutionUtils/NetworkExecutionUtils.cpp b/tests/NetworkExecutionUtils/NetworkExecutionUtils.cpp index 2afd941636..d902d23d86 100644 --- a/tests/NetworkExecutionUtils/NetworkExecutionUtils.cpp +++ b/tests/NetworkExecutionUtils/NetworkExecutionUtils.cpp @@ -52,6 +52,16 @@ auto ParseDataArray(std::istream& stream) [](const std::string& s) { return armnn::numeric_cast(std::stoi(s)); }); } + +template<> +auto ParseDataArray(std::istream& stream) +{ + return ParseArrayImpl(stream, + [](const std::string& s) { return armnn::numeric_cast(std::stoi(s)); }); +} + + + template<> auto ParseDataArray(std::istream& stream, const float& quantizationScale, @@ -130,6 +140,15 @@ void TensorPrinter::operator()(const std::vector& values) } } +void TensorPrinter::operator()(const std::vector& values) +{ + ForEachValue(values, [](int8_t value) + { + printf("%d ", value); + }); + WriteToFile(values); +} + void TensorPrinter::operator()(const std::vector& values) { ForEachValue(values, [](int value) @@ -170,7 +189,8 @@ void TensorPrinter::WriteToFile(const std::vector& values) } } -using TContainer = mapbox::util::variant, std::vector, std::vector>; +using TContainer = + mapbox::util::variant, std::vector, std::vector, std::vector>; using QuantizationParams = std::pair; void PopulateTensorWithData(TContainer& tensorData, @@ -212,6 +232,12 @@ void PopulateTensorWithData(TContainer& tensorData, ParseDataArray(inputTensorFile) : GenerateDummyTensorData(numElements); } + else if (dataTypeStr.compare("qsymms8") == 0) + { + tensorData = readFromFile ? + ParseDataArray(inputTensorFile) : + GenerateDummyTensorData(numElements); + } else if (dataTypeStr.compare("qasymm8") == 0) { tensorData = readFromFile ? diff --git a/tests/NetworkExecutionUtils/NetworkExecutionUtils.hpp b/tests/NetworkExecutionUtils/NetworkExecutionUtils.hpp index 742f968a7a..d92c17c5e5 100644 --- a/tests/NetworkExecutionUtils/NetworkExecutionUtils.hpp +++ b/tests/NetworkExecutionUtils/NetworkExecutionUtils.hpp @@ -34,6 +34,8 @@ struct TensorPrinter void operator()(const std::vector& values); + void operator()(const std::vector& values); + private: template void ForEachValue(const Container& c, Delegate delegate); @@ -48,7 +50,8 @@ private: bool m_DequantizeOutput; }; -using TContainer = mapbox::util::variant, std::vector, std::vector>; +using TContainer = + mapbox::util::variant, std::vector, std::vector, std::vector>; using QuantizationParams = std::pair; void PopulateTensorWithData(TContainer& tensorData, -- cgit v1.2.1