diff options
Diffstat (limited to 'src/backends/aclCommon/ArmComputeTensorUtils.cpp')
-rw-r--r-- | src/backends/aclCommon/ArmComputeTensorUtils.cpp | 27 |
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 |