blob: f0410f25c583a79ba86ec6539b834c4edd9b0485 [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//
telsoa014fcda012018-03-09 14:13:49 +00005
Aron Virginas-Tar56055192018-11-12 18:10:43 +00006#include "NeonWorkloadFactoryHelper.hpp"
7
Aron Virginas-Tarc9cc8042018-11-01 16:15:57 +00008#include <test/TensorHelpers.hpp>
9#include <test/UnitTests.hpp>
telsoa014fcda012018-03-09 14:13:49 +000010
Aron Virginas-Tarc9cc8042018-11-01 16:15:57 +000011#include <backendsCommon/CpuTensorHandle.hpp>
12#include <neon/NeonLayerSupport.hpp>
13#include <neon/NeonWorkloadFactory.hpp>
14#include <reference/RefWorkloadFactory.hpp>
15#include <backendsCommon/test/ActivationFixture.hpp>
16#include <backendsCommon/test/LayerTests.hpp>
17#include <backendsCommon/test/TensorCopyUtils.hpp>
18#include <backendsCommon/test/WorkloadTestUtils.hpp>
telsoa014fcda012018-03-09 14:13:49 +000019
arovir0143095f32018-10-09 18:04:24 +010020#include <boost/test/unit_test.hpp>
telsoa014fcda012018-03-09 14:13:49 +000021
22BOOST_AUTO_TEST_SUITE(Compute_ArmComputeNeon)
23using FactoryType = armnn::NeonWorkloadFactory;
24
25// ============================================================================
26// UNIT tests
27
28// Convolution
29ARMNN_AUTO_TEST_CASE(SimpleConvolution1d, Convolution1dTest, true)
30
jimfly010a088a62018-10-25 17:05:05 +010031ARMNN_AUTO_TEST_CASE(SimpleConvolution2d, SimpleConvolution2d3x5Test, true, armnn::DataLayout::NCHW)
32ARMNN_AUTO_TEST_CASE(SimpleConvolution2dNhwc, SimpleConvolution2d3x5Test, true, armnn::DataLayout::NHWC)
narpra015f703182018-10-26 16:24:58 +010033ARMNN_AUTO_TEST_CASE(SimpleConvolution2d3x3Uint8, SimpleConvolution2d3x3Uint8Test, true, armnn::DataLayout::NCHW)
34ARMNN_AUTO_TEST_CASE(SimpleConvolution2d3x3Uint8Nhwc, SimpleConvolution2d3x3Uint8Test, true, armnn::DataLayout::NHWC)
jimfly010a088a62018-10-25 17:05:05 +010035ARMNN_AUTO_TEST_CASE(UnbiasedConvolution2d, SimpleConvolution2d3x5Test, false, armnn::DataLayout::NCHW)
36ARMNN_AUTO_TEST_CASE(UnbiasedConvolution2dNhwc, SimpleConvolution2d3x5Test, false, armnn::DataLayout::NHWC)
37
narpra015f703182018-10-26 16:24:58 +010038ARMNN_AUTO_TEST_CASE(UnbiasedConvolution2dSquare, SimpleConvolution2d3x3Test, false, armnn::DataLayout::NCHW)
39ARMNN_AUTO_TEST_CASE(SimpleConvolution2dAsymmetricPadding, Convolution2dAsymmetricPaddingTest, armnn::DataLayout::NCHW)
40
41ARMNN_AUTO_TEST_CASE(UnbiasedConvolution2dSquareNhwc, SimpleConvolution2d3x3Test, false, armnn::DataLayout::NHWC)
42ARMNN_AUTO_TEST_CASE(SimpleConvolution2dAsymmetricPaddingNhwc,
43 Convolution2dAsymmetricPaddingTest,
44 armnn::DataLayout::NHWC)
telsoa014fcda012018-03-09 14:13:49 +000045
Francis Murtaghd59116e2018-10-04 16:03:07 +010046ARMNN_AUTO_TEST_CASE(SimpleConvolution2dSquareNhwc, SimpleConvolution2d3x3NhwcTest, false)
telsoa014fcda012018-03-09 14:13:49 +000047
48// Depthwise Convolution
jimfly01b9c89632018-10-26 16:50:13 +010049ARMNN_AUTO_TEST_CASE(DepthwiseConvolution2dDepthMul1,
50 DepthwiseConvolution2dDepthMul1Test, true, armnn::DataLayout::NCHW)
51ARMNN_AUTO_TEST_CASE(UnbiasedDepthwiseConvolution2dDepthMul1,
52 DepthwiseConvolution2dDepthMul1Test, false, armnn::DataLayout::NCHW)
53ARMNN_AUTO_TEST_CASE(DepthwiseConvolution2dDepthMul1Uint8,
54 DepthwiseConvolution2dDepthMul1Uint8Test, true, armnn::DataLayout::NCHW)
55ARMNN_AUTO_TEST_CASE(UnbiasedDepthwiseConvolution2dDepthMul1Uint8,
56 DepthwiseConvolution2dDepthMul1Uint8Test, false, armnn::DataLayout::NCHW)
57
58// NHWC Depthwise Convolution
59ARMNN_AUTO_TEST_CASE(DepthwiseConvolution2dDepthMul1NHhwc,
60 DepthwiseConvolution2dDepthMul1Test, true, armnn::DataLayout::NHWC)
61ARMNN_AUTO_TEST_CASE(UnbiasedDepthwiseConvolution2dDepthMul1Nhwc,
62 DepthwiseConvolution2dDepthMul1Test, false, armnn::DataLayout::NHWC)
63ARMNN_AUTO_TEST_CASE(DepthwiseConvolution2dDepthMul1Uint8Nhwc,
64 DepthwiseConvolution2dDepthMul1Uint8Test, true, armnn::DataLayout::NHWC)
65ARMNN_AUTO_TEST_CASE(UnbiasedDepthwiseConvolution2dDepthMul1Uint8Nhwc,
66 DepthwiseConvolution2dDepthMul1Uint8Test, false, armnn::DataLayout::NHWC)
67
Nikhil Rajcec6b652018-10-12 13:51:57 +010068ARMNN_AUTO_TEST_CASE(DepthwiseConvolution2dDepthNhwc, DepthwiseConvolution2dDepthNhwcTest, false)
jimfly01b9c89632018-10-26 16:50:13 +010069
telsoa014fcda012018-03-09 14:13:49 +000070
jimfly01382a91d2018-10-26 15:55:50 +010071ARMNN_AUTO_TEST_CASE(DepthwiseConvolution2dAsymmetric,
72 DepthwiseConvolution2dAsymmetricTest, true, armnn::DataLayout::NCHW)
73ARMNN_AUTO_TEST_CASE(UnbiasedDepthwiseConvolution2dAsymmetric,
74 DepthwiseConvolution2dAsymmetricTest, false, armnn::DataLayout::NCHW)
75ARMNN_AUTO_TEST_CASE(DepthwiseConvolution2dAsymmetricNhwc,
76 DepthwiseConvolution2dAsymmetricTest, true, armnn::DataLayout::NHWC)
77ARMNN_AUTO_TEST_CASE(UnbiasedDepthwiseConvolution2dAsymmetricNhwc,
78 DepthwiseConvolution2dAsymmetricTest, false, armnn::DataLayout::NHWC)
surmeh013537c2c2018-05-18 16:31:43 +010079
telsoa014fcda012018-03-09 14:13:49 +000080namespace
81{
82
83armnn::DepthwiseConvolution2dDescriptor MakeDepthwiseConv2dDesc(uint32_t strideX, uint32_t strideY,
84 uint32_t depthMultiplier = 1, uint32_t padLeft = 0, uint32_t padRight = 0,
85 uint32_t padTop = 0, uint32_t padBottom = 0)
86{
telsoa01c577f2c2018-08-31 09:22:23 +010087 boost::ignore_unused(depthMultiplier);
88
telsoa014fcda012018-03-09 14:13:49 +000089 armnn::DepthwiseConvolution2dDescriptor desc;
telsoa01c577f2c2018-08-31 09:22:23 +010090
telsoa014fcda012018-03-09 14:13:49 +000091 desc.m_PadLeft = padLeft;
92 desc.m_PadRight = padRight;
telsoa01c577f2c2018-08-31 09:22:23 +010093
telsoa014fcda012018-03-09 14:13:49 +000094 desc.m_PadTop = padTop;
95 desc.m_PadBottom = padBottom;
96 desc.m_StrideX = strideX;
97 desc.m_StrideY = strideY;
telsoa01c577f2c2018-08-31 09:22:23 +010098 desc.m_BiasEnabled = false;
99
telsoa014fcda012018-03-09 14:13:49 +0000100 return desc;
101}
102
telsoa01c577f2c2018-08-31 09:22:23 +0100103armnn::TensorInfo CreateOutputTensorInfo(const armnn::TensorInfo& inputInfo,
104 const armnn::TensorInfo& weightsInfo,
105 const armnn::DepthwiseConvolution2dDescriptor& descriptor,
106 armnn::DataType dataType)
107{
108 const armnn::TensorShape& inputShape = inputInfo.GetShape();
109 const armnn::TensorShape& filterShape = weightsInfo.GetShape();
110
111 unsigned int inWidth = inputShape[3];
112 unsigned int inHeight = inputShape[2];
113 unsigned int inBatchSize = inputShape[0];
114
115 unsigned int filterWidth = filterShape[3];
116 unsigned int readWidth = (inWidth + descriptor.m_PadLeft + descriptor.m_PadRight) - (filterWidth);
117 unsigned int outWidth = 1u + (readWidth / descriptor.m_StrideX);
118
119 unsigned int filterHeight = filterShape[2];
120 unsigned int readHeight = (inHeight + descriptor.m_PadTop + descriptor.m_PadBottom) - (filterHeight);
121 unsigned int outHeight = 1u + (readHeight / descriptor.m_StrideY);
122 unsigned int depthMultiplier = filterShape[0];
123
124 unsigned int outChannels = filterShape[1] * depthMultiplier;
125 unsigned int outBatchSize = inBatchSize;
126
127 armnn::TensorShape outputShape({outBatchSize, outChannels, outHeight, outWidth});
128 return armnn::TensorInfo(outputShape, dataType);
129}
telsoa014fcda012018-03-09 14:13:49 +0000130}
131
132BOOST_AUTO_TEST_CASE(DepthwiseConv2dUtils)
133{
telsoa01c577f2c2018-08-31 09:22:23 +0100134 const armnn::DataType dataType = armnn::DataType::Float32;
135
136 armnn::TensorInfo inputInfo({1, 1, 10, 10 }, dataType);
137 armnn::TensorInfo outputInfo;
138 armnn::TensorInfo weightsInfo3x3({ 1, 1, 3, 3 }, dataType);
139 armnn::TensorInfo biasesInfo;
140
141 armnn::DepthwiseConvolution2dDescriptor descriptor;
Aron Virginas-Tarfc824312018-10-15 15:00:13 +0100142 armnn::NeonLayerSupport layerSupport;
telsoa014fcda012018-03-09 14:13:49 +0000143
144 // Strides supported: 1,2,3
telsoa01c577f2c2018-08-31 09:22:23 +0100145 descriptor = MakeDepthwiseConv2dDesc(1, 1);
146 outputInfo = CreateOutputTensorInfo(inputInfo, weightsInfo3x3, descriptor, dataType);
Aron Virginas-Tarfc824312018-10-15 15:00:13 +0100147 BOOST_TEST(layerSupport.IsDepthwiseConvolutionSupported(inputInfo, outputInfo, descriptor,
148 weightsInfo3x3, biasesInfo));
telsoa014fcda012018-03-09 14:13:49 +0000149
telsoa01c577f2c2018-08-31 09:22:23 +0100150 descriptor = MakeDepthwiseConv2dDesc(1, 2);
151 outputInfo = CreateOutputTensorInfo(inputInfo, weightsInfo3x3, descriptor, dataType);
Aron Virginas-Tarfc824312018-10-15 15:00:13 +0100152 BOOST_TEST(layerSupport.IsDepthwiseConvolutionSupported(inputInfo, outputInfo, descriptor,
153 weightsInfo3x3, biasesInfo));
telsoa01c577f2c2018-08-31 09:22:23 +0100154
155 descriptor = MakeDepthwiseConv2dDesc(1, 3);
156 outputInfo = CreateOutputTensorInfo(inputInfo, weightsInfo3x3, descriptor, dataType);
Aron Virginas-Tarfc824312018-10-15 15:00:13 +0100157 BOOST_TEST(layerSupport.IsDepthwiseConvolutionSupported(inputInfo, outputInfo, descriptor,
158 weightsInfo3x3, biasesInfo));
telsoa01c577f2c2018-08-31 09:22:23 +0100159
160 descriptor = MakeDepthwiseConv2dDesc(2, 1);
161 outputInfo = CreateOutputTensorInfo(inputInfo, weightsInfo3x3, descriptor, dataType);
Aron Virginas-Tarfc824312018-10-15 15:00:13 +0100162 BOOST_TEST(layerSupport.IsDepthwiseConvolutionSupported(inputInfo, outputInfo, descriptor,
163 weightsInfo3x3, biasesInfo));
telsoa01c577f2c2018-08-31 09:22:23 +0100164
165 descriptor = MakeDepthwiseConv2dDesc(2, 2);
166 outputInfo = CreateOutputTensorInfo(inputInfo, weightsInfo3x3, descriptor, dataType);
Aron Virginas-Tarfc824312018-10-15 15:00:13 +0100167 BOOST_TEST(layerSupport.IsDepthwiseConvolutionSupported(inputInfo, outputInfo, descriptor,
168 weightsInfo3x3, biasesInfo));
telsoa01c577f2c2018-08-31 09:22:23 +0100169
170 descriptor = MakeDepthwiseConv2dDesc(2, 3);
171 outputInfo = CreateOutputTensorInfo(inputInfo, weightsInfo3x3, descriptor, dataType);
Aron Virginas-Tarfc824312018-10-15 15:00:13 +0100172 BOOST_TEST(layerSupport.IsDepthwiseConvolutionSupported(inputInfo, outputInfo, descriptor,
173 weightsInfo3x3, biasesInfo));
telsoa01c577f2c2018-08-31 09:22:23 +0100174
175 descriptor = MakeDepthwiseConv2dDesc(3, 1);
176 outputInfo = CreateOutputTensorInfo(inputInfo, weightsInfo3x3, descriptor, dataType);
Aron Virginas-Tarfc824312018-10-15 15:00:13 +0100177 BOOST_TEST(layerSupport.IsDepthwiseConvolutionSupported(inputInfo, outputInfo, descriptor,
178 weightsInfo3x3, biasesInfo));
telsoa01c577f2c2018-08-31 09:22:23 +0100179
180 descriptor = MakeDepthwiseConv2dDesc(3, 2);
181 outputInfo = CreateOutputTensorInfo(inputInfo, weightsInfo3x3, descriptor, dataType);
Aron Virginas-Tarfc824312018-10-15 15:00:13 +0100182 BOOST_TEST(layerSupport.IsDepthwiseConvolutionSupported(inputInfo, outputInfo, descriptor,
183 weightsInfo3x3, biasesInfo));
telsoa01c577f2c2018-08-31 09:22:23 +0100184
185 descriptor = MakeDepthwiseConv2dDesc(3, 3);
186 outputInfo = CreateOutputTensorInfo(inputInfo, weightsInfo3x3, descriptor, dataType);
Aron Virginas-Tarfc824312018-10-15 15:00:13 +0100187 BOOST_TEST(layerSupport.IsDepthwiseConvolutionSupported(inputInfo, outputInfo, descriptor,
188 weightsInfo3x3, biasesInfo));
telsoa01c577f2c2018-08-31 09:22:23 +0100189
190 // Supported stride 4
191 descriptor = MakeDepthwiseConv2dDesc(4, 1);
192 outputInfo = CreateOutputTensorInfo(inputInfo, weightsInfo3x3, descriptor, dataType);
Aron Virginas-Tarfc824312018-10-15 15:00:13 +0100193 BOOST_TEST(layerSupport.IsDepthwiseConvolutionSupported(inputInfo, outputInfo, descriptor,
194 weightsInfo3x3, biasesInfo));
telsoa014fcda012018-03-09 14:13:49 +0000195
196 // Supported weights shape 1x1
197 armnn::TensorInfo weightsInfo1x1({ 1, 1, 1, 1 }, armnn::DataType::Float32);
telsoa01c577f2c2018-08-31 09:22:23 +0100198 descriptor = MakeDepthwiseConv2dDesc(1, 1);
199 outputInfo = CreateOutputTensorInfo(inputInfo, weightsInfo1x1, descriptor, dataType);
Aron Virginas-Tarfc824312018-10-15 15:00:13 +0100200 BOOST_TEST(layerSupport.IsDepthwiseConvolutionSupported(inputInfo, outputInfo, descriptor,
201 weightsInfo1x1, biasesInfo));
telsoa014fcda012018-03-09 14:13:49 +0000202
203 // Supported shape 2x2
204 armnn::TensorInfo weightsInfo2x2({ 1, 1, 2, 2 }, armnn::DataType::Float32);
telsoa01c577f2c2018-08-31 09:22:23 +0100205 descriptor = MakeDepthwiseConv2dDesc(1, 1);
206 outputInfo = CreateOutputTensorInfo(inputInfo, weightsInfo2x2, descriptor, dataType);
Aron Virginas-Tarfc824312018-10-15 15:00:13 +0100207 BOOST_TEST(layerSupport.IsDepthwiseConvolutionSupported(inputInfo, outputInfo, descriptor,
208 weightsInfo2x2, biasesInfo));
surmeh013537c2c2018-05-18 16:31:43 +0100209
210 // Asymmetric padding
telsoa01c577f2c2018-08-31 09:22:23 +0100211 descriptor = MakeDepthwiseConv2dDesc(1, 1, 1, 1, 2, 1, 2);
212 outputInfo = CreateOutputTensorInfo(inputInfo, weightsInfo3x3, descriptor, dataType);
Aron Virginas-Tarfc824312018-10-15 15:00:13 +0100213 BOOST_TEST(layerSupport.IsDepthwiseConvolutionSupported(inputInfo, outputInfo, descriptor,
214 weightsInfo3x3, biasesInfo));
telsoa014fcda012018-03-09 14:13:49 +0000215}
216
217// Pooling
218ARMNN_AUTO_TEST_CASE(SimpleMaxPooling2dSize3x3Stride2x4, SimpleMaxPooling2dSize3x3Stride2x4Test, true)
219ARMNN_AUTO_TEST_CASE(SimpleMaxPooling2dSize3x3Stride2x4Uint8, SimpleMaxPooling2dSize3x3Stride2x4Uint8Test, true)
James Conroy45a9b772018-10-31 11:47:53 +0000220
221ARMNN_AUTO_TEST_CASE(SimpleMaxPooling2d, SimpleMaxPooling2dTest, armnn::DataLayout::NCHW)
222ARMNN_AUTO_TEST_CASE(SimpleMaxPooling2dNhwc, SimpleMaxPooling2dTest, armnn::DataLayout::NHWC)
223ARMNN_AUTO_TEST_CASE(SimpleMaxPooling2dUint8, SimpleMaxPooling2dUint8Test, armnn::DataLayout::NCHW)
224ARMNN_AUTO_TEST_CASE(SimpleMaxPooling2dUint8Nhwc, SimpleMaxPooling2dUint8Test, armnn::DataLayout::NHWC)
225
226ARMNN_AUTO_TEST_CASE(SimpleAveragePooling2d, SimpleAveragePooling2dTest, armnn::DataLayout::NCHW)
227ARMNN_AUTO_TEST_CASE(SimpleAveragePooling2dNhwc, SimpleAveragePooling2dTest, armnn::DataLayout::NCHW)
228ARMNN_AUTO_TEST_CASE(SimpleAveragePooling2dUint8, SimpleAveragePooling2dUint8Test, armnn::DataLayout::NCHW)
229ARMNN_AUTO_TEST_CASE(SimpleAveragePooling2dUint8Nhwc, SimpleAveragePooling2dUint8Test, armnn::DataLayout::NHWC)
surmeh01bceff2f2018-03-29 16:29:27 +0100230
telsoa014fcda012018-03-09 14:13:49 +0000231ARMNN_AUTO_TEST_CASE(LargeTensorsAveragePooling2d, LargeTensorsAveragePooling2dTest)
232ARMNN_AUTO_TEST_CASE(LargeTensorsAveragePooling2dUint8, LargeTensorsAveragePooling2dUint8Test)
233
James Conroy45a9b772018-10-31 11:47:53 +0000234ARMNN_AUTO_TEST_CASE(SimpleL2Pooling2d, SimpleL2Pooling2dTest, armnn::DataLayout::NCHW)
235ARMNN_AUTO_TEST_CASE(SimpleL2Pooling2dNeon, SimpleL2Pooling2dTest, armnn::DataLayout::NHWC)
236ARMNN_AUTO_TEST_CASE(UNSUPPORTED_SimpleL2Pooling2dUint8, SimpleL2Pooling2dUint8Test, armnn::DataLayout::NCHW)
237
telsoa014fcda012018-03-09 14:13:49 +0000238ARMNN_AUTO_TEST_CASE(L2Pooling2dSize3Stride1, L2Pooling2dSize3Stride1Test)
239ARMNN_AUTO_TEST_CASE(UNSUPPORTED_L2Pooling2dSize3Stride1Uint8, L2Pooling2dSize3Stride1Uint8Test)
240ARMNN_AUTO_TEST_CASE(L2Pooling2dSize3Stride3, L2Pooling2dSize3Stride3Test)
241ARMNN_AUTO_TEST_CASE(UNSUPPORTED_L2Pooling2dSize3Stride3Uint8, L2Pooling2dSize3Stride3Uint8Test)
242ARMNN_AUTO_TEST_CASE(L2Pooling2dSize3Stride4, L2Pooling2dSize3Stride4Test)
243ARMNN_AUTO_TEST_CASE(UNSUPPORTED_L2Pooling2dSize3Stride4Uint8, L2Pooling2dSize3Stride4Uint8Test)
244ARMNN_AUTO_TEST_CASE(L2Pooling2dSize7, L2Pooling2dSize7Test)
245ARMNN_AUTO_TEST_CASE(UNSUPPORTED_L2Pooling2dSize7Uint8, L2Pooling2dSize7Uint8Test)
246ARMNN_AUTO_TEST_CASE(L2Pooling2dSize9, L2Pooling2dSize9Test)
247ARMNN_AUTO_TEST_CASE(UNSUPPORTED_L2Pooling2dSize9Uint8, L2Pooling2dSize9Uint8Test)
248
249// Ignore padding values for pooling but count padding fields into the divisor
250ARMNN_AUTO_TEST_CASE(IgnorePaddingSimpleMaxPooling2d, IgnorePaddingSimpleMaxPooling2dTest)
251ARMNN_AUTO_TEST_CASE(IgnorePaddingSimpleMaxPooling2dUint8, IgnorePaddingSimpleMaxPooling2dUint8Test)
252ARMNN_AUTO_TEST_CASE(IgnorePaddingMaxPooling2dSize3, IgnorePaddingMaxPooling2dSize3Test)
253ARMNN_AUTO_TEST_CASE(IgnorePaddingMaxPooling2dSize3Uint8, IgnorePaddingMaxPooling2dSize3Uint8Test)
254
255ARMNN_AUTO_TEST_CASE(IgnorePaddingSimpleAveragePooling2d, IgnorePaddingSimpleAveragePooling2dTest)
256ARMNN_AUTO_TEST_CASE(IgnorePaddingSimpleAveragePooling2dUint8, IgnorePaddingSimpleAveragePooling2dUint8Test)
257ARMNN_AUTO_TEST_CASE(IgnorePaddingSimpleAveragePooling2dNoPadding, IgnorePaddingSimpleAveragePooling2dNoPaddingTest)
258ARMNN_AUTO_TEST_CASE(IgnorePaddingSimpleAveragePooling2dNoPaddingUint8,
259 IgnorePaddingSimpleAveragePooling2dNoPaddingUint8Test)
260ARMNN_AUTO_TEST_CASE(IgnorePaddingAveragePooling2dSize3, IgnorePaddingAveragePooling2dSize3Test)
261ARMNN_AUTO_TEST_CASE(IgnorePaddingAveragePooling2dSize3Uint8, IgnorePaddingAveragePooling2dSize3Uint8Test)
surmeh01bceff2f2018-03-29 16:29:27 +0100262ARMNN_AUTO_TEST_CASE(IgnorePaddingAveragePooling2dSize3x2Stride2x2,
263 IgnorePaddingAveragePooling2dSize3x2Stride2x2Test, false)
264ARMNN_AUTO_TEST_CASE(IgnorePaddingAveragePooling2dSize3x2Stride2x2NoPadding,
265 IgnorePaddingAveragePooling2dSize3x2Stride2x2Test,
266 true)
telsoa014fcda012018-03-09 14:13:49 +0000267
268ARMNN_AUTO_TEST_CASE(IgnorePaddingSimpleL2Pooling2d, IgnorePaddingSimpleL2Pooling2dTest)
269ARMNN_AUTO_TEST_CASE(UNSUPPORTED_IgnorePaddingSimpleL2Pooling2dUint8, IgnorePaddingSimpleL2Pooling2dUint8Test)
270ARMNN_AUTO_TEST_CASE(IgnorePaddingL2Pooling2dSize3, IgnorePaddingL2Pooling2dSize3Test)
271ARMNN_AUTO_TEST_CASE(UNSUPPORTED_IgnorePaddingL2Pooling2dSize3Uint8, IgnorePaddingL2Pooling2dSize3Uint8Test)
272
273// Activation
274ARMNN_AUTO_TEST_CASE(ConstantLinearActivation, ConstantLinearActivationTest)
275
276ARMNN_AUTO_TEST_CASE(SimpleSoftmaxBeta1, SimpleSoftmaxTest, 1.0f)
277ARMNN_AUTO_TEST_CASE(SimpleSoftmaxBeta2, SimpleSoftmaxTest, 2.0f)
278
279ARMNN_AUTO_TEST_CASE(SimpleSoftmaxBeta1Uint8, SimpleSoftmaxUint8Test, 1.0f)
280ARMNN_AUTO_TEST_CASE(SimpleSoftmaxBeta2Uint8, SimpleSoftmaxUint8Test, 2.0f)
281
282ARMNN_AUTO_TEST_CASE(ReLu1Uint8, BoundedReLuUint8UpperAndLowerBoundTest)
283ARMNN_AUTO_TEST_CASE(ReLu6Uint8, BoundedReLuUint8UpperBoundOnlyTest)
284
telsoa01c577f2c2018-08-31 09:22:23 +0100285// Softmax
286BOOST_AUTO_TEST_CASE(Softmax4dSupport)
telsoa014fcda012018-03-09 14:13:49 +0000287{
telsoa01c577f2c2018-08-31 09:22:23 +0100288 const unsigned int numDimensions = 4u;
289 std::array<unsigned int, numDimensions> dimensionSizes;
290 dimensionSizes.fill(1u);
291
292 const armnn::TensorInfo inputInfo(numDimensions, &dimensionSizes.front(), armnn::DataType::Float32);
293 const armnn::TensorInfo outputInfo(numDimensions, &dimensionSizes.front(), armnn::DataType::Float32);
294
295 // 4D Softmax should be reported as unsupported on the NEON backend
Aron Virginas-Tarfc824312018-10-15 15:00:13 +0100296 armnn::NeonLayerSupport layerSupport;
297 BOOST_TEST(!layerSupport.IsSoftmaxSupported(inputInfo, outputInfo, armnn::SoftmaxDescriptor()));
telsoa014fcda012018-03-09 14:13:49 +0000298}
299
telsoa01c577f2c2018-08-31 09:22:23 +0100300// Splitter
301ARMNN_AUTO_TEST_CASE(SimpleSplitter, SplitterTest)
302ARMNN_AUTO_TEST_CASE(SimpleSplitterUint8, SplitterUint8Test)
telsoa014fcda012018-03-09 14:13:49 +0000303
304ARMNN_AUTO_TEST_CASE(CopyViaSplitter, CopyViaSplitterTest)
305ARMNN_AUTO_TEST_CASE(CopyViaSplitterUint8, CopyViaSplitterUint8Test)
306
307// Merger
308ARMNN_AUTO_TEST_CASE(SimpleMerger, MergerTest)
309ARMNN_AUTO_TEST_CASE(MergerUint8, MergerUint8Test)
310
311// Fully Connected
312ARMNN_AUTO_TEST_CASE(SimpleFullyConnected, FullyConnectedFloat32Test, false, false)
313ARMNN_AUTO_TEST_CASE(SimpleFullyConnectedWithBias, FullyConnectedFloat32Test, true, false)
314ARMNN_AUTO_TEST_CASE(SimpleFullyConnectedWithTranspose, FullyConnectedFloat32Test, false, true)
315ARMNN_AUTO_TEST_CASE(FullyConnectedLarge, FullyConnectedLargeTest, false)
316ARMNN_AUTO_TEST_CASE(FullyConnectedLargeTransposed, FullyConnectedLargeTest, true)
kevmay01e448be32018-09-26 10:21:55 +0100317ARMNN_AUTO_TEST_CASE(FullyConnectedUint8, FullyConnectedUint8Test, false)
318ARMNN_AUTO_TEST_CASE(FullyConnectedBiasedUint8, FullyConnectedUint8Test, true)
telsoa014fcda012018-03-09 14:13:49 +0000319
320// Add
321ARMNN_AUTO_TEST_CASE(SimpleAdd, AdditionTest)
David Beckbc392452018-09-10 14:47:28 +0100322ARMNN_AUTO_TEST_CASE(AddBroadcast, AdditionBroadcastTest)
telsoa014fcda012018-03-09 14:13:49 +0000323ARMNN_AUTO_TEST_CASE(AddBroadcast1Element, AdditionBroadcast1ElementTest)
324
David Beckbc392452018-09-10 14:47:28 +0100325// Sub
326ARMNN_AUTO_TEST_CASE(SimpleSub, SubtractionTest)
327
telsoa014fcda012018-03-09 14:13:49 +0000328// Mul
329ARMNN_AUTO_TEST_CASE(SimpleMultiplication, MultiplicationTest)
surmeh013537c2c2018-05-18 16:31:43 +0100330ARMNN_AUTO_TEST_CASE(MultiplicationBroadcast1Element, MultiplicationBroadcast1ElementTest)
331ARMNN_AUTO_TEST_CASE(MultiplicationBroadcast1DVector, MultiplicationBroadcast1DVectorTest)
telsoa014fcda012018-03-09 14:13:49 +0000332
333// Batch Norm
334ARMNN_AUTO_TEST_CASE(BatchNorm, BatchNormTest)
Nikhil Rajd1340932018-10-18 14:27:50 +0100335ARMNN_AUTO_TEST_CASE(BatchNormNhwc, BatchNormNhwcTest)
telsoa014fcda012018-03-09 14:13:49 +0000336
337// Constant
338ARMNN_AUTO_TEST_CASE(Constant, ConstantTest)
339ARMNN_AUTO_TEST_CASE(ConstantUint8, ConstantTestUint8)
340
341// Concatenation
342ARMNN_AUTO_TEST_CASE(Concatenation1d, Concatenation1dTest)
343ARMNN_AUTO_TEST_CASE(Concatenation1dUint8, Concatenation1dUint8Test)
344
345ARMNN_AUTO_TEST_CASE(Concatenation2dDim0, Concatenation2dDim0Test)
346ARMNN_AUTO_TEST_CASE(Concatenation2dDim0Uint8, Concatenation2dDim0Uint8Test)
347ARMNN_AUTO_TEST_CASE(Concatenation2dDim1, Concatenation2dDim1Test)
348ARMNN_AUTO_TEST_CASE(Concatenation2dDim1Uint8, Concatenation2dDim1Uint8Test)
349
350ARMNN_AUTO_TEST_CASE(Concatenation2dDim0DiffInputDims, Concatenation2dDim0DiffInputDimsTest)
351ARMNN_AUTO_TEST_CASE(Concatenation2dDim0DiffInputDimsUint8, Concatenation2dDim0DiffInputDimsUint8Test)
352ARMNN_AUTO_TEST_CASE(Concatenation2dDim1DiffInputDims, Concatenation2dDim1DiffInputDimsTest)
353ARMNN_AUTO_TEST_CASE(Concatenation2dDim1DiffInputDimsUint8, Concatenation2dDim1DiffInputDimsUint8Test)
354
355ARMNN_AUTO_TEST_CASE(Concatenation3dDim0, Concatenation3dDim0Test)
356ARMNN_AUTO_TEST_CASE(Concatenation3dDim0Uint8, Concatenation3dDim0Uint8Test)
357ARMNN_AUTO_TEST_CASE(Concatenation3dDim1, Concatenation3dDim1Test)
358ARMNN_AUTO_TEST_CASE(Concatenation3dDim1Uint8, Concatenation3dDim1Uint8Test)
359ARMNN_AUTO_TEST_CASE(Concatenation3dDim2, Concatenation3dDim2Test)
360ARMNN_AUTO_TEST_CASE(Concatenation3dDim2Uint8, Concatenation3dDim2Uint8Test)
361
362ARMNN_AUTO_TEST_CASE(Concatenation3dDim0DiffInputDims, Concatenation3dDim0DiffInputDimsTest)
363ARMNN_AUTO_TEST_CASE(Concatenation3dDim0DiffInputDimsUint8, Concatenation3dDim0DiffInputDimsUint8Test)
364ARMNN_AUTO_TEST_CASE(Concatenation3dDim1DiffInputDims, Concatenation3dDim1DiffInputDimsTest)
365ARMNN_AUTO_TEST_CASE(Concatenation3dDim1DiffInputDimsUint8, Concatenation3dDim1DiffInputDimsUint8Test)
366ARMNN_AUTO_TEST_CASE(Concatenation3dDim2DiffInputDims, Concatenation3dDim2DiffInputDimsTest)
367ARMNN_AUTO_TEST_CASE(Concatenation3dDim2DiffInputDimsUint8, Concatenation3dDim2DiffInputDimsUint8Test)
368
369// L2 Normalization
jimfly013aab7c32018-11-12 13:32:08 +0000370ARMNN_AUTO_TEST_CASE(L2Normalization1d, L2Normalization1dTest, armnn::DataLayout::NCHW)
371ARMNN_AUTO_TEST_CASE(L2Normalization2d, L2Normalization2dTest, armnn::DataLayout::NCHW)
372ARMNN_AUTO_TEST_CASE(L2Normalization3d, L2Normalization3dTest, armnn::DataLayout::NCHW)
373ARMNN_AUTO_TEST_CASE(L2Normalization4d, L2Normalization4dTest, armnn::DataLayout::NCHW)
Matteo Martincigh539b44d2018-10-01 09:26:39 +0100374
jimfly013aab7c32018-11-12 13:32:08 +0000375ARMNN_AUTO_TEST_CASE(L2Normalization1dNhwc, L2Normalization1dTest, armnn::DataLayout::NHWC)
376ARMNN_AUTO_TEST_CASE(L2Normalization2dNhwc, L2Normalization2dTest, armnn::DataLayout::NHWC)
377ARMNN_AUTO_TEST_CASE(L2Normalization3dNhwc, L2Normalization3dTest, armnn::DataLayout::NHWC)
378ARMNN_AUTO_TEST_CASE(L2Normalization4dNhwc, L2Normalization4dTest, armnn::DataLayout::NHWC)
telsoa014fcda012018-03-09 14:13:49 +0000379
380// Floor
381ARMNN_AUTO_TEST_CASE(SimpleFloor, SimpleFloorTest)
382
383// Reshape
384ARMNN_AUTO_TEST_CASE(SimpleReshapeFloat32, SimpleReshapeFloat32Test)
385ARMNN_AUTO_TEST_CASE(SimpleReshapeUint8, SimpleReshapeUint8Test)
386
387// Permute
388ARMNN_AUTO_TEST_CASE(SimplePermuteFloat32, SimplePermuteFloat32Test)
389ARMNN_AUTO_TEST_CASE(SimplePermuteUint8, SimplePermuteUint8Test)
surmeh01bceff2f2018-03-29 16:29:27 +0100390ARMNN_AUTO_TEST_CASE(PermuteFloat32ValueSet1, PermuteFloat32ValueSet1Test)
391ARMNN_AUTO_TEST_CASE(PermuteFloat32ValueSet2, PermuteFloat32ValueSet2Test)
392ARMNN_AUTO_TEST_CASE(PermuteFloat32ValueSet3, PermuteFloat32ValueSet3Test)
393
Les Bellde9011b2018-10-03 10:37:52 +0100394// Lstm
395ARMNN_AUTO_TEST_CASE(LstmLayerFloat32WithCifgWithPeepholeNoProjection,
396 LstmLayerFloat32WithCifgWithPeepholeNoProjectionTest)
397ARMNN_AUTO_TEST_CASE(LstmLayerFloat32NoCifgNoPeepholeNoProjection,
398 LstmLayerFloat32NoCifgNoPeepholeNoProjectionTest)
399ARMNN_AUTO_TEST_CASE(LstmLayerFloat32NoCifgWithPeepholeWithProjection,
400 LstmLayerFloat32NoCifgWithPeepholeWithProjectionTest)
401
narpra0155a97bc2018-10-02 14:35:53 +0100402// Normalization
403ARMNN_AUTO_TEST_CASE(SimpleNormalizationAcross, SimpleNormalizationAcrossTest)
404ARMNN_AUTO_TEST_CASE(SimpleNormalizationWithin, SimpleNormalizationWithinTest)
405ARMNN_AUTO_TEST_CASE(SimpleNormalizationAcrossNhwc, SimpleNormalizationAcrossNhwcTest)
406
telsoa014fcda012018-03-09 14:13:49 +0000407// ============================================================================
408// COMPARE tests
409
410ARMNN_COMPARE_REF_AUTO_TEST_CASE(CompareConv2dWithReference, CompareConvolution2dTest)
411
jimfly017af00da2018-10-31 14:43:53 +0000412ARMNN_COMPARE_REF_AUTO_TEST_CASE(CompareDepthwiseConv2dWithReferenceFloat32,
413 CompareDepthwiseConvolution2dTest<float>,
414 armnn::DataLayout::NCHW)
415ARMNN_COMPARE_REF_AUTO_TEST_CASE(CompareDepthwiseConv2dWithReferenceUint8,
416 CompareDepthwiseConvolution2dTest<uint8_t>,
417 armnn::DataLayout::NCHW)
418
419ARMNN_COMPARE_REF_AUTO_TEST_CASE(CompareDepthwiseConv2dWithReferenceFloat32Nhwc,
420 CompareDepthwiseConvolution2dTest<float>,
421 armnn::DataLayout::NHWC)
422ARMNN_COMPARE_REF_AUTO_TEST_CASE(CompareDepthwiseConv2dWithReferenceUint8Nhwc,
423 CompareDepthwiseConvolution2dTest<uint8_t>,
424 armnn::DataLayout::NHWC)
telsoa014fcda012018-03-09 14:13:49 +0000425
426ARMNN_COMPARE_REF_AUTO_TEST_CASE(CompareNormalizationWithinWithReference, CompareNormalizationTest,
427 armnn::NormalizationAlgorithmChannel::Within,
428 armnn::NormalizationAlgorithmMethod::LocalBrightness)
429ARMNN_COMPARE_REF_AUTO_TEST_CASE(CompareNormalizationAcrossWithReference, CompareNormalizationTest,
430 armnn::NormalizationAlgorithmChannel::Across,
431 armnn::NormalizationAlgorithmMethod::LocalBrightness)
432
433ARMNN_COMPARE_REF_AUTO_TEST_CASE(CompareMaxPooling2dWithReference, ComparePooling2dTest, armnn::PoolingAlgorithm::Max)
434ARMNN_COMPARE_REF_AUTO_TEST_CASE(CompareMaxPooling2dWithReferenceUint8, ComparePooling2dUint8Test,
435 armnn::PoolingAlgorithm::Max)
436ARMNN_COMPARE_REF_AUTO_TEST_CASE(CompareAveragePooling2dWithReference, ComparePooling2dTest,
437 armnn::PoolingAlgorithm::Average)
438ARMNN_COMPARE_REF_AUTO_TEST_CASE(CompareAveragePooling2dWithReferenceUint8, ComparePooling2dUint8Test,
439 armnn::PoolingAlgorithm::Average)
440ARMNN_COMPARE_REF_AUTO_TEST_CASE(CompareL2Pooling2dWithReference, ComparePooling2dTest, armnn::PoolingAlgorithm::L2)
441ARMNN_COMPARE_REF_AUTO_TEST_CASE(UNSUPPORTED_CompareL2Pooling2dWithReferenceUint8, ComparePooling2dUint8Test,
442 armnn::PoolingAlgorithm::L2)
443
444ARMNN_COMPARE_REF_AUTO_TEST_CASE(CompareSoftmaxBeta1WithReference, CompareSoftmaxTest, 1.0f)
445ARMNN_COMPARE_REF_AUTO_TEST_CASE(CompareSoftmaxBeta2WithReference, CompareSoftmaxTest, 2.0f)
446
447ARMNN_COMPARE_REF_AUTO_TEST_CASE(CompareSoftmaxUint8Beta1WithReference, CompareSoftmaxUint8Test, 1.0f)
448ARMNN_COMPARE_REF_AUTO_TEST_CASE(CompareSoftmaxUint8Beta2WithReference, CompareSoftmaxUint8Test, 2.0f)
449
450ARMNN_COMPARE_REF_AUTO_TEST_CASE(CompareAddition, CompareAdditionTest)
451
452ARMNN_COMPARE_REF_AUTO_TEST_CASE(CompareMultiplicationWithReference, CompareMultiplicationTest)
453
454ARMNN_COMPARE_REF_AUTO_TEST_CASE(CompareBatchNorm, CompareBatchNormTest)
455
456ARMNN_COMPARE_REF_AUTO_TEST_CASE(ReLu1, CompareBoundedReLuTest, 1.0f, -1.0f)
457ARMNN_COMPARE_REF_AUTO_TEST_CASE(ReLu6, CompareBoundedReLuTest, 6.0f, 0.0f)
458
459// ============================================================================
460// FIXTURE tests
461
462ARMNN_COMPARE_REF_FIXTURE_TEST_CASE(CompareSigmoidActivationWithReference, ActivationFixture,
463 CompareActivationTest, armnn::ActivationFunction::Sigmoid, 5u)
464
465ARMNN_COMPARE_REF_FIXTURE_TEST_CASE(CompareTanhActivationWithReference, ActivationFixture,
466 CompareActivationTest, armnn::ActivationFunction::TanH, 5u)
467
468ARMNN_COMPARE_REF_FIXTURE_TEST_CASE(CompareLinearActivationWithReference, ActivationFixture,
469 CompareActivationTest, armnn::ActivationFunction::Linear, 5u)
470
471ARMNN_COMPARE_REF_FIXTURE_TEST_CASE(CompareReLuActivationWithReference, ActivationFixture,
472 CompareActivationTest, armnn::ActivationFunction::ReLu, 5u)
473
474ARMNN_COMPARE_REF_FIXTURE_TEST_CASE(CompareBoundedReLuActivationWithReference, ActivationFixture,
475 CompareActivationTest, armnn::ActivationFunction::BoundedReLu, 5u)
476ARMNN_COMPARE_REF_FIXTURE_TEST_CASE(CompareBoundedReLuActivationWithReferenceUint8, ActivationFixture,
477 CompareActivationUint8Test, armnn::ActivationFunction::BoundedReLu)
478
479ARMNN_COMPARE_REF_FIXTURE_TEST_CASE(CompareSoftReLuActivationWithReference, ActivationFixture,
480 CompareActivationTest, armnn::ActivationFunction::SoftReLu, 1u)
481
482ARMNN_COMPARE_REF_FIXTURE_TEST_CASE(CompareLeakyReLuActivationWithReference, ActivationFixture,
483 CompareActivationTest, armnn::ActivationFunction::LeakyReLu, 5u)
484
485ARMNN_COMPARE_REF_FIXTURE_TEST_CASE(CompareAbsActivationWithReference, ActivationFixture,
486 CompareActivationTest, armnn::ActivationFunction::Abs, 5u)
487
488ARMNN_COMPARE_REF_FIXTURE_TEST_CASE(CompareSqrtActivationWithReference, PositiveActivationFixture,
489 CompareActivationTest, armnn::ActivationFunction::Sqrt, 5u)
490
491ARMNN_COMPARE_REF_FIXTURE_TEST_CASE(CompareSquareActivationWithReference, ActivationFixture,
492 CompareActivationTest, armnn::ActivationFunction::Square, 5u)
telsoa014fcda012018-03-09 14:13:49 +0000493BOOST_AUTO_TEST_SUITE_END()