From 526647333571169076f5e72c9fb18c71025bf7c0 Mon Sep 17 00:00:00 2001 From: Teresa Charlin Date: Mon, 29 Jun 2020 16:27:03 +0100 Subject: IVGCVSW-4903 Connect axis parameter in Gather from android to ACL. !android-nn-driver:3302 Signed-off-by: Teresa Charlin Change-Id: Ifbc49acb5272f8a36719bb68676e44817190537d --- src/backends/reference/RefLayerSupport.cpp | 8 +++++++- src/backends/reference/RefLayerSupport.hpp | 4 ++-- src/backends/reference/workloads/Gather.cpp | 7 +++++-- src/backends/reference/workloads/Gather.hpp | 5 +++-- src/backends/reference/workloads/RefGatherWorkload.cpp | 4 ++-- 5 files changed, 19 insertions(+), 9 deletions(-) (limited to 'src/backends/reference') diff --git a/src/backends/reference/RefLayerSupport.cpp b/src/backends/reference/RefLayerSupport.cpp index 18b36a5fa8..696c6d9dac 100644 --- a/src/backends/reference/RefLayerSupport.cpp +++ b/src/backends/reference/RefLayerSupport.cpp @@ -1,5 +1,5 @@ // -// Copyright © 2017 Arm Ltd. All rights reserved. +// Copyright © 2017 Arm Ltd and Contributors. All rights reserved. // SPDX-License-Identifier: MIT // @@ -987,6 +987,7 @@ bool RefLayerSupport::IsFullyConnectedSupported(const TensorInfo& input, bool RefLayerSupport::IsGatherSupported(const armnn::TensorInfo& input0, const armnn::TensorInfo& input1, const armnn::TensorInfo& output, + const GatherDescriptor& descriptor, armnn::Optional reasonIfUnsupported) const { bool supported = true; @@ -1001,6 +1002,11 @@ bool RefLayerSupport::IsGatherSupported(const armnn::TensorInfo& input0, DataType::Signed32 }; + if (descriptor.m_Axis != 0) + { + reasonIfUnsupported.value() += std::string("Reference Gather: axis not supported\n"); + supported &= false; + } supported &= CheckSupportRule(TypeAnyOf(input0, supportedTypes), reasonIfUnsupported, "Reference Gather: input type not supported"); diff --git a/src/backends/reference/RefLayerSupport.hpp b/src/backends/reference/RefLayerSupport.hpp index 96bff56a42..7d2bbf240e 100644 --- a/src/backends/reference/RefLayerSupport.hpp +++ b/src/backends/reference/RefLayerSupport.hpp @@ -1,5 +1,5 @@ // -// Copyright © 2017 Arm Ltd. All rights reserved. +// Copyright © 2017 Arm Ltd and Contributors. All rights reserved. // SPDX-License-Identifier: MIT // #pragma once @@ -160,6 +160,7 @@ public: bool IsGatherSupported(const TensorInfo& input0, const TensorInfo& input1, const TensorInfo& output, + const GatherDescriptor& descriptor, Optional reasonIfUnsupported = EmptyOptional()) const override; ARMNN_DEPRECATED_MSG("Use IsComparisonSupported instead") @@ -346,7 +347,6 @@ public: const TensorInfo& output, const TransposeDescriptor& descriptor, Optional reasonIfUnsupported = EmptyOptional()) const override; - }; } // namespace armnn diff --git a/src/backends/reference/workloads/Gather.cpp b/src/backends/reference/workloads/Gather.cpp index c23edcd3bd..3e2190c81b 100644 --- a/src/backends/reference/workloads/Gather.cpp +++ b/src/backends/reference/workloads/Gather.cpp @@ -1,5 +1,5 @@ // -// Copyright © 2017 Arm Ltd. All rights reserved. +// Copyright © 2017 Arm Ltd and Contributors. All rights reserved. // SPDX-License-Identifier: MIT // @@ -20,9 +20,12 @@ void Gather(const TensorInfo& paramsInfo, const TensorInfo& outputInfo, Decoder& params, const int32_t* indices, - Encoder& output) + Encoder& output, + const int32_t axis) { IgnoreUnused(outputInfo); + IgnoreUnused(axis); + const TensorShape& paramsShape = paramsInfo.GetShape(); unsigned int paramsProduct = 1; diff --git a/src/backends/reference/workloads/Gather.hpp b/src/backends/reference/workloads/Gather.hpp index 16c983eec4..1550f4b97c 100644 --- a/src/backends/reference/workloads/Gather.hpp +++ b/src/backends/reference/workloads/Gather.hpp @@ -1,5 +1,5 @@ // -// Copyright © 2017 Arm Ltd. All rights reserved. +// Copyright © 2017 Arm Ltd and Contributors. All rights reserved. // SPDX-License-Identifier: MIT // @@ -19,6 +19,7 @@ void Gather(const TensorInfo& paramsInfo, const TensorInfo& outputInfo, Decoder& params, const int32_t* indices, - Encoder& output); + Encoder& output, + const int32_t = 0); } //namespace armnn diff --git a/src/backends/reference/workloads/RefGatherWorkload.cpp b/src/backends/reference/workloads/RefGatherWorkload.cpp index 8edf14c8f8..eaeed61b0a 100644 --- a/src/backends/reference/workloads/RefGatherWorkload.cpp +++ b/src/backends/reference/workloads/RefGatherWorkload.cpp @@ -1,5 +1,5 @@ // -// Copyright © 2017 Arm Ltd. All rights reserved. +// Copyright © 2017 Arm Ltd and Contributors. All rights reserved. // SPDX-License-Identifier: MIT // @@ -29,7 +29,7 @@ void RefGatherWorkload::Execute() const std::unique_ptr> encoderPtr = MakeEncoder(outputInfo, m_Data.m_Outputs[0]->Map()); Encoder& encoder = *encoderPtr; - Gather(inputInfo0, inputInfo1, outputInfo, decoder, indicesData, encoder); + Gather(inputInfo0, inputInfo1, outputInfo, decoder, indicesData, encoder, m_Data.m_Parameters.m_Axis); } } //namespace armnn -- cgit v1.2.1