From d410b60213be72e0f9e12ce939403ba90056562f Mon Sep 17 00:00:00 2001 From: Keith Davis Date: Thu, 19 Dec 2019 12:31:30 +0000 Subject: IVGCVSW-4181 Add RESIZE_NEAREST_NEIGHBOUR to the android_nn_driver * Add FP16 support Signed-off-by: Keith Davis Change-Id: I59a2862c734aa3678f19cc47f024f8cb92fb557e --- 1.2/HalPolicy.cpp | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/1.2/HalPolicy.cpp b/1.2/HalPolicy.cpp index ac78e96b..ddd85d9b 100644 --- a/1.2/HalPolicy.cpp +++ b/1.2/HalPolicy.cpp @@ -1887,10 +1887,29 @@ bool HalPolicy::ConvertResize(const Operation& operation, descriptor.m_TargetWidth = std::floor(width * widthScale); descriptor.m_TargetHeight = std::floor(height * heightScale); } + else if (operandType1 == OperandType::FLOAT16) + { + Half widthScale; + Half heightScale; + + if (!GetInputScalar(operation, 1, HalPolicy::OperandType::FLOAT16, widthScale, model, data) || + !GetInputScalar(operation, 2, HalPolicy::OperandType::FLOAT16, heightScale, model, data)) + { + return Fail("%s: Operation has invalid inputs for resizing by scale", __func__); + } + + const TensorShape& inputShape = inputInfo.GetShape(); + armnnUtils::DataLayoutIndexed dataLayoutIndexed(descriptor.m_DataLayout); + + Half width = static_cast(inputShape[dataLayoutIndexed.GetWidthIndex()]); + Half height = static_cast(inputShape[dataLayoutIndexed.GetHeightIndex()]); + + descriptor.m_TargetWidth = std::floor(width * widthScale); + descriptor.m_TargetHeight = std::floor(height * heightScale); + } else { - // NOTE: FLOAT16 scales are not supported - return false; + return Fail("%s: Operand has invalid data type for resizing by scale", __func__); } bool isSupported = false; -- cgit v1.2.1