From 03181ff73f4b37d2132f15c4bd229a148840cc15 Mon Sep 17 00:00:00 2001 From: Ryan OShea Date: Fri, 7 Feb 2020 17:22:22 +0000 Subject: IVGCVSW-4409 Fix TfLiteParser to handle all datatypes correctly * Added check for QAsymmS8 datatype for Per-Tensor quantization Signed-off-by: Ryan OShea Change-Id: I902aa3863dd5cefdce90e68be8a5750dd6ff9e54 --- src/armnnTfLiteParser/TfLiteParser.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/armnnTfLiteParser/TfLiteParser.cpp b/src/armnnTfLiteParser/TfLiteParser.cpp index 10bb0f6e97..560cdf1779 100644 --- a/src/armnnTfLiteParser/TfLiteParser.cpp +++ b/src/armnnTfLiteParser/TfLiteParser.cpp @@ -315,7 +315,14 @@ armnn::TensorInfo ToTensorInfo(TfLiteParser::TensorRawPtr tensorPtr, const std:: type = armnn::DataType::Float32; break; case tflite::TensorType_INT8: - type = armnn::DataType::QSymmS8; + if (tensorPtr->quantization->zero_point.size() == 1 && tensorPtr->quantization->zero_point[0] != 0) + { + type = armnn::DataType::QAsymmS8; + } + else + { + type = armnn::DataType::QSymmS8; + } break; case tflite::TensorType_INT16: type = armnn::DataType::QSymmS16; @@ -359,7 +366,7 @@ armnn::TensorInfo ToTensorInfo(TfLiteParser::TensorRawPtr tensorPtr, const std:: if (tensorPtr->quantization->zero_point.size() == 1) { // NOTE: we lose precision here when converting from 64 bit to 32 - // but this is what we support at the monent in ArmNN + // but this is what we support at the moment in ArmNN quantizationOffset = boost::numeric_cast(tensorPtr->quantization->zero_point[0]); } -- cgit v1.2.1