IVGCVSW-4903 Connect axis parameter in Gather from android to ACL.
!android-nn-driver:3302
Signed-off-by: Teresa Charlin <teresa.charlinreyes@arm.com>
Change-Id: Ifbc49acb5272f8a36719bb68676e44817190537d
diff --git a/src/armnnTfParser/TfParser.cpp b/src/armnnTfParser/TfParser.cpp
index 7a7c5a4..38202fc 100755
--- a/src/armnnTfParser/TfParser.cpp
+++ b/src/armnnTfParser/TfParser.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
//
@@ -1853,6 +1853,8 @@
std::vector<OutputOfParsedTfOperation> inputs = GetInputParsedTfOperationsChecked(nodeDef, 2);
IOutputSlot& params = inputs[0].m_IndexedValue->ResolveArmnnOutputSlot(inputs[0].m_Index);
IOutputSlot& indices = inputs[1].m_IndexedValue->ResolveArmnnOutputSlot(inputs[1].m_Index);
+ GatherDescriptor descriptor;
+ descriptor.m_Axis = ReadMandatoryNodeInt32Attribute(nodeDef, "axis");
// Infer shape of output tensor
unsigned int paramsDim = params.GetTensorInfo().GetNumDimensions();
@@ -1874,7 +1876,7 @@
const TensorInfo inferredOutputInfo(inferredShape, params.GetTensorInfo().GetDataType());
- IConnectableLayer* const layer = m_Network->AddGatherLayer(nodeDef.name().c_str());
+ IConnectableLayer* const layer = m_Network->AddGatherLayer(descriptor, nodeDef.name().c_str());
layer->GetOutputSlot(0).SetTensorInfo(inferredOutputInfo);
params.Connect(layer->GetInputSlot(0));
diff --git a/src/armnnTfParser/test/Gather.cpp b/src/armnnTfParser/test/Gather.cpp
index 8c4b891..ab5fb71 100644
--- a/src/armnnTfParser/test/Gather.cpp
+++ b/src/armnnTfParser/test/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
//
@@ -38,7 +38,8 @@
const armnn::TensorShape& inputShape1,
const std::vector<int>& input1Content,
const std::vector<int>& input0Dims,
- const std::vector<int>& input1Dims)
+ const std::vector<int>& input1Dims,
+ int axis = 0)
{
m_Prototext = R"(
node {
@@ -56,6 +57,7 @@
shape {
)";
dimsHelper(input0Dims, m_Prototext);
+
m_Prototext.append(R"(
}
}
@@ -78,6 +80,7 @@
tensor_shape {
)");
dimsHelper(input1Dims, m_Prototext);
+
m_Prototext.append(R"(
}
tensor_content: ")");
@@ -104,8 +107,18 @@
type: DT_FLOAT
}
}
+ attr {
+ key: "axis"
+ value {
+ i: )");
+ m_Prototext += std::to_string(axis);
+
+ m_Prototext.append(R"(
+ }
+ }
}
)");
+
Setup({ { "input0", inputShape0 },
{ "input1", inputShape1 } },
{ "output" });
@@ -121,7 +134,8 @@
{ 4, 0, 0, 0 },
{ 0, 2, 1, 3 },
{ 4 },
- { 4 }) {}
+ { 4 },
+ 0) {}
};
struct GatherFixture1DParamsMultiDimIndices : public GatherFixture
@@ -131,7 +145,8 @@
{ 2, 2, 1, 1 },
{ 0, 1, 1, 3 },
{ 4 },
- { 2, 2 }) {}
+ { 2, 2 },
+ 0) {}
};
struct GatherFixtureMultiDimParamMultiDimIndices : public GatherFixture
@@ -141,7 +156,8 @@
{ 2, 1, 4 },
{ 1, 3, 0, 2 },
{ 5, 2 },
- { 2, 2 }) {}
+ { 2, 2 },
+ 0) {}
};
BOOST_FIXTURE_TEST_CASE(ParseGather1DParams1DIndices, GatherFixture1DParams1DIndices)