8 #include <DataTypeUtils.hpp> 27 const std::vector<T> ¶msData,
28 const std::vector<int32_t> &indicesData,
29 const std::vector<T> &outputData)
35 std::unique_ptr<armnn::ITensorHandle> paramsHandle = tensorHandleFactory.
CreateTensorHandle(paramsInfo);
36 std::unique_ptr<armnn::ITensorHandle> indicesHandle = tensorHandleFactory.
CreateTensorHandle(indicesInfo);
37 std::unique_ptr<armnn::ITensorHandle> outputHandle = tensorHandleFactory.
CreateTensorHandle(outputInfo);
41 AddInputToWorkload(data, info, paramsInfo, paramsHandle.get());
42 AddInputToWorkload(data, info, indicesInfo, indicesHandle.get());
43 AddOutputToWorkload(data, info, outputInfo, outputHandle.get());
49 paramsHandle->Allocate();
50 indicesHandle->Allocate();
51 outputHandle->Allocate();
62 outputHandle->GetShape(),
67 template<armnn::DataType ArmnnType,
typename T>
76 if (armnn::IsQuantizedType<T>())
83 const std::vector<T> params = ConvertToDataType<ArmnnType>(
90 const std::vector<int32_t> indices = ConvertToDataType<armnn::DataType::Signed32>(
93 const std::vector<T> expectedOutput = ConvertToDataType<ArmnnType>(
98 return GatherNdTestImpl<ArmnnType, T, 2, 2, 2>(
110 template<armnn::DataType ArmnnType,
typename T>
120 if (armnn::IsQuantizedType<T>())
127 const std::vector<T> params = ConvertToDataType<ArmnnType>(
128 { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
129 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
131 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
132 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
134 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
135 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
137 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
138 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
140 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
141 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
143 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
144 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191 },
147 const std::vector<int32_t> indices = ConvertToDataType<armnn::DataType::Signed32>(
151 const std::vector<T> expectedOutput = ConvertToDataType<ArmnnType>(
152 { 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
153 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
155 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
156 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159},
159 return GatherNdTestImpl<ArmnnType, T, 4, 2, 3>(
171 template<armnn::DataType ArmnnType,
typename T>
181 if (armnn::IsQuantizedType<T>())
188 const std::vector<T> params = ConvertToDataType<ArmnnType>(
189 { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
190 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
191 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
192 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
193 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 },
196 const std::vector<int32_t> indices = ConvertToDataType<armnn::DataType::Signed32>(
214 const std::vector<T> expectedOutput = ConvertToDataType<ArmnnType>(
232 return GatherNdTestImpl<ArmnnType, T, 3, 4, 4>(
249 SimpleGatherNd2dTest<armnn::DataType::Float32>(
254 template LayerTestResult<armnn::ResolveType<armnn::DataType::Float32>, 3>
255 SimpleGatherNd3dTest<armnn::DataType::Float32>(
260 template LayerTestResult<armnn::ResolveType<armnn::DataType::Float32>, 4>
261 SimpleGatherNd4dTest<armnn::DataType::Float32>(
267 SimpleGatherNd2dTest<armnn::DataType::QAsymmS8>(
272 template LayerTestResult<armnn::ResolveType<armnn::DataType::QAsymmS8>, 3>
273 SimpleGatherNd3dTest<armnn::DataType::QAsymmS8>(
278 template LayerTestResult<armnn::ResolveType<armnn::DataType::QAsymmS8>, 4>
279 SimpleGatherNd4dTest<armnn::DataType::QAsymmS8>(
285 SimpleGatherNd2dTest<armnn::DataType::Signed32>(
290 template LayerTestResult<armnn::ResolveType<armnn::DataType::Signed32>, 3>
291 SimpleGatherNd3dTest<armnn::DataType::Signed32>(
296 template LayerTestResult<armnn::ResolveType<armnn::DataType::Signed32>, 4>
297 SimpleGatherNd4dTest<armnn::DataType::Signed32>(
LayerTestResult< T, 4 > SimpleGatherNd4dTest(armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
const TensorShape & GetShape() const
LayerTestResult< T, 3 > SimpleGatherNd3dTest(armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
typename ResolveTypeImpl< DT >::Type ResolveType
void IgnoreUnused(Ts &&...)
LayerTestResult< T, 2 > SimpleGatherNd2dTest(armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::ITensorHandleFactory &tensorHandleFactory)
std::shared_ptr< IMemoryManager > IMemoryManagerSharedPtr
void CopyDataFromITensorHandle(void *mem, const armnn::ITensorHandle *tensorHandle)
void SetQuantizationScale(float scale)
void CopyDataToITensorHandle(armnn::ITensorHandle *tensorHandle, const void *memory)
Contains information about TensorInfos of a layer.
void SetQuantizationOffset(int32_t offset)
virtual std::unique_ptr< IWorkload > CreateWorkload(LayerType type, const QueueDescriptor &descriptor, const WorkloadInfo &info) const
virtual std::unique_ptr< ITensorHandle > CreateTensorHandle(const TensorInfo &tensorInfo) const =0
unsigned int GetNumElements() const