aboutsummaryrefslogtreecommitdiff
path: root/delegate/classic/src/Quantization.hpp
diff options
context:
space:
mode:
authorMike Kelly <mike.kelly@arm.com>2023-11-10 17:11:53 +0000
committermike.kelly <mike.kelly@arm.com>2023-11-13 12:47:33 +0000
commit080d45d73c03830cb80b223fd64c546e84d8337a (patch)
tree326f65ad6e1952aa308824331e36330a9b440140 /delegate/classic/src/Quantization.hpp
parent21a9f33338c60ae1cd955df220ce329918adcb8f (diff)
downloadarmnn-080d45d73c03830cb80b223fd64c546e84d8337a.tar.gz
MLCE-1138 Issue with Delegate supporting FP16 models
* Fixed issue where backends were asked to support FP16 layers that would be optimized out. * Fixed issue where backends were asked to support non-constant filter and bias tensors when those tensors would be replaced by constant tensors during optimization. Signed-off-by: Mike Kelly <mike.kelly@arm.com> Change-Id: Ib54b9cb99d5014e27172841a665daf57d1d5b23d
Diffstat (limited to 'delegate/classic/src/Quantization.hpp')
-rw-r--r--delegate/classic/src/Quantization.hpp27
1 files changed, 17 insertions, 10 deletions
diff --git a/delegate/classic/src/Quantization.hpp b/delegate/classic/src/Quantization.hpp
index 8291854383..7fcb9c7c44 100644
--- a/delegate/classic/src/Quantization.hpp
+++ b/delegate/classic/src/Quantization.hpp
@@ -23,7 +23,6 @@ TfLiteStatus VisitDequantizeOperator(DelegateData& delegateData,
{
TF_LITE_ENSURE_STATUS(ValidateNumInputs(tfLiteContext, tfLiteNode, 1, nodeIndex));
TF_LITE_ENSURE_STATUS(ValidateNumOutputs(tfLiteContext, tfLiteNode, 1, nodeIndex));
-
const TfLiteTensor* tfLiteTensors = tfLiteContext->tensors;
const TfLiteTensor& tfLiteInputTensor = tfLiteTensors[tfLiteNode->inputs->data[0]];
if (IsDynamicTensor(tfLiteInputTensor))
@@ -34,7 +33,6 @@ TfLiteStatus VisitDequantizeOperator(DelegateData& delegateData,
tfLiteDequantizeOperatorCode, nodeIndex);
return kTfLiteError;
}
-
const TfLiteTensor& tfLiteOutputTensor = tfLiteTensors[tfLiteNode->outputs->data[0]];
if (IsDynamicTensor(tfLiteOutputTensor))
{
@@ -54,14 +52,23 @@ TfLiteStatus VisitDequantizeOperator(DelegateData& delegateData,
armnn::BackendId setBackend;
auto validateFunc = [&](const armnn::TensorInfo& outputTensorInfo, bool& isSupported)
{
- FORWARD_LAYER_SUPPORT_FUNC("DEQUANTIZE",
- tfLiteContext,
- IsDequantizeSupported,
- delegateData.m_Backends,
- isSupported,
- setBackend,
- inputTensorInfo,
- outputTensorInfo);
+ // If this is a Dequantize with a Constant input then will be replaced by a Constant layer that contains the
+ // dequantized values during optimization so there's no need to check if it can be supported by the backend
+ if (tflite::IsConstantTensor(&tfLiteInputTensor))
+ {
+ isSupported = true;
+ }
+ else
+ {
+ FORWARD_LAYER_SUPPORT_FUNC("DEQUANTIZE",
+ tfLiteContext,
+ IsDequantizeSupported,
+ delegateData.m_Backends,
+ isSupported,
+ setBackend,
+ inputTensorInfo,
+ outputTensorInfo);
+ }
};
if (!delegateData.m_Network)