diff options
author | Aron Virginas-Tar <Aron.Virginas-Tar@arm.com> | 2019-07-09 17:44:24 +0100 |
---|---|---|
committer | Áron Virginás-Tar <aron.virginas-tar@arm.com> | 2019-07-09 16:55:01 +0000 |
commit | f03fcf0dd180ba2c87648a524fcca9214e1f979b (patch) | |
tree | 99eb4643dec16db121b8702a4829f9c8323f5b45 /1.2/HalPolicy.cpp | |
parent | 177fa0ba936eaf9de96f04bb91aa51d7656dd655 (diff) | |
download | android-nn-driver-f03fcf0dd180ba2c87648a524fcca9214e1f979b.tar.gz |
IVGCVSW-3456 Add support for dynamic output shape in ConvertPrelu
Signed-off-by: Aron Virginas-Tar <Aron.Virginas-Tar@arm.com>
Change-Id: I8fc7a716455be3f51b51177f6896a73790a41fc3
Diffstat (limited to '1.2/HalPolicy.cpp')
-rw-r--r-- | 1.2/HalPolicy.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/1.2/HalPolicy.cpp b/1.2/HalPolicy.cpp index fe0cfbdc..b194a57a 100644 --- a/1.2/HalPolicy.cpp +++ b/1.2/HalPolicy.cpp @@ -5,6 +5,8 @@ #include "HalPolicy.hpp" +#include "OutputShapeUtils.hpp" + #include "../1.0/HalPolicy.hpp" #include "../1.1/HalPolicy.hpp" @@ -539,7 +541,13 @@ bool HalPolicy::ConvertPrelu(const Operation& operation, const Model& model, Con const armnn::TensorInfo& inputInfo = input.GetTensorInfo(); const armnn::TensorInfo& alphaInfo = alpha.GetTensorInfo(); - const armnn::TensorInfo& outputInfo = GetTensorInfoForOperand(*output); + + armnn::TensorInfo outputInfo = GetTensorInfoForOperand(*output); + if (outputInfo.GetNumElements() == 0u) + { + ALOGD("Output shape not set, will infer from inputs"); + outputInfo.SetShape(InferPreluOutputShape(inputInfo.GetShape(), alphaInfo.GetShape())); + } if (!IsLayerSupportedForAnyBackend(__func__, armnn::IsPreluSupported, @@ -560,7 +568,12 @@ bool HalPolicy::ConvertPrelu(const Operation& operation, const Model& model, Con BroadcastTensor(input, alpha, layer, *data.m_Network); - 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::ConvertResize(const Operation& operation, |