diff options
author | Aron Virginas-Tar <Aron.Virginas-Tar@arm.com> | 2019-07-16 11:32:29 +0100 |
---|---|---|
committer | Áron Virginás-Tar <aron.virginas-tar@arm.com> | 2019-07-16 13:31:47 +0000 |
commit | be5d356c1663009c69c934fd860db1f91863e3d1 (patch) | |
tree | 603c9b744147c6875998beadb931afec00e8d3a9 /1.2/HalPolicy.cpp | |
parent | 9fd373954d64fbae72d1726bbdfc57a18a3a2f6d (diff) | |
download | android-nn-driver-be5d356c1663009c69c934fd860db1f91863e3d1.tar.gz |
IVGCVSW-3522 Support dynamic output shape in hal_1_2::HalPolicy::ConvertResize
Signed-off-by: Aron Virginas-Tar <Aron.Virginas-Tar@arm.com>
Change-Id: I962f9759679f539566f7bc3aa75ed3e0bffe7c9f
Diffstat (limited to '1.2/HalPolicy.cpp')
-rw-r--r-- | 1.2/HalPolicy.cpp | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/1.2/HalPolicy.cpp b/1.2/HalPolicy.cpp index 0c57636c..5b501dbc 100644 --- a/1.2/HalPolicy.cpp +++ b/1.2/HalPolicy.cpp @@ -727,7 +727,7 @@ bool HalPolicy::ConvertResize(const Operation& operation, } const armnn::TensorInfo& inputInfo = input.GetTensorInfo(); - const armnn::TensorInfo& outputInfo = GetTensorInfoForOperand(*output); + armnn::TensorInfo outputInfo = GetTensorInfoForOperand(*output); armnn::ResizeDescriptor descriptor; descriptor.m_Method = resizeMethod; @@ -795,6 +795,19 @@ bool HalPolicy::ConvertResize(const Operation& operation, return false; } + if (IsDynamicOutput(outputInfo)) + { + try + { + ALOGD("Output shape not set, will infer from inputs"); + outputInfo.SetShape(InferResizeOutputShape(inputInfo.GetShape(), descriptor)); + } + catch (armnn::Exception& e) + { + return Fail("%s: Could not infer dynamic output shape: %s", __func__, e.what()); + } + } + bool isSupported = false; FORWARD_LAYER_SUPPORT_FUNC(__func__, IsResizeSupported, @@ -803,6 +816,7 @@ bool HalPolicy::ConvertResize(const Operation& operation, inputInfo, outputInfo, descriptor); + if (!isSupported) { return false; @@ -815,7 +829,12 @@ bool HalPolicy::ConvertResize(const Operation& operation, layer->GetOutputSlot(0).SetTensorInfo(outputInfo); input.Connect(layer->GetInputSlot(0)); - return SetupAndTrackLayerOutputSlot<hal_1_2::HalPolicy>(operation, 0, *layer, model, data); + return SetupAndTrackLayerOutputSlot<hal_1_2::HalPolicy>(operation, + 0, + *layer, + model, + data, + armnn::Optional<armnn::TensorInfo>(outputInfo)); } bool HalPolicy::ConvertSpaceToDepth(const Operation& operation, const Model& model, ConversionData& data) |