ArmNN  NotReleased
MaximumTestImpl.hpp File Reference

Go to the source code of this file.

Functions

LayerTestResult< float, 4 > MaximumSimpleTest (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
LayerTestResult< float, 4 > MaximumBroadcast1ElementTest (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
LayerTestResult< float, 4 > MaximumBroadcast1DVectorTest (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
LayerTestResult< armnn::Half, 4 > MaximumFloat16Test (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
LayerTestResult< armnn::Half, 4 > MaximumBroadcast1ElementFloat16Test (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
LayerTestResult< armnn::Half, 4 > MaximumBroadcast1DVectorFloat16Test (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
LayerTestResult< uint8_t, 4 > MaximumUint8Test (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
LayerTestResult< uint8_t, 4 > MaximumBroadcast1ElementUint8Test (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
LayerTestResult< uint8_t, 4 > MaximumBroadcast1DVectorUint8Test (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
LayerTestResult< int16_t, 4 > MaximumInt16Test (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
LayerTestResult< int16_t, 4 > MaximumBroadcast1ElementInt16Test (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
LayerTestResult< int16_t, 4 > MaximumBroadcast1DVectorInt16Test (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 

Function Documentation

◆ MaximumBroadcast1DVectorFloat16Test()

LayerTestResult<armnn::Half, 4> MaximumBroadcast1DVectorFloat16Test ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 182 of file MaximumTestImpl.cpp.

185 {
186  using namespace half_float::literal;
187 
188  const unsigned int shape0[] = { 1, 2, 2, 3 };
189  const unsigned int shape1[] = { 1, 1, 1, 3 };
190 
191  std::vector<armnn::Half> input0 =
192  {
193  1._h, 2._h, 3._h, 4._h, 5._h, 6._h,
194  7._h, 8._h, 9._h, 10._h, 11._h, 12._h
195  };
196 
197  std::vector<armnn::Half> input1 = { 1._h, 2._h, 3._h };
198 
199  std::vector<armnn::Half> output =
200  {
201  1._h, 2._h, 3._h, 4._h, 5._h, 6._h,
202  7._h, 8._h, 9._h, 10._h, 11._h, 12._h
203  };
204 
205  return ElementwiseTestHelper<4, armnn::MaximumQueueDescriptor, armnn::DataType::Float16>(
206  workloadFactory,
207  memoryManager,
208  shape0,
209  input0,
210  shape1,
211  input1,
212  shape0,
213  output);
214 }

◆ MaximumBroadcast1DVectorInt16Test()

LayerTestResult<int16_t, 4> MaximumBroadcast1DVectorInt16Test ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 373 of file MaximumTestImpl.cpp.

376 {
377  const unsigned int shape0[] = { 1, 2, 2, 3 };
378  const unsigned int shape1[] = { 1, 1, 1, 3 };
379 
380  std::vector<int16_t> input0 =
381  {
382  1, 2, 3, 4, 5, 6,
383  7, 8, 9, 10, 11, 12
384  };
385 
386  std::vector<int16_t> input1 = { 1, 10, 3 };
387 
388  std::vector<int16_t> output =
389  {
390  1, 10, 3, 4, 10, 6,
391  7, 10, 9, 10, 11, 12
392  };
393 
394  return ElementwiseTestHelper<4, armnn::MaximumQueueDescriptor, armnn::DataType::QSymmS16>(
395  workloadFactory,
396  memoryManager,
397  shape0,
398  input0,
399  shape1,
400  input1,
401  shape0,
402  output);
403 }

◆ MaximumBroadcast1DVectorTest()

LayerTestResult<float, 4> MaximumBroadcast1DVectorTest ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 83 of file MaximumTestImpl.cpp.

86 {
87  const unsigned int shape0[] = { 1, 2, 2, 3 };
88  const unsigned int shape1[] = { 1, 1, 1, 3 };
89 
90  std::vector<float> input0 =
91  {
92  1.f, 2.f, 3.f, 4.f, 5.f, 6.f,
93  7.f, 8.f, 9.f, 10.f, 11.f, 12.f
94  };
95 
96  std::vector<float> input1 = { 1.f, 2.f, 3.f };
97 
98  std::vector<float> output =
99  {
100  1.f, 2.f, 3.f, 4.f, 5.f, 6.f,
101  7.f, 8.f, 9.f, 10.f, 11.f, 12.f
102  };
103 
104  return ElementwiseTestHelper<4, armnn::MaximumQueueDescriptor, armnn::DataType::Float32>(
105  workloadFactory,
106  memoryManager,
107  shape0,
108  input0,
109  shape1,
110  input1,
111  shape0,
112  output);
113 }

◆ MaximumBroadcast1DVectorUint8Test()

LayerTestResult<uint8_t, 4> MaximumBroadcast1DVectorUint8Test ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 284 of file MaximumTestImpl.cpp.

287 {
288  const unsigned int shape0[] = { 1, 2, 2, 3 };
289  const unsigned int shape1[] = { 1, 1, 1, 3 };
290 
291  std::vector<uint8_t> input0 =
292  {
293  1, 2, 3, 4, 5, 6,
294  7, 8, 9, 10, 11, 12
295  };
296 
297  std::vector<uint8_t> input1 = { 1, 10, 3 };
298 
299  std::vector<uint8_t> output = {
300  1, 10, 3, 4, 10, 6,
301  7, 10, 9, 10, 11, 12
302  };
303 
304  return ElementwiseTestHelper<4, armnn::MaximumQueueDescriptor, armnn::DataType::QAsymmU8>(
305  workloadFactory,
306  memoryManager,
307  shape0,
308  input0,
309  shape1,
310  input1,
311  shape0,
312  output);
313 }

◆ MaximumBroadcast1ElementFloat16Test()

LayerTestResult<armnn::Half, 4> MaximumBroadcast1ElementFloat16Test ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 156 of file MaximumTestImpl.cpp.

159 {
160  using namespace half_float::literal;
161 
162  unsigned int shape0[] = { 1, 2, 2, 2 };
163  unsigned int shape1[] = { 1, 1, 1, 1 };
164 
165  std::vector<armnn::Half> input0 = { 1._h, 2._h, 3._h, 4._h, 5._h, 6._h, 7._h, 8._h };
166 
167  std::vector<armnn::Half> input1 = { 2._h };
168 
169  std::vector<armnn::Half> output = { 2._h, 2._h, 3._h, 4._h, 5._h, 6._h, 7._h, 8._h };
170 
171  return ElementwiseTestHelper<4, armnn::MaximumQueueDescriptor, armnn::DataType::Float16>(
172  workloadFactory,
173  memoryManager,
174  shape0,
175  input0,
176  shape1,
177  input1,
178  shape0,
179  output);
180 }

◆ MaximumBroadcast1ElementInt16Test()

LayerTestResult<int16_t, 4> MaximumBroadcast1ElementInt16Test ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 341 of file MaximumTestImpl.cpp.

344 {
345  const unsigned int shape0[] = { 1, 2, 2, 3 };
346  const unsigned int shape1[] = { 1, 1, 1, 1 };
347 
348  std::vector<int16_t> input0 =
349  {
350  1, 2, 3, 4, 5, 6,
351  7, 8, 9, 10, 11, 12
352  };
353 
354  std::vector<int16_t> input1 = { 2 };
355 
356  std::vector<int16_t> output =
357  {
358  2, 2, 3, 4, 5, 6,
359  7, 8, 9, 10, 11, 12
360  };
361 
362  return ElementwiseTestHelper<4, armnn::MaximumQueueDescriptor, armnn::DataType::QSymmS16>(
363  workloadFactory,
364  memoryManager,
365  shape0,
366  input0,
367  shape1,
368  input1,
369  shape0,
370  output);
371 }

◆ MaximumBroadcast1ElementTest()

LayerTestResult<float, 4> MaximumBroadcast1ElementTest ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 59 of file MaximumTestImpl.cpp.

62 {
63  unsigned int shape0[] = { 1, 2, 2, 2 };
64  unsigned int shape1[] = { 1, 1, 1, 1 };
65 
66  std::vector<float> input0 = { 1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f };
67 
68  std::vector<float> input1 = { 2.f };
69 
70  std::vector<float> output = { 2.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f };
71 
72  return ElementwiseTestHelper<4, armnn::MaximumQueueDescriptor, armnn::DataType::Float32>(
73  workloadFactory,
74  memoryManager,
75  shape0,
76  input0,
77  shape1,
78  input1,
79  shape0,
80  output);
81 }

◆ MaximumBroadcast1ElementUint8Test()

LayerTestResult<uint8_t, 4> MaximumBroadcast1ElementUint8Test ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 252 of file MaximumTestImpl.cpp.

255 {
256  const unsigned int shape0[] = { 1, 2, 2, 3 };
257  const unsigned int shape1[] = { 1, 1, 1, 1 };
258 
259  std::vector<uint8_t> input0 =
260  {
261  1, 2, 3, 4, 5, 6,
262  7, 8, 9, 10, 11, 12
263  };
264 
265  std::vector<uint8_t> input1 = { 2 };
266 
267  std::vector<uint8_t> output =
268  {
269  2, 2, 3, 4, 5, 6,
270  7, 8, 9, 10, 11, 12
271  };
272 
273  return ElementwiseTestHelper<4, armnn::MaximumQueueDescriptor, armnn::DataType::QAsymmU8>(
274  workloadFactory,
275  memoryManager,
276  shape0,
277  input0,
278  shape1,
279  input1,
280  shape0,
281  output);
282 }

◆ MaximumFloat16Test()

LayerTestResult<armnn::Half, 4> MaximumFloat16Test ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 115 of file MaximumTestImpl.cpp.

117 {
118  using namespace half_float::literal;
119 
120  const unsigned int width = 2u;
121  const unsigned int height = 2u;
122  const unsigned int channelCount = 2u;
123  const unsigned int batchSize = 2u;
124 
125  unsigned int shape[] = { batchSize, channelCount, height, width };
126 
127  std::vector<armnn::Half> input0 =
128  {
129  1._h, 1._h, 1._h, 1._h, 5._h, 5._h, 5._h, 5._h,
130  3._h, 3._h, 3._h, 3._h, 4._h, 4._h, 4._h, 4._h
131  };
132 
133  std::vector<armnn::Half> input1 =
134  {
135  2._h, 2._h, 2._h, 2._h, 3._h, 3._h, 3._h, 3._h,
136  4._h, 4._h, 4._h, 4._h, 5._h, 5._h, 5._h, 5._h
137  };
138 
139  std::vector<armnn::Half> output =
140  {
141  2._h, 2._h, 2._h, 2._h, 5._h, 5._h, 5._h, 5._h,
142  4._h, 4._h, 4._h, 4._h, 5._h, 5._h, 5._h, 5._h
143  };
144 
145  return ElementwiseTestHelper<4, armnn::MaximumQueueDescriptor, armnn::DataType::Float16>(
146  workloadFactory,
147  memoryManager,
148  shape,
149  input0,
150  shape,
151  input1,
152  shape,
153  output);
154 }

◆ MaximumInt16Test()

LayerTestResult<int16_t, 4> MaximumInt16Test ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 315 of file MaximumTestImpl.cpp.

318 {
319  unsigned int shape[] = { 2, 2, 2, 2 };
320 
321  std::vector<int16_t> input0({ 1, 1, 1, 1, 6, 6, 6, 6,
322  3, 3, 3, 3, 4, 4, 4, 4 });
323 
324  std::vector<int16_t> input1({ 2, 2, 2, 2, 3, 3, 3, 3,
325  4, 4, 4, 4, 5, 5, 5, 5 });
326 
327  std::vector<int16_t> output({ 2, 2, 2, 2, 6, 6, 6, 6,
328  4, 4, 4, 4, 5, 5, 5, 5 });
329 
330  return ElementwiseTestHelper<4, armnn::MaximumQueueDescriptor, armnn::DataType::QSymmS16>(
331  workloadFactory,
332  memoryManager,
333  shape,
334  input0,
335  shape,
336  input1,
337  shape,
338  output);
339 }

◆ MaximumSimpleTest()

LayerTestResult<float, 4> MaximumSimpleTest ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 19 of file MaximumTestImpl.cpp.

21 {
22  boost::ignore_unused(memoryManager);
23  const unsigned int width = 2u;
24  const unsigned int height = 2u;
25  const unsigned int channelCount = 2u;
26  const unsigned int batchSize = 2u;
27 
28  unsigned int shape[] = { batchSize, channelCount, height, width };
29 
30  std::vector<float> input0 =
31  {
32  1.f, 1.f, 1.f, 1.f, 5.f, 5.f, 5.f, 5.f,
33  3.f, 3.f, 3.f, 3.f, 4.f, 4.f, 4.f, 4.f
34  };
35 
36  std::vector<float> input1 =
37  {
38  2.f, 2.f, 2.f, 2.f, 3.f, 3.f, 3.f, 3.f,
39  4.f, 4.f, 4.f, 4.f, 5.f, 5.f, 5.f, 5.f
40  };
41 
42  std::vector<float> output =
43  {
44  2.f, 2.f, 2.f, 2.f, 5.f, 5.f, 5.f, 5.f,
45  4.f, 4.f, 4.f, 4.f, 5.f, 5.f, 5.f, 5.f
46  };
47 
48  return ElementwiseTestHelper<4, armnn::MaximumQueueDescriptor, armnn::DataType::Float32>(
49  workloadFactory,
50  memoryManager,
51  shape,
52  input0,
53  shape,
54  input1,
55  shape,
56  output);
57 }

◆ MaximumUint8Test()

LayerTestResult<uint8_t, 4> MaximumUint8Test ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 216 of file MaximumTestImpl.cpp.

219 {
220  unsigned int shape[] = { 2, 2, 2, 2 };
221 
222  // See dequantized values to the right.
223  std::vector<uint8_t> input0 =
224  {
225  1, 1, 1, 1, 6, 6, 6, 6,
226  3, 3, 3, 3, 4, 4, 4, 4
227  };
228 
229  std::vector<uint8_t> input1 =
230  {
231  2, 2, 2, 2, 3, 3, 3, 3,
232  4, 4, 4, 4, 5, 5, 5, 5
233  };
234 
235  std::vector<uint8_t> output =
236  {
237  2, 2, 2, 2, 6, 6, 6, 6,
238  4, 4, 4, 4, 5, 5, 5, 5
239  };
240 
241  return ElementwiseTestHelper<4, armnn::MaximumQueueDescriptor, armnn::DataType::QAsymmU8>(
242  workloadFactory,
243  memoryManager,
244  shape,
245  input0,
246  shape,
247  input1,
248  shape,
249  output);
250 }