blob: a5733d8a184f61cb2f4dd5cd2c0cb52a7616e4b8 [file] [log] [blame]
telsoa014fcda012018-03-09 14:13:49 +00001//
2// Copyright © 2017 Arm Ltd. All rights reserved.
David Beckecb56cd2018-09-05 12:52:57 +01003// SPDX-License-Identifier: MIT
telsoa014fcda012018-03-09 14:13:49 +00004//
5#include <boost/test/unit_test.hpp>
6
7#include "test/TensorHelpers.hpp"
8#include "LayerTests.hpp"
9
David Beckb4540be2018-09-24 13:18:27 +010010#include <backends/CpuTensorHandle.hpp>
David Beck0dbe0ee2018-09-24 15:59:27 +010011#include <backends/neon/NeonLayerSupport.hpp>
12#include <backends/neon/NeonWorkloadFactory.hpp>
David Beckb4540be2018-09-24 13:18:27 +010013#include <backends/reference/RefWorkloadFactory.hpp>
14#include <backends/test/TensorCopyUtils.hpp>
telsoa014fcda012018-03-09 14:13:49 +000015#include "ActivationFixture.hpp"
16
17#include "WorkloadTestUtils.hpp"
18
19#include "test/UnitTests.hpp"
20
21BOOST_AUTO_TEST_SUITE(Compute_ArmComputeNeon)
22using FactoryType = armnn::NeonWorkloadFactory;
23
24// ============================================================================
25// UNIT tests
26
27// Convolution
28ARMNN_AUTO_TEST_CASE(SimpleConvolution1d, Convolution1dTest, true)
29
30ARMNN_AUTO_TEST_CASE(SimpleConvolution2d, SimpleConvolution2d3x5Test, true)
31ARMNN_AUTO_TEST_CASE(SimpleConvolution2dSquare, SimpleConvolution2d3x3Test, true)
32ARMNN_AUTO_TEST_CASE(UnbiasedConvolution2d, SimpleConvolution2d3x5Test, false)
33ARMNN_AUTO_TEST_CASE(UnbiasedConvolution2dSquare, SimpleConvolution2d3x3Test, false)
34ARMNN_AUTO_TEST_CASE(SimpleConvolution2dAsymmetricPadding, Convolution2dAsymmetricPaddingTest)
35
36namespace
37{
38
39armnn::Convolution2dDescriptor MakeConv2dDesc(uint32_t strideX, uint32_t strideY,
40 uint32_t padLeft = 0, uint32_t padRight = 0, uint32_t padTop = 0, uint32_t padBottom = 0)
41{
42 armnn::Convolution2dDescriptor result;
43 result.m_StrideX = strideX;
44 result.m_StrideY = strideY;
45 result.m_PadLeft = padLeft;
46 result.m_PadRight = padRight;
47 result.m_PadTop = padTop;
48 result.m_PadBottom = padBottom;
49 result.m_BiasEnabled = true;
50 return result;
51}
52
53}
54
55BOOST_AUTO_TEST_CASE(Conv2dUtils)
56{
telsoa01c577f2c2018-08-31 09:22:23 +010057 // The only preferred Neon convolution is 1x1 with padding=0 and stride size {1,2,3}.
telsoa014fcda012018-03-09 14:13:49 +000058 armnn::TensorShape shape1x1({ 1,1,1,1 });
59 armnn::TensorInfo info1x1(shape1x1, armnn::DataType::Float32);
60 BOOST_TEST(armnn::IsNeonDirectConvolutionPreferred(info1x1, MakeConv2dDesc(1, 1)));
61 BOOST_TEST(armnn::IsNeonDirectConvolutionPreferred(info1x1, MakeConv2dDesc(1, 2)));
62 BOOST_TEST(armnn::IsNeonDirectConvolutionPreferred(info1x1, MakeConv2dDesc(1, 3)));
63 BOOST_TEST(armnn::IsNeonDirectConvolutionPreferred(info1x1, MakeConv2dDesc(2, 1)));
64 BOOST_TEST(armnn::IsNeonDirectConvolutionPreferred(info1x1, MakeConv2dDesc(2, 2)));
65 BOOST_TEST(armnn::IsNeonDirectConvolutionPreferred(info1x1, MakeConv2dDesc(2, 3)));
66 BOOST_TEST(armnn::IsNeonDirectConvolutionPreferred(info1x1, MakeConv2dDesc(3, 1)));
67 BOOST_TEST(armnn::IsNeonDirectConvolutionPreferred(info1x1, MakeConv2dDesc(3, 2)));
68 BOOST_TEST(armnn::IsNeonDirectConvolutionPreferred(info1x1, MakeConv2dDesc(3, 3)));
69
70 BOOST_TEST(!armnn::IsNeonDirectConvolutionPreferred(info1x1, MakeConv2dDesc(4, 1)));
71 BOOST_TEST(!armnn::IsNeonDirectConvolutionPreferred(info1x1, MakeConv2dDesc(4, 5)));
72 BOOST_TEST(!armnn::IsNeonDirectConvolutionPreferred(info1x1, MakeConv2dDesc(3, 6)));
73
74 // non zero padding is not preferred for direct convolution
75 BOOST_TEST(!armnn::IsNeonDirectConvolutionPreferred(info1x1, MakeConv2dDesc(1, 1, 1, 0)));
76 BOOST_TEST(!armnn::IsNeonDirectConvolutionPreferred(info1x1, MakeConv2dDesc(1, 1, 0, 1)));
77 BOOST_TEST(!armnn::IsNeonDirectConvolutionPreferred(info1x1, MakeConv2dDesc(1, 1, 1, 1)));
78
79 // 2x2 filter not preferred for direct convolution
80 armnn::TensorShape shape2x2({ 1,1,2,2 });
81 armnn::TensorInfo info2x2(shape2x2, armnn::DataType::Float32);
82 BOOST_TEST(!armnn::IsNeonDirectConvolutionPreferred(info2x2, MakeConv2dDesc(1, 1)));
83}
84
85// Depthwise Convolution
86ARMNN_AUTO_TEST_CASE(DepthwiseConvolution2dDepthMul1, DepthwiseConvolution2dDepthMul1Test, true)
87ARMNN_AUTO_TEST_CASE(UnbiasedDepthwiseConvolution2dDepthMul1, DepthwiseConvolution2dDepthMul1Test, false)
88ARMNN_AUTO_TEST_CASE(DepthwiseConvolution2dDepthMul1Uint8, DepthwiseConvolution2dDepthMul1Uint8Test, true)
89ARMNN_AUTO_TEST_CASE(UnbiasedDepthwiseConvolution2dDepthMul1Uint8, DepthwiseConvolution2dDepthMul1Uint8Test, false)
90
surmeh013537c2c2018-05-18 16:31:43 +010091ARMNN_AUTO_TEST_CASE(DepthwiseConvolution2dAsymmetric, DepthwiseConvolution2dAsymmetricTest, true)
92ARMNN_AUTO_TEST_CASE(UnbiasedDepthwiseConvolution2dAsymmetric, DepthwiseConvolution2dAsymmetricTest, false)
93
telsoa014fcda012018-03-09 14:13:49 +000094namespace
95{
96
97armnn::DepthwiseConvolution2dDescriptor MakeDepthwiseConv2dDesc(uint32_t strideX, uint32_t strideY,
98 uint32_t depthMultiplier = 1, uint32_t padLeft = 0, uint32_t padRight = 0,
99 uint32_t padTop = 0, uint32_t padBottom = 0)
100{
telsoa01c577f2c2018-08-31 09:22:23 +0100101 boost::ignore_unused(depthMultiplier);
102
telsoa014fcda012018-03-09 14:13:49 +0000103 armnn::DepthwiseConvolution2dDescriptor desc;
telsoa01c577f2c2018-08-31 09:22:23 +0100104
telsoa014fcda012018-03-09 14:13:49 +0000105 desc.m_PadLeft = padLeft;
106 desc.m_PadRight = padRight;
telsoa01c577f2c2018-08-31 09:22:23 +0100107
telsoa014fcda012018-03-09 14:13:49 +0000108 desc.m_PadTop = padTop;
109 desc.m_PadBottom = padBottom;
110 desc.m_StrideX = strideX;
111 desc.m_StrideY = strideY;
telsoa01c577f2c2018-08-31 09:22:23 +0100112 desc.m_BiasEnabled = false;
113
telsoa014fcda012018-03-09 14:13:49 +0000114 return desc;
115}
116
telsoa01c577f2c2018-08-31 09:22:23 +0100117armnn::TensorInfo CreateOutputTensorInfo(const armnn::TensorInfo& inputInfo,
118 const armnn::TensorInfo& weightsInfo,
119 const armnn::DepthwiseConvolution2dDescriptor& descriptor,
120 armnn::DataType dataType)
121{
122 const armnn::TensorShape& inputShape = inputInfo.GetShape();
123 const armnn::TensorShape& filterShape = weightsInfo.GetShape();
124
125 unsigned int inWidth = inputShape[3];
126 unsigned int inHeight = inputShape[2];
127 unsigned int inBatchSize = inputShape[0];
128
129 unsigned int filterWidth = filterShape[3];
130 unsigned int readWidth = (inWidth + descriptor.m_PadLeft + descriptor.m_PadRight) - (filterWidth);
131 unsigned int outWidth = 1u + (readWidth / descriptor.m_StrideX);
132
133 unsigned int filterHeight = filterShape[2];
134 unsigned int readHeight = (inHeight + descriptor.m_PadTop + descriptor.m_PadBottom) - (filterHeight);
135 unsigned int outHeight = 1u + (readHeight / descriptor.m_StrideY);
136 unsigned int depthMultiplier = filterShape[0];
137
138 unsigned int outChannels = filterShape[1] * depthMultiplier;
139 unsigned int outBatchSize = inBatchSize;
140
141 armnn::TensorShape outputShape({outBatchSize, outChannels, outHeight, outWidth});
142 return armnn::TensorInfo(outputShape, dataType);
143}
telsoa014fcda012018-03-09 14:13:49 +0000144}
145
146BOOST_AUTO_TEST_CASE(DepthwiseConv2dUtils)
147{
telsoa01c577f2c2018-08-31 09:22:23 +0100148 const armnn::DataType dataType = armnn::DataType::Float32;
149
150 armnn::TensorInfo inputInfo({1, 1, 10, 10 }, dataType);
151 armnn::TensorInfo outputInfo;
152 armnn::TensorInfo weightsInfo3x3({ 1, 1, 3, 3 }, dataType);
153 armnn::TensorInfo biasesInfo;
154
155 armnn::DepthwiseConvolution2dDescriptor descriptor;
telsoa014fcda012018-03-09 14:13:49 +0000156
157 // Strides supported: 1,2,3
telsoa01c577f2c2018-08-31 09:22:23 +0100158 descriptor = MakeDepthwiseConv2dDesc(1, 1);
159 outputInfo = CreateOutputTensorInfo(inputInfo, weightsInfo3x3, descriptor, dataType);
160 BOOST_TEST(armnn::IsDepthwiseConvolutionSupportedNeon(inputInfo, outputInfo, descriptor,
161 weightsInfo3x3, biasesInfo));
telsoa014fcda012018-03-09 14:13:49 +0000162
telsoa01c577f2c2018-08-31 09:22:23 +0100163 descriptor = MakeDepthwiseConv2dDesc(1, 2);
164 outputInfo = CreateOutputTensorInfo(inputInfo, weightsInfo3x3, descriptor, dataType);
165 BOOST_TEST(armnn::IsDepthwiseConvolutionSupportedNeon(inputInfo, outputInfo, descriptor,
166 weightsInfo3x3, biasesInfo));
167
168 descriptor = MakeDepthwiseConv2dDesc(1, 3);
169 outputInfo = CreateOutputTensorInfo(inputInfo, weightsInfo3x3, descriptor, dataType);
170 BOOST_TEST(armnn::IsDepthwiseConvolutionSupportedNeon(inputInfo, outputInfo, descriptor,
171 weightsInfo3x3, biasesInfo));
172
173 descriptor = MakeDepthwiseConv2dDesc(2, 1);
174 outputInfo = CreateOutputTensorInfo(inputInfo, weightsInfo3x3, descriptor, dataType);
175 BOOST_TEST(armnn::IsDepthwiseConvolutionSupportedNeon(inputInfo, outputInfo, descriptor,
176 weightsInfo3x3, biasesInfo));
177
178 descriptor = MakeDepthwiseConv2dDesc(2, 2);
179 outputInfo = CreateOutputTensorInfo(inputInfo, weightsInfo3x3, descriptor, dataType);
180 BOOST_TEST(armnn::IsDepthwiseConvolutionSupportedNeon(inputInfo, outputInfo, descriptor,
181 weightsInfo3x3, biasesInfo));
182
183 descriptor = MakeDepthwiseConv2dDesc(2, 3);
184 outputInfo = CreateOutputTensorInfo(inputInfo, weightsInfo3x3, descriptor, dataType);
185 BOOST_TEST(armnn::IsDepthwiseConvolutionSupportedNeon(inputInfo, outputInfo, descriptor,
186 weightsInfo3x3, biasesInfo));
187
188 descriptor = MakeDepthwiseConv2dDesc(3, 1);
189 outputInfo = CreateOutputTensorInfo(inputInfo, weightsInfo3x3, descriptor, dataType);
190 BOOST_TEST(armnn::IsDepthwiseConvolutionSupportedNeon(inputInfo, outputInfo, descriptor,
191 weightsInfo3x3, biasesInfo));
192
193 descriptor = MakeDepthwiseConv2dDesc(3, 2);
194 outputInfo = CreateOutputTensorInfo(inputInfo, weightsInfo3x3, descriptor, dataType);
195 BOOST_TEST(armnn::IsDepthwiseConvolutionSupportedNeon(inputInfo, outputInfo, descriptor,
196 weightsInfo3x3, biasesInfo));
197
198 descriptor = MakeDepthwiseConv2dDesc(3, 3);
199 outputInfo = CreateOutputTensorInfo(inputInfo, weightsInfo3x3, descriptor, dataType);
200 BOOST_TEST(armnn::IsDepthwiseConvolutionSupportedNeon(inputInfo, outputInfo, descriptor,
201 weightsInfo3x3, biasesInfo));
202
203 // Supported stride 4
204 descriptor = MakeDepthwiseConv2dDesc(4, 1);
205 outputInfo = CreateOutputTensorInfo(inputInfo, weightsInfo3x3, descriptor, dataType);
206 BOOST_TEST(armnn::IsDepthwiseConvolutionSupportedNeon(inputInfo, outputInfo, descriptor,
207 weightsInfo3x3, biasesInfo));
telsoa014fcda012018-03-09 14:13:49 +0000208
209 // Supported weights shape 1x1
210 armnn::TensorInfo weightsInfo1x1({ 1, 1, 1, 1 }, armnn::DataType::Float32);
telsoa01c577f2c2018-08-31 09:22:23 +0100211 descriptor = MakeDepthwiseConv2dDesc(1, 1);
212 outputInfo = CreateOutputTensorInfo(inputInfo, weightsInfo1x1, descriptor, dataType);
213 BOOST_TEST(armnn::IsDepthwiseConvolutionSupportedNeon(inputInfo, outputInfo, descriptor,
214 weightsInfo1x1, biasesInfo));
telsoa014fcda012018-03-09 14:13:49 +0000215
216 // Supported shape 2x2
217 armnn::TensorInfo weightsInfo2x2({ 1, 1, 2, 2 }, armnn::DataType::Float32);
telsoa01c577f2c2018-08-31 09:22:23 +0100218 descriptor = MakeDepthwiseConv2dDesc(1, 1);
219 outputInfo = CreateOutputTensorInfo(inputInfo, weightsInfo2x2, descriptor, dataType);
220 BOOST_TEST(armnn::IsDepthwiseConvolutionSupportedNeon(inputInfo, outputInfo, descriptor,
221 weightsInfo2x2, biasesInfo));
surmeh013537c2c2018-05-18 16:31:43 +0100222
223 // Asymmetric padding
telsoa01c577f2c2018-08-31 09:22:23 +0100224 descriptor = MakeDepthwiseConv2dDesc(1, 1, 1, 1, 2, 1, 2);
225 outputInfo = CreateOutputTensorInfo(inputInfo, weightsInfo3x3, descriptor, dataType);
226 BOOST_TEST(armnn::IsDepthwiseConvolutionSupportedNeon(inputInfo, outputInfo, descriptor,
227 weightsInfo3x3, biasesInfo));
telsoa014fcda012018-03-09 14:13:49 +0000228}
229
230// Pooling
231ARMNN_AUTO_TEST_CASE(SimpleMaxPooling2dSize3x3Stride2x4, SimpleMaxPooling2dSize3x3Stride2x4Test, true)
232ARMNN_AUTO_TEST_CASE(SimpleMaxPooling2dSize3x3Stride2x4Uint8, SimpleMaxPooling2dSize3x3Stride2x4Uint8Test, true)
233ARMNN_AUTO_TEST_CASE(SimpleAveragePooling2d, SimpleAveragePooling2dTest)
234ARMNN_AUTO_TEST_CASE(SimpleAveragePooling2dUint8, SimpleAveragePooling2dUint8Test)
surmeh01bceff2f2018-03-29 16:29:27 +0100235
telsoa014fcda012018-03-09 14:13:49 +0000236ARMNN_AUTO_TEST_CASE(LargeTensorsAveragePooling2d, LargeTensorsAveragePooling2dTest)
237ARMNN_AUTO_TEST_CASE(LargeTensorsAveragePooling2dUint8, LargeTensorsAveragePooling2dUint8Test)
238
239ARMNN_AUTO_TEST_CASE(SimpleL2Pooling2d, SimpleL2Pooling2dTest)
240ARMNN_AUTO_TEST_CASE(UNSUPPORTED_SimpleL2Pooling2dUint8, SimpleL2Pooling2dUint8Test)
241ARMNN_AUTO_TEST_CASE(L2Pooling2dSize3Stride1, L2Pooling2dSize3Stride1Test)
242ARMNN_AUTO_TEST_CASE(UNSUPPORTED_L2Pooling2dSize3Stride1Uint8, L2Pooling2dSize3Stride1Uint8Test)
243ARMNN_AUTO_TEST_CASE(L2Pooling2dSize3Stride3, L2Pooling2dSize3Stride3Test)
244ARMNN_AUTO_TEST_CASE(UNSUPPORTED_L2Pooling2dSize3Stride3Uint8, L2Pooling2dSize3Stride3Uint8Test)
245ARMNN_AUTO_TEST_CASE(L2Pooling2dSize3Stride4, L2Pooling2dSize3Stride4Test)
246ARMNN_AUTO_TEST_CASE(UNSUPPORTED_L2Pooling2dSize3Stride4Uint8, L2Pooling2dSize3Stride4Uint8Test)
247ARMNN_AUTO_TEST_CASE(L2Pooling2dSize7, L2Pooling2dSize7Test)
248ARMNN_AUTO_TEST_CASE(UNSUPPORTED_L2Pooling2dSize7Uint8, L2Pooling2dSize7Uint8Test)
249ARMNN_AUTO_TEST_CASE(L2Pooling2dSize9, L2Pooling2dSize9Test)
250ARMNN_AUTO_TEST_CASE(UNSUPPORTED_L2Pooling2dSize9Uint8, L2Pooling2dSize9Uint8Test)
251
252// Ignore padding values for pooling but count padding fields into the divisor
253ARMNN_AUTO_TEST_CASE(IgnorePaddingSimpleMaxPooling2d, IgnorePaddingSimpleMaxPooling2dTest)
254ARMNN_AUTO_TEST_CASE(IgnorePaddingSimpleMaxPooling2dUint8, IgnorePaddingSimpleMaxPooling2dUint8Test)
255ARMNN_AUTO_TEST_CASE(IgnorePaddingMaxPooling2dSize3, IgnorePaddingMaxPooling2dSize3Test)
256ARMNN_AUTO_TEST_CASE(IgnorePaddingMaxPooling2dSize3Uint8, IgnorePaddingMaxPooling2dSize3Uint8Test)
257
258ARMNN_AUTO_TEST_CASE(IgnorePaddingSimpleAveragePooling2d, IgnorePaddingSimpleAveragePooling2dTest)
259ARMNN_AUTO_TEST_CASE(IgnorePaddingSimpleAveragePooling2dUint8, IgnorePaddingSimpleAveragePooling2dUint8Test)
260ARMNN_AUTO_TEST_CASE(IgnorePaddingSimpleAveragePooling2dNoPadding, IgnorePaddingSimpleAveragePooling2dNoPaddingTest)
261ARMNN_AUTO_TEST_CASE(IgnorePaddingSimpleAveragePooling2dNoPaddingUint8,
262 IgnorePaddingSimpleAveragePooling2dNoPaddingUint8Test)
263ARMNN_AUTO_TEST_CASE(IgnorePaddingAveragePooling2dSize3, IgnorePaddingAveragePooling2dSize3Test)
264ARMNN_AUTO_TEST_CASE(IgnorePaddingAveragePooling2dSize3Uint8, IgnorePaddingAveragePooling2dSize3Uint8Test)
surmeh01bceff2f2018-03-29 16:29:27 +0100265ARMNN_AUTO_TEST_CASE(IgnorePaddingAveragePooling2dSize3x2Stride2x2,
266 IgnorePaddingAveragePooling2dSize3x2Stride2x2Test, false)
267ARMNN_AUTO_TEST_CASE(IgnorePaddingAveragePooling2dSize3x2Stride2x2NoPadding,
268 IgnorePaddingAveragePooling2dSize3x2Stride2x2Test,
269 true)
telsoa014fcda012018-03-09 14:13:49 +0000270
271ARMNN_AUTO_TEST_CASE(IgnorePaddingSimpleL2Pooling2d, IgnorePaddingSimpleL2Pooling2dTest)
272ARMNN_AUTO_TEST_CASE(UNSUPPORTED_IgnorePaddingSimpleL2Pooling2dUint8, IgnorePaddingSimpleL2Pooling2dUint8Test)
273ARMNN_AUTO_TEST_CASE(IgnorePaddingL2Pooling2dSize3, IgnorePaddingL2Pooling2dSize3Test)
274ARMNN_AUTO_TEST_CASE(UNSUPPORTED_IgnorePaddingL2Pooling2dSize3Uint8, IgnorePaddingL2Pooling2dSize3Uint8Test)
275
276// Activation
277ARMNN_AUTO_TEST_CASE(ConstantLinearActivation, ConstantLinearActivationTest)
278
279ARMNN_AUTO_TEST_CASE(SimpleSoftmaxBeta1, SimpleSoftmaxTest, 1.0f)
280ARMNN_AUTO_TEST_CASE(SimpleSoftmaxBeta2, SimpleSoftmaxTest, 2.0f)
281
282ARMNN_AUTO_TEST_CASE(SimpleSoftmaxBeta1Uint8, SimpleSoftmaxUint8Test, 1.0f)
283ARMNN_AUTO_TEST_CASE(SimpleSoftmaxBeta2Uint8, SimpleSoftmaxUint8Test, 2.0f)
284
285ARMNN_AUTO_TEST_CASE(ReLu1Uint8, BoundedReLuUint8UpperAndLowerBoundTest)
286ARMNN_AUTO_TEST_CASE(ReLu6Uint8, BoundedReLuUint8UpperBoundOnlyTest)
287
telsoa01c577f2c2018-08-31 09:22:23 +0100288// Softmax
289BOOST_AUTO_TEST_CASE(Softmax4dSupport)
telsoa014fcda012018-03-09 14:13:49 +0000290{
telsoa01c577f2c2018-08-31 09:22:23 +0100291 const unsigned int numDimensions = 4u;
292 std::array<unsigned int, numDimensions> dimensionSizes;
293 dimensionSizes.fill(1u);
294
295 const armnn::TensorInfo inputInfo(numDimensions, &dimensionSizes.front(), armnn::DataType::Float32);
296 const armnn::TensorInfo outputInfo(numDimensions, &dimensionSizes.front(), armnn::DataType::Float32);
297
298 // 4D Softmax should be reported as unsupported on the NEON backend
299 BOOST_TEST(!armnn::IsSoftmaxSupportedNeon(inputInfo, outputInfo, armnn::SoftmaxDescriptor()));
telsoa014fcda012018-03-09 14:13:49 +0000300}
301
telsoa01c577f2c2018-08-31 09:22:23 +0100302// Splitter
303ARMNN_AUTO_TEST_CASE(SimpleSplitter, SplitterTest)
304ARMNN_AUTO_TEST_CASE(SimpleSplitterUint8, SplitterUint8Test)
telsoa014fcda012018-03-09 14:13:49 +0000305
306ARMNN_AUTO_TEST_CASE(CopyViaSplitter, CopyViaSplitterTest)
307ARMNN_AUTO_TEST_CASE(CopyViaSplitterUint8, CopyViaSplitterUint8Test)
308
309// Merger
310ARMNN_AUTO_TEST_CASE(SimpleMerger, MergerTest)
311ARMNN_AUTO_TEST_CASE(MergerUint8, MergerUint8Test)
312
313// Fully Connected
314ARMNN_AUTO_TEST_CASE(SimpleFullyConnected, FullyConnectedFloat32Test, false, false)
315ARMNN_AUTO_TEST_CASE(SimpleFullyConnectedWithBias, FullyConnectedFloat32Test, true, false)
316ARMNN_AUTO_TEST_CASE(SimpleFullyConnectedWithTranspose, FullyConnectedFloat32Test, false, true)
317ARMNN_AUTO_TEST_CASE(FullyConnectedLarge, FullyConnectedLargeTest, false)
318ARMNN_AUTO_TEST_CASE(FullyConnectedLargeTransposed, FullyConnectedLargeTest, true)
kevmay01e448be32018-09-26 10:21:55 +0100319ARMNN_AUTO_TEST_CASE(FullyConnectedUint8, FullyConnectedUint8Test, false)
320ARMNN_AUTO_TEST_CASE(FullyConnectedBiasedUint8, FullyConnectedUint8Test, true)
telsoa014fcda012018-03-09 14:13:49 +0000321
322// Add
323ARMNN_AUTO_TEST_CASE(SimpleAdd, AdditionTest)
David Beckbc392452018-09-10 14:47:28 +0100324ARMNN_AUTO_TEST_CASE(AddBroadcast, AdditionBroadcastTest)
telsoa014fcda012018-03-09 14:13:49 +0000325ARMNN_AUTO_TEST_CASE(AddBroadcast1Element, AdditionBroadcast1ElementTest)
326
David Beckbc392452018-09-10 14:47:28 +0100327// Sub
328ARMNN_AUTO_TEST_CASE(SimpleSub, SubtractionTest)
329
telsoa014fcda012018-03-09 14:13:49 +0000330// Mul
331ARMNN_AUTO_TEST_CASE(SimpleMultiplication, MultiplicationTest)
surmeh013537c2c2018-05-18 16:31:43 +0100332ARMNN_AUTO_TEST_CASE(MultiplicationBroadcast1Element, MultiplicationBroadcast1ElementTest)
333ARMNN_AUTO_TEST_CASE(MultiplicationBroadcast1DVector, MultiplicationBroadcast1DVectorTest)
telsoa014fcda012018-03-09 14:13:49 +0000334
335// Batch Norm
336ARMNN_AUTO_TEST_CASE(BatchNorm, BatchNormTest)
337
338// Constant
339ARMNN_AUTO_TEST_CASE(Constant, ConstantTest)
340ARMNN_AUTO_TEST_CASE(ConstantUint8, ConstantTestUint8)
341
342// Concatenation
343ARMNN_AUTO_TEST_CASE(Concatenation1d, Concatenation1dTest)
344ARMNN_AUTO_TEST_CASE(Concatenation1dUint8, Concatenation1dUint8Test)
345
346ARMNN_AUTO_TEST_CASE(Concatenation2dDim0, Concatenation2dDim0Test)
347ARMNN_AUTO_TEST_CASE(Concatenation2dDim0Uint8, Concatenation2dDim0Uint8Test)
348ARMNN_AUTO_TEST_CASE(Concatenation2dDim1, Concatenation2dDim1Test)
349ARMNN_AUTO_TEST_CASE(Concatenation2dDim1Uint8, Concatenation2dDim1Uint8Test)
350
351ARMNN_AUTO_TEST_CASE(Concatenation2dDim0DiffInputDims, Concatenation2dDim0DiffInputDimsTest)
352ARMNN_AUTO_TEST_CASE(Concatenation2dDim0DiffInputDimsUint8, Concatenation2dDim0DiffInputDimsUint8Test)
353ARMNN_AUTO_TEST_CASE(Concatenation2dDim1DiffInputDims, Concatenation2dDim1DiffInputDimsTest)
354ARMNN_AUTO_TEST_CASE(Concatenation2dDim1DiffInputDimsUint8, Concatenation2dDim1DiffInputDimsUint8Test)
355
356ARMNN_AUTO_TEST_CASE(Concatenation3dDim0, Concatenation3dDim0Test)
357ARMNN_AUTO_TEST_CASE(Concatenation3dDim0Uint8, Concatenation3dDim0Uint8Test)
358ARMNN_AUTO_TEST_CASE(Concatenation3dDim1, Concatenation3dDim1Test)
359ARMNN_AUTO_TEST_CASE(Concatenation3dDim1Uint8, Concatenation3dDim1Uint8Test)
360ARMNN_AUTO_TEST_CASE(Concatenation3dDim2, Concatenation3dDim2Test)
361ARMNN_AUTO_TEST_CASE(Concatenation3dDim2Uint8, Concatenation3dDim2Uint8Test)
362
363ARMNN_AUTO_TEST_CASE(Concatenation3dDim0DiffInputDims, Concatenation3dDim0DiffInputDimsTest)
364ARMNN_AUTO_TEST_CASE(Concatenation3dDim0DiffInputDimsUint8, Concatenation3dDim0DiffInputDimsUint8Test)
365ARMNN_AUTO_TEST_CASE(Concatenation3dDim1DiffInputDims, Concatenation3dDim1DiffInputDimsTest)
366ARMNN_AUTO_TEST_CASE(Concatenation3dDim1DiffInputDimsUint8, Concatenation3dDim1DiffInputDimsUint8Test)
367ARMNN_AUTO_TEST_CASE(Concatenation3dDim2DiffInputDims, Concatenation3dDim2DiffInputDimsTest)
368ARMNN_AUTO_TEST_CASE(Concatenation3dDim2DiffInputDimsUint8, Concatenation3dDim2DiffInputDimsUint8Test)
369
370// L2 Normalization
Matteo Martincigh539b44d2018-10-01 09:26:39 +0100371ARMNN_AUTO_TEST_CASE(L2Normalization1d, L2Normalization1dTest)
372ARMNN_AUTO_TEST_CASE(L2Normalization2d, L2Normalization2dTest)
373ARMNN_AUTO_TEST_CASE(L2Normalization3d, L2Normalization3dTest)
374ARMNN_AUTO_TEST_CASE(L2Normalization4d, L2Normalization4dTest)
375
376ARMNN_AUTO_TEST_CASE(L2Normalization1dNhwc, L2Normalization1dNhwcTest)
377ARMNN_AUTO_TEST_CASE(L2Normalization2dNhwc, L2Normalization2dNhwcTest)
378ARMNN_AUTO_TEST_CASE(L2Normalization3dNhwc, L2Normalization3dNhwcTest)
379ARMNN_AUTO_TEST_CASE(L2Normalization4dNhwc, L2Normalization4dNhwcTest)
telsoa014fcda012018-03-09 14:13:49 +0000380
381// Floor
382ARMNN_AUTO_TEST_CASE(SimpleFloor, SimpleFloorTest)
383
384// Reshape
385ARMNN_AUTO_TEST_CASE(SimpleReshapeFloat32, SimpleReshapeFloat32Test)
386ARMNN_AUTO_TEST_CASE(SimpleReshapeUint8, SimpleReshapeUint8Test)
387
388// Permute
389ARMNN_AUTO_TEST_CASE(SimplePermuteFloat32, SimplePermuteFloat32Test)
390ARMNN_AUTO_TEST_CASE(SimplePermuteUint8, SimplePermuteUint8Test)
surmeh01bceff2f2018-03-29 16:29:27 +0100391ARMNN_AUTO_TEST_CASE(PermuteFloat32ValueSet1, PermuteFloat32ValueSet1Test)
392ARMNN_AUTO_TEST_CASE(PermuteFloat32ValueSet2, PermuteFloat32ValueSet2Test)
393ARMNN_AUTO_TEST_CASE(PermuteFloat32ValueSet3, PermuteFloat32ValueSet3Test)
394
Les Bellde9011b2018-10-03 10:37:52 +0100395// Lstm
396ARMNN_AUTO_TEST_CASE(LstmLayerFloat32WithCifgWithPeepholeNoProjection,
397 LstmLayerFloat32WithCifgWithPeepholeNoProjectionTest)
398ARMNN_AUTO_TEST_CASE(LstmLayerFloat32NoCifgNoPeepholeNoProjection,
399 LstmLayerFloat32NoCifgNoPeepholeNoProjectionTest)
400ARMNN_AUTO_TEST_CASE(LstmLayerFloat32NoCifgWithPeepholeWithProjection,
401 LstmLayerFloat32NoCifgWithPeepholeWithProjectionTest)
402
narpra0155a97bc2018-10-02 14:35:53 +0100403// Normalization
404ARMNN_AUTO_TEST_CASE(SimpleNormalizationAcross, SimpleNormalizationAcrossTest)
405ARMNN_AUTO_TEST_CASE(SimpleNormalizationWithin, SimpleNormalizationWithinTest)
406ARMNN_AUTO_TEST_CASE(SimpleNormalizationAcrossNhwc, SimpleNormalizationAcrossNhwcTest)
407
telsoa014fcda012018-03-09 14:13:49 +0000408// ============================================================================
409// COMPARE tests
410
411ARMNN_COMPARE_REF_AUTO_TEST_CASE(CompareConv2dWithReference, CompareConvolution2dTest)
412
413ARMNN_COMPARE_REF_AUTO_TEST_CASE(CompareDepthwiseConv2dWithReferenceFloat32, CompareDepthwiseConvolution2dTest<float>)
414ARMNN_COMPARE_REF_AUTO_TEST_CASE(CompareDepthwiseConv2dWithReferenceUint8, CompareDepthwiseConvolution2dTest<uint8_t>)
415
416ARMNN_COMPARE_REF_AUTO_TEST_CASE(CompareNormalizationWithinWithReference, CompareNormalizationTest,
417 armnn::NormalizationAlgorithmChannel::Within,
418 armnn::NormalizationAlgorithmMethod::LocalBrightness)
419ARMNN_COMPARE_REF_AUTO_TEST_CASE(CompareNormalizationAcrossWithReference, CompareNormalizationTest,
420 armnn::NormalizationAlgorithmChannel::Across,
421 armnn::NormalizationAlgorithmMethod::LocalBrightness)
422
423ARMNN_COMPARE_REF_AUTO_TEST_CASE(CompareMaxPooling2dWithReference, ComparePooling2dTest, armnn::PoolingAlgorithm::Max)
424ARMNN_COMPARE_REF_AUTO_TEST_CASE(CompareMaxPooling2dWithReferenceUint8, ComparePooling2dUint8Test,
425 armnn::PoolingAlgorithm::Max)
426ARMNN_COMPARE_REF_AUTO_TEST_CASE(CompareAveragePooling2dWithReference, ComparePooling2dTest,
427 armnn::PoolingAlgorithm::Average)
428ARMNN_COMPARE_REF_AUTO_TEST_CASE(CompareAveragePooling2dWithReferenceUint8, ComparePooling2dUint8Test,
429 armnn::PoolingAlgorithm::Average)
430ARMNN_COMPARE_REF_AUTO_TEST_CASE(CompareL2Pooling2dWithReference, ComparePooling2dTest, armnn::PoolingAlgorithm::L2)
431ARMNN_COMPARE_REF_AUTO_TEST_CASE(UNSUPPORTED_CompareL2Pooling2dWithReferenceUint8, ComparePooling2dUint8Test,
432 armnn::PoolingAlgorithm::L2)
433
434ARMNN_COMPARE_REF_AUTO_TEST_CASE(CompareSoftmaxBeta1WithReference, CompareSoftmaxTest, 1.0f)
435ARMNN_COMPARE_REF_AUTO_TEST_CASE(CompareSoftmaxBeta2WithReference, CompareSoftmaxTest, 2.0f)
436
437ARMNN_COMPARE_REF_AUTO_TEST_CASE(CompareSoftmaxUint8Beta1WithReference, CompareSoftmaxUint8Test, 1.0f)
438ARMNN_COMPARE_REF_AUTO_TEST_CASE(CompareSoftmaxUint8Beta2WithReference, CompareSoftmaxUint8Test, 2.0f)
439
440ARMNN_COMPARE_REF_AUTO_TEST_CASE(CompareAddition, CompareAdditionTest)
441
442ARMNN_COMPARE_REF_AUTO_TEST_CASE(CompareMultiplicationWithReference, CompareMultiplicationTest)
443
444ARMNN_COMPARE_REF_AUTO_TEST_CASE(CompareBatchNorm, CompareBatchNormTest)
445
446ARMNN_COMPARE_REF_AUTO_TEST_CASE(ReLu1, CompareBoundedReLuTest, 1.0f, -1.0f)
447ARMNN_COMPARE_REF_AUTO_TEST_CASE(ReLu6, CompareBoundedReLuTest, 6.0f, 0.0f)
448
449// ============================================================================
450// FIXTURE tests
451
452ARMNN_COMPARE_REF_FIXTURE_TEST_CASE(CompareSigmoidActivationWithReference, ActivationFixture,
453 CompareActivationTest, armnn::ActivationFunction::Sigmoid, 5u)
454
455ARMNN_COMPARE_REF_FIXTURE_TEST_CASE(CompareTanhActivationWithReference, ActivationFixture,
456 CompareActivationTest, armnn::ActivationFunction::TanH, 5u)
457
458ARMNN_COMPARE_REF_FIXTURE_TEST_CASE(CompareLinearActivationWithReference, ActivationFixture,
459 CompareActivationTest, armnn::ActivationFunction::Linear, 5u)
460
461ARMNN_COMPARE_REF_FIXTURE_TEST_CASE(CompareReLuActivationWithReference, ActivationFixture,
462 CompareActivationTest, armnn::ActivationFunction::ReLu, 5u)
463
464ARMNN_COMPARE_REF_FIXTURE_TEST_CASE(CompareBoundedReLuActivationWithReference, ActivationFixture,
465 CompareActivationTest, armnn::ActivationFunction::BoundedReLu, 5u)
466ARMNN_COMPARE_REF_FIXTURE_TEST_CASE(CompareBoundedReLuActivationWithReferenceUint8, ActivationFixture,
467 CompareActivationUint8Test, armnn::ActivationFunction::BoundedReLu)
468
469ARMNN_COMPARE_REF_FIXTURE_TEST_CASE(CompareSoftReLuActivationWithReference, ActivationFixture,
470 CompareActivationTest, armnn::ActivationFunction::SoftReLu, 1u)
471
472ARMNN_COMPARE_REF_FIXTURE_TEST_CASE(CompareLeakyReLuActivationWithReference, ActivationFixture,
473 CompareActivationTest, armnn::ActivationFunction::LeakyReLu, 5u)
474
475ARMNN_COMPARE_REF_FIXTURE_TEST_CASE(CompareAbsActivationWithReference, ActivationFixture,
476 CompareActivationTest, armnn::ActivationFunction::Abs, 5u)
477
478ARMNN_COMPARE_REF_FIXTURE_TEST_CASE(CompareSqrtActivationWithReference, PositiveActivationFixture,
479 CompareActivationTest, armnn::ActivationFunction::Sqrt, 5u)
480
481ARMNN_COMPARE_REF_FIXTURE_TEST_CASE(CompareSquareActivationWithReference, ActivationFixture,
482 CompareActivationTest, armnn::ActivationFunction::Square, 5u)
telsoa014fcda012018-03-09 14:13:49 +0000483BOOST_AUTO_TEST_SUITE_END()