aboutsummaryrefslogtreecommitdiff
path: root/src/backends/aclCommon/ArmComputeTensorUtils.cpp
diff options
context:
space:
mode:
authorAron Virginas-Tar <Aron.Virginas-Tar@arm.com>2019-11-27 14:48:32 +0000
committerAron Virginas-Tar <Aron.Virginas-Tar@arm.com>2019-11-27 15:53:04 +0000
commit710f664e41803bcb04403a1da27990d76faab6cf (patch)
tree9ede03e7fcb322c4df1c6ccf0c46f1913844c9ac /src/backends/aclCommon/ArmComputeTensorUtils.cpp
parent899f64f711fdac95d88795f4e88f7770c0cb94be (diff)
downloadarmnn-710f664e41803bcb04403a1da27990d76faab6cf.tar.gz
IVGCVSW-4148 Extend reporting of quant multiplier > 1 as unsupported on ACL to per-axis case
Signed-off-by: Aron Virginas-Tar <Aron.Virginas-Tar@arm.com> Change-Id: I66a8360b6d86e95325dee58927dcbe62ccf6ad58
Diffstat (limited to 'src/backends/aclCommon/ArmComputeTensorUtils.cpp')
-rw-r--r--src/backends/aclCommon/ArmComputeTensorUtils.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/backends/aclCommon/ArmComputeTensorUtils.cpp b/src/backends/aclCommon/ArmComputeTensorUtils.cpp
index e4fdb21ecc..328a083ae9 100644
--- a/src/backends/aclCommon/ArmComputeTensorUtils.cpp
+++ b/src/backends/aclCommon/ArmComputeTensorUtils.cpp
@@ -232,5 +232,32 @@ arm_compute::PixelValue GetPixelValue(arm_compute::ITensor& input, float pixelVa
}
}
+bool IsQuantMultiplierSupported(const TensorInfo& input,
+ const TensorInfo& output,
+ const TensorInfo& weights)
+{
+ constexpr float maxQuantMultiplier = 1.0f;
+ if (weights.HasMultipleQuantizationScales())
+ {
+ for (float weightScale : weights.GetQuantizationScales())
+ {
+ if ((input.GetQuantizationScale() * weightScale) / output.GetQuantizationScale() > maxQuantMultiplier)
+ {
+ return false;
+ }
+ }
+ }
+ else
+ {
+ if ((input.GetQuantizationScale() * weights.GetQuantizationScale()) /
+ output.GetQuantizationScale() > maxQuantMultiplier)
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
+
} // namespace armcomputetensorutils
} // namespace armnn