aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Davis <keith.davis@arm.com>2019-12-19 12:31:30 +0000
committerKeith Davis <keith.davis@arm.com>2019-12-19 12:31:30 +0000
commitd410b60213be72e0f9e12ce939403ba90056562f (patch)
tree8356b3d4ba81eba4bdc3430f24c1dc64fac49b8d
parent972603fb38e2f5a75b2389bd8a265b6e3173a02f (diff)
downloadandroid-nn-driver-d410b60213be72e0f9e12ce939403ba90056562f.tar.gz
IVGCVSW-4181 Add RESIZE_NEAREST_NEIGHBOUR to the android_nn_driver
* Add FP16 support Signed-off-by: Keith Davis <keith.davis@arm.com> Change-Id: I59a2862c734aa3678f19cc47f024f8cb92fb557e
-rw-r--r--1.2/HalPolicy.cpp23
1 files 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<HalPolicy>(operation, 1, HalPolicy::OperandType::FLOAT16, widthScale, model, data) ||
+ !GetInputScalar<HalPolicy>(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<Half>(inputShape[dataLayoutIndexed.GetWidthIndex()]);
+ Half height = static_cast<Half>(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;