From fd627ffaec8fd8801d980b4c91ee7c0607ab6aaf Mon Sep 17 00:00:00 2001 From: Jan Eilers Date: Thu, 25 Feb 2021 17:44:00 +0000 Subject: IVGCVSW-5687 Update Doxygen Docu * Update Doxygen Documentation for 21.02 release Signed-off-by: Jan Eilers Change-Id: I9ed2f9caab038836ea99d7b378d7899fe431a4e5 --- .../_gather_end_to_end_test_impl_8hpp_source.xhtml | 126 +++++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 21.02/_gather_end_to_end_test_impl_8hpp_source.xhtml (limited to '21.02/_gather_end_to_end_test_impl_8hpp_source.xhtml') diff --git a/21.02/_gather_end_to_end_test_impl_8hpp_source.xhtml b/21.02/_gather_end_to_end_test_impl_8hpp_source.xhtml new file mode 100644 index 0000000000..0bfc498f3c --- /dev/null +++ b/21.02/_gather_end_to_end_test_impl_8hpp_source.xhtml @@ -0,0 +1,126 @@ + + + + + + + + + + + + + +ArmNN: src/backends/backendsCommon/test/GatherEndToEndTestImpl.hpp Source File + + + + + + + + + + + + + + + + +
+
+ + + + ArmNN + + + +
+
+  21.02 +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
GatherEndToEndTestImpl.hpp
+
+
+Go to the documentation of this file.
1 //
2 // Copyright © 2017 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #pragma once
7 
8 #include "CommonTestUtils.hpp"
9 
10 #include <armnn/INetwork.hpp>
11 #include <ResolveType.hpp>
12 
13 namespace{
14 
15 armnn::INetworkPtr CreateGatherNetwork(const armnn::TensorInfo& paramsInfo,
16  const armnn::TensorInfo& indicesInfo,
17  const armnn::TensorInfo& outputInfo,
18  const std::vector<int32_t>& indicesData)
19 {
21 
22  armnn::GatherDescriptor descriptor;
23  armnn::IConnectableLayer* paramsLayer = net->AddInputLayer(0);
24  armnn::IConnectableLayer* indicesLayer = net->AddConstantLayer(armnn::ConstTensor(indicesInfo, indicesData));
25  armnn::IConnectableLayer* gatherLayer = net->AddGatherLayer(descriptor, "gather");
26  armnn::IConnectableLayer* outputLayer = net->AddOutputLayer(0, "output");
27  Connect(paramsLayer, gatherLayer, paramsInfo, 0, 0);
28  Connect(indicesLayer, gatherLayer, indicesInfo, 0, 1);
29  Connect(gatherLayer, outputLayer, outputInfo, 0, 0);
30 
31  return net;
32 }
33 
34 template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
35 void GatherEndToEnd(const std::vector<BackendId>& backends)
36 {
37  armnn::TensorInfo paramsInfo({ 8 }, ArmnnType);
38  armnn::TensorInfo indicesInfo({ 3 }, armnn::DataType::Signed32);
39  armnn::TensorInfo outputInfo({ 3 }, ArmnnType);
40 
41  paramsInfo.SetQuantizationScale(1.0f);
42  paramsInfo.SetQuantizationOffset(0);
43  outputInfo.SetQuantizationScale(1.0f);
44  outputInfo.SetQuantizationOffset(0);
45 
46  // Creates structures for input & output.
47  std::vector<T> paramsData{
48  1, 2, 3, 4, 5, 6, 7, 8
49  };
50 
51  std::vector<int32_t> indicesData{
52  7, 6, 5
53  };
54 
55  std::vector<T> expectedOutput{
56  8, 7, 6
57  };
58 
59  // Builds up the structure of the network
60  armnn::INetworkPtr net = CreateGatherNetwork(paramsInfo, indicesInfo, outputInfo, indicesData);
61 
62  BOOST_TEST_CHECKPOINT("create a network");
63 
64  std::map<int, std::vector<T>> inputTensorData = {{ 0, paramsData }};
65  std::map<int, std::vector<T>> expectedOutputData = {{ 0, expectedOutput }};
66 
67  EndToEndLayerTestImpl<ArmnnType, ArmnnType>(move(net), inputTensorData, expectedOutputData, backends);
68 }
69 
70 template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
71 void GatherMultiDimEndToEnd(const std::vector<BackendId>& backends)
72 {
73  armnn::TensorInfo paramsInfo({ 3, 2, 3}, ArmnnType);
74  armnn::TensorInfo indicesInfo({ 2, 3 }, armnn::DataType::Signed32);
75  armnn::TensorInfo outputInfo({ 2, 3, 2, 3 }, ArmnnType);
76 
77  paramsInfo.SetQuantizationScale(1.0f);
78  paramsInfo.SetQuantizationOffset(0);
79  outputInfo.SetQuantizationScale(1.0f);
80  outputInfo.SetQuantizationOffset(0);
81 
82  // Creates structures for input & output.
83  std::vector<T> paramsData{
84  1, 2, 3,
85  4, 5, 6,
86 
87  7, 8, 9,
88  10, 11, 12,
89 
90  13, 14, 15,
91  16, 17, 18
92  };
93 
94  std::vector<int32_t> indicesData{
95  1, 2, 1,
96  2, 1, 0
97  };
98 
99  std::vector<T> expectedOutput{
100  7, 8, 9,
101  10, 11, 12,
102  13, 14, 15,
103  16, 17, 18,
104  7, 8, 9,
105  10, 11, 12,
106 
107  13, 14, 15,
108  16, 17, 18,
109  7, 8, 9,
110  10, 11, 12,
111  1, 2, 3,
112  4, 5, 6
113  };
114 
115  // Builds up the structure of the network
116  armnn::INetworkPtr net = CreateGatherNetwork(paramsInfo, indicesInfo, outputInfo, indicesData);
117 
118  BOOST_TEST_CHECKPOINT("create a network");
119 
120  std::map<int, std::vector<T>> inputTensorData = {{ 0, paramsData }};
121  std::map<int, std::vector<T>> expectedOutputData = {{ 0, expectedOutput }};
122 
123  EndToEndLayerTestImpl<ArmnnType, ArmnnType>(move(net), inputTensorData, expectedOutputData, backends);
124 }
125 
126 } // anonymous namespace
Interface for a layer that is connectable to other layers via InputSlots and OutputSlots.
Definition: INetwork.hpp:62
+ + + + +
A tensor defined by a TensorInfo (shape and data type) and an immutable backing store.
Definition: Tensor.hpp:314
+
A GatherDescriptor for the GatherLayer.
+
void SetQuantizationScale(float scale)
Definition: Tensor.cpp:464
+ +
void SetQuantizationOffset(int32_t offset)
Definition: Tensor.cpp:480
+
void Connect(armnn::IConnectableLayer *from, armnn::IConnectableLayer *to, const armnn::TensorInfo &tensorInfo, unsigned int fromIndex, unsigned int toIndex)
Definition: TestUtils.cpp:12
+
std::unique_ptr< INetwork, void(*)(INetwork *network)> INetworkPtr
Definition: INetwork.hpp:173
+
static INetworkPtr Create(NetworkOptions networkOptions={})
Definition: Network.cpp:510
+
+
+ + + + -- cgit v1.2.1