13 #include <doctest/doctest.h> 20 const std::vector<int32_t>& indicesData)
28 Connect(paramsLayer, gatherNdLayer, paramsInfo, 0, 0);
29 Connect(indicesLayer, gatherNdLayer, indicesInfo, 0, 1);
30 Connect(gatherNdLayer, outputLayer, outputInfo, 0, 0);
35 template<armnn::DataType ArmnnType,
typename T = armnn::ResolveType<ArmnnType>>
36 void GatherNdEndToEnd(
const std::vector<BackendId>& backends)
50 std::vector<T> paramsData{
51 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
52 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
54 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
55 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
57 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
58 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
60 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
61 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
63 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
64 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
66 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
67 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191
70 std::vector<int32_t> indicesData{
74 std::vector<T> expectedOutput{
75 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
76 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
78 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
79 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159
83 armnn::INetworkPtr net = CreateGatherNdNetwork(paramsInfo, indicesInfo, outputInfo, indicesData);
87 std::map<int, std::vector<T>> inputTensorData = {{ 0, paramsData }};
88 std::map<int, std::vector<T>> expectedOutputData = {{ 0, expectedOutput }};
90 EndToEndLayerTestImpl<ArmnnType, ArmnnType>(move(net), inputTensorData, expectedOutputData, backends);
93 template<armnn::DataType ArmnnType,
typename T = armnn::ResolveType<ArmnnType>>
94 void GatherNdMultiDimEndToEnd(
const std::vector<BackendId>& backends)
108 std::vector<T> paramsData{
109 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
110 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
111 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
112 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
113 40, 41, 42, 43, 44, 45, 46, 47, 48, 49
116 std::vector<int32_t> indicesData{
134 std::vector<T> expectedOutput{
153 armnn::INetworkPtr net = CreateGatherNdNetwork(paramsInfo, indicesInfo, outputInfo, indicesData);
155 std::map<int, std::vector<T>> inputTensorData = {{ 0, paramsData }};
156 std::map<int, std::vector<T>> expectedOutputData = {{ 0, expectedOutput }};
158 EndToEndLayerTestImpl<ArmnnType, ArmnnType>(move(net), inputTensorData, expectedOutputData, backends);
Interface for a layer that is connectable to other layers via InputSlots and OutputSlots.
A tensor defined by a TensorInfo (shape and data type) and an immutable backing store.
void SetQuantizationScale(float scale)
void SetConstant(const bool IsConstant=true)
Marks the data corresponding to this tensor info as constant.
void SetQuantizationOffset(int32_t offset)
void Connect(armnn::IConnectableLayer *from, armnn::IConnectableLayer *to, const armnn::TensorInfo &tensorInfo, unsigned int fromIndex, unsigned int toIndex)
std::unique_ptr< INetwork, void(*)(INetwork *network)> INetworkPtr
static INetworkPtr Create(NetworkOptions networkOptions={})