From cb8ac845da5a6297f7009e26df282a2bfd73f3b9 Mon Sep 17 00:00:00 2001 From: Aron Virginas-Tar Date: Fri, 5 Jul 2019 15:47:07 +0100 Subject: IVGCVSW-3301 Support PAD_V2 in HAL1.2 driver Signed-off-by: Aron Virginas-Tar Change-Id: If3da7b9015fb816bb27b85ab491102005859b3b0 --- 1.1/HalPolicy.cpp | 33 ++++----------------------------- 1 file changed, 4 insertions(+), 29 deletions(-) (limited to '1.1') diff --git a/1.1/HalPolicy.cpp b/1.1/HalPolicy.cpp index fc4c7a2c..0f00910f 100644 --- a/1.1/HalPolicy.cpp +++ b/1.1/HalPolicy.cpp @@ -270,48 +270,24 @@ bool HalPolicy::ConvertMean(const Operation& operation, const Model& model, Conv bool HalPolicy::ConvertPad(const Operation& operation, const Model& model, ConversionData& data) { LayerInputHandle input = ConvertToLayerInputHandle(operation, 0, model, data); - if (!input.IsValid()) { return Fail("%s: Operation has invalid inputs", __func__); } const armnn::TensorInfo& inputInfo = input.GetTensorInfo(); - - const Operand* paddingsOperand = GetInputOperand(operation, 1, model); - - if (!paddingsOperand) - { - return Fail("%s: Could not read paddings operand", __func__); - } - unsigned int rank = inputInfo.GetNumDimensions(); - armnn::TensorShape paddingsOperandShape = GetTensorShapeForOperand(*paddingsOperand); - if (paddingsOperandShape.GetNumDimensions() != 2 || paddingsOperandShape.GetNumElements() != rank * 2) - { - return Fail("%s: Operation has invalid paddings operand: expected shape [%d, 2]", __func__, rank); - } - - std::vector paddings; - GetTensorInt32Values(*paddingsOperand, paddings, model, data); - // add padding for each dimension of input tensor. armnn::PadDescriptor descriptor; - for (unsigned int i = 0; i < paddings.size() - 1; i += 2) + if (!ConvertPaddings(operation, model, data, rank, descriptor)) { - int paddingBeforeInput = paddings[i]; - int paddingAfterInput = paddings[i + 1]; - if (paddingBeforeInput < 0 || paddingAfterInput < 0) - { - return Fail("%s: Operation has invalid paddings operand, invalid padding values.", __func__); - } - descriptor.m_PadList.emplace_back((unsigned int) paddingBeforeInput, (unsigned int) paddingAfterInput); + return Fail("%s: Could not convert paddings", __func__); } const Operand* output = GetOutputOperand(operation, 0, model); if (!output) { - return Fail("%s: Could not read output 0", __func__); + return Fail("%s: Could not read output", __func__); } const armnn::TensorInfo& outputInfo = GetTensorInfoForOperand(*output); @@ -724,6 +700,5 @@ bool HalPolicy::ConvertBatchToSpaceNd(const Operation& operation, const Model& m return SetupAndTrackLayerOutputSlot(operation, 0, *layer, model, data); } - } // namespace hal_1_1 -} // namespace armnn_driver +} // namespace armnn_driver \ No newline at end of file -- cgit v1.2.1