ArmNN
 20.08
BatchToSpaceNdTestImpl.hpp File Reference

Go to the source code of this file.

Functions

template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult< T, 4 > BatchToSpaceNdNhwcTest1 (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult< T, 4 > BatchToSpaceNdNhwcTest2 (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult< T, 4 > BatchToSpaceNdNhwcTest3 (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult< T, 4 > BatchToSpaceNdNhwcTest4 (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult< T, 4 > BatchToSpaceNdNhwcTest5 (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult< T, 4 > BatchToSpaceNdNhwcTest6 (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult< T, 4 > BatchToSpaceNdNhwcTest7 (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult< T, 4 > BatchToSpaceNdNchwTest1 (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult< T, 4 > BatchToSpaceNdNchwTest2 (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult< T, 4 > BatchToSpaceNdNchwTest3 (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult< T, 4 > BatchToSpaceNdNchwTest4 (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult< T, 4 > BatchToSpaceNdNchwTest5 (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult< T, 4 > BatchToSpaceNdNchwTest6 (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult< T, 4 > BatchToSpaceNdNchwTest7 (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager)
 

Function Documentation

◆ BatchToSpaceNdNchwTest1()

LayerTestResult<T, 4> BatchToSpaceNdNchwTest1 ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 275 of file BatchToSpaceNdTestImpl.hpp.

References armnn::NCHW.

278 {
279  const unsigned int inputShape[] = {4, 3, 1, 1};
280  const unsigned int outputShape[] = {1, 3, 2, 2};
281 
282  std::vector<float> input({1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f});
283 
284  std::vector<float> expectedOutput({
285  // Batch 0, Channel 0, Height (2) x Width (2)
286  1.0f, 4.0f,
287  7.0f, 10.0f,
288 
289  // Batch 0, Channel 1, Height (2) x Width (2)
290  2.0f, 5.0f,
291  8.0f, 11.0f,
292 
293  // Batch 0, Channel 2, Height (2) x Width (2)
294  3.0f, 6.0f,
295  9.0f, 12.0f,
296  });
297 
298  std::vector<unsigned int> blockShape({2, 2});
299  std::vector<std::pair<unsigned int, unsigned int>> crops = {{0, 0}, {0, 0}};
300 
301  return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager,
302  armnn::DataLayout::NCHW, inputShape, input, blockShape,
303  crops, outputShape, expectedOutput);
304 }

◆ BatchToSpaceNdNchwTest2()

LayerTestResult<T, 4> BatchToSpaceNdNchwTest2 ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 307 of file BatchToSpaceNdTestImpl.hpp.

References armnn::NCHW.

310 {
311  const unsigned int inputShape[] = {4, 1, 1, 1};
312  const unsigned int outputShape[] = {1, 1, 2, 2};
313 
314  std::vector<float> input({
315  // Batch 0, Height 0, Width (2) x Channel (1)
316  1.0f, 2.0f, 3.0f, 4.0f
317  });
318 
319  std::vector<float> expectedOutput({1.0f, 2.0f, 3.0f, 4.0f});
320 
321  std::vector<unsigned int> blockShape({2, 2});
322  std::vector<std::pair<unsigned int, unsigned int>> crops = {{0, 0}, {0, 0}};
323 
324  return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager,
325  armnn::DataLayout::NCHW, inputShape, input, blockShape,
326  crops, outputShape, expectedOutput);
327 }

◆ BatchToSpaceNdNchwTest3()

LayerTestResult<T, 4> BatchToSpaceNdNchwTest3 ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 330 of file BatchToSpaceNdTestImpl.hpp.

References armnn::NCHW.

333 {
334  const unsigned int inputShape[] = {4, 3, 1, 1};
335  const unsigned int outputShape[] = {1, 3, 2, 2};
336 
337  std::vector<float> input({1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f});
338 
339  std::vector<float> expectedOutput({
340  // Batch 0, Channel 0, Height (2) x Width (2)
341  1.0f, 7.0f,
342  2.0f, 8.0f,
343 
344  // Batch 0, Channel 1, Height (2) x Width (2)
345  3.0f, 9.0f,
346  4.0f, 10.0f,
347 
348  // Batch 0, Channel 2, Height (2) x Width (2)
349  5.0f, 11.0f,
350  6.0f, 12.0f,
351  });
352 
353  std::vector<unsigned int> blockShape({2, 2});
354  std::vector<std::pair<unsigned int, unsigned int>> crops = {{0, 0}, {0, 0}};
355 
356  return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager,
357  armnn::DataLayout::NCHW, inputShape, input, blockShape,
358  crops, outputShape, expectedOutput);
359 }

◆ BatchToSpaceNdNchwTest4()

LayerTestResult<T, 4> BatchToSpaceNdNchwTest4 ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 362 of file BatchToSpaceNdTestImpl.hpp.

References armnn::NCHW.

365 {
366  const unsigned int inputShape[] = {4, 3, 1, 1};
367  const unsigned int outputShape[] = {1, 3, 2, 2};
368 
369  std::vector<float> input({1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12});
370 
371  std::vector<float> expectedOutput({
372  // Batch 0, Channel 0, Height (2) x Width (2)
373  1, 4,
374  7, 10,
375 
376  // Batch 0, Channel 1, Height (2) x Width (2)
377  2, 5,
378  8, 11,
379 
380  // Batch 0, Channel 2, Height (2) x Width (2)
381  3, 6,
382  9, 12,
383  });
384 
385  std::vector<unsigned int> blockShape({2, 2});
386  std::vector<std::pair<unsigned int, unsigned int>> crops = {{0, 0}, {0, 0}};
387 
388  return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager,
389  armnn::DataLayout::NCHW, inputShape, input, blockShape,
390  crops, outputShape, expectedOutput);
391 }

◆ BatchToSpaceNdNchwTest5()

LayerTestResult<T, 4> BatchToSpaceNdNchwTest5 ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 394 of file BatchToSpaceNdTestImpl.hpp.

References armnn::NCHW.

397 {
398  const unsigned int inputShape[] = {4, 1, 1, 1};
399  const unsigned int outputShape[] = {1, 1, 2, 2};
400 
401  std::vector<float> input({
402  // Batch 0, Height 0, Width (2) x Channel (1)
403  1, 2, 3, 4
404  });
405 
406  std::vector<float> expectedOutput({1, 2, 3, 4});
407 
408  std::vector<unsigned int> blockShape({2, 2});
409  std::vector<std::pair<unsigned int, unsigned int>> crops = {{0, 0}, {0, 0}};
410 
411  return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager,
412  armnn::DataLayout::NCHW, inputShape, input, blockShape,
413  crops, outputShape, expectedOutput);
414 }

◆ BatchToSpaceNdNchwTest6()

LayerTestResult<T, 4> BatchToSpaceNdNchwTest6 ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 417 of file BatchToSpaceNdTestImpl.hpp.

References armnn::NCHW.

420 {
421  const unsigned int inputShape[] = {4, 3, 1, 1};
422  const unsigned int outputShape[] = {1, 3, 2, 2};
423 
424  std::vector<float> input({1, 3, 5, 7, 9, 11, 2, 4, 6, 8, 10, 12});
425 
426  std::vector<float> expectedOutput({
427  // Batch 0, Channel 0, Height (2) x Width (2)
428  1, 7,
429  2, 8,
430 
431  // Batch 0, Channel 1, Height (2) x Width (2)
432  3, 9,
433  4, 10,
434 
435  // Batch 0, Channel 2, Height (2) x Width (2)
436  5, 11,
437  6, 12,
438  });
439 
440  std::vector<unsigned int> blockShape({2, 2});
441  std::vector<std::pair<unsigned int, unsigned int>> crops = {{0, 0}, {0, 0}};
442 
443  return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager,
444  armnn::DataLayout::NCHW, inputShape, input, blockShape,
445  crops, outputShape, expectedOutput);
446 }

◆ BatchToSpaceNdNchwTest7()

LayerTestResult<T, 4> BatchToSpaceNdNchwTest7 ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 449 of file BatchToSpaceNdTestImpl.hpp.

References armnn::NCHW.

452 {
453  const unsigned int inputShape[] = {8, 1, 1, 3};
454  const unsigned int outputShape[] = {2, 1, 2, 4};
455 
456  std::vector<float> input({
457  0, 1, 3, 0, 9, 11,
458  0, 2, 4, 0, 10, 12,
459  0, 5, 7, 0, 13, 15,
460  0, 6, 8, 0, 14, 16
461  });
462 
463  std::vector<float> expectedOutput({
464  1, 2, 3, 4,
465  5, 6, 7, 8,
466  9, 10, 11, 12,
467  13, 14, 15, 16
468  });
469 
470  std::vector<unsigned int> blockShape({2, 2});
471  std::vector<std::pair<unsigned int, unsigned int>> crops = {{0, 0}, {2, 0}};
472 
473  return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager,
474  armnn::DataLayout::NCHW, inputShape, input, blockShape,
475  crops, outputShape, expectedOutput);
476 }

◆ BatchToSpaceNdNhwcTest1()

LayerTestResult<T, 4> BatchToSpaceNdNhwcTest1 ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 90 of file BatchToSpaceNdTestImpl.hpp.

References armnn::NHWC.

93 {
94  const unsigned int inputShape[] = {4, 2, 2, 1};
95  const unsigned int outputShape[] = {1, 4, 4, 1};
96 
97  std::vector<float> input({
98  // Batch 0, Height 0, Width (2) x Channel (1)
99  1.0f, 3.0f,
100  // Batch 0, Height 1, Width (2) x Channel (1)
101  9.0f, 11.0f,
102 
103 
104  // Batch 1, Height 0, Width (2) x Channel (1)
105  2.0f, 4.0f,
106  // Batch 1, Height 1, Width (2) x Channel (1)
107  10.0f, 12.0f,
108 
109 
110  // Batch 2, Height 0, Width (2) x Channel (1)
111  5.0f, 7.0f,
112  // Batch 2, Height 1, Width (2) x Channel (1)
113  13.0f, 15.0f,
114 
115  // Batch 3, Height 0, Width (2) x Channel (3)
116  6.0f, 8.0f,
117  // Batch 3, Height 1, Width (2) x Channel (1)
118  14.0f, 16.0f
119  });
120 
121  std::vector<float> expectedOutput({
122  1.0f, 2.0f, 3.0f, 4.0f,
123  5.0f, 6.0f, 7.0f, 8.0f,
124  9.0f, 10.0f, 11.0f, 12.0f,
125  13.0f, 14.0f, 15.0f, 16.0f
126  });
127 
128  std::vector<unsigned int> blockShape {2, 2};
129  std::vector<std::pair<unsigned int, unsigned int>> crops = {{0, 0}, {0, 0}};
130 
131  return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager,
132  armnn::DataLayout::NHWC, inputShape, input, blockShape,
133  crops, outputShape, expectedOutput);
134 }

◆ BatchToSpaceNdNhwcTest2()

LayerTestResult<T, 4> BatchToSpaceNdNhwcTest2 ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 137 of file BatchToSpaceNdTestImpl.hpp.

References armnn::NHWC.

140 {
141  const unsigned int inputShape[] = {4, 1, 1, 1};
142  const unsigned int outputShape[] = {1, 2, 2, 1};
143 
144  std::vector<float> input({
145  // Batch 0, Height 0, Width (2) x Channel (1)
146  1.0f, 2.0f, 3.0f, 4.0f
147  });
148 
149  std::vector<float> expectedOutput({1.0f, 2.0f, 3.0f, 4.0f});
150 
151  std::vector<unsigned int> blockShape({2, 2});
152  std::vector<std::pair<unsigned int, unsigned int>> crops = {{0, 0}, {0, 0}};
153 
154  return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager,
155  armnn::DataLayout::NHWC, inputShape, input, blockShape,
156  crops, outputShape, expectedOutput);
157 }

◆ BatchToSpaceNdNhwcTest3()

LayerTestResult<T, 4> BatchToSpaceNdNhwcTest3 ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 160 of file BatchToSpaceNdTestImpl.hpp.

References armnn::NHWC.

163 {
164  const unsigned int inputShape[] = {4, 1, 1, 3};
165  const unsigned int outputShape[] = {1, 2, 2, 3};
166 
167  std::vector<float> input({1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f});
168 
169  std::vector<float> expectedOutput({1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f});
170 
171  std::vector<unsigned int> blockShape({2, 2});
172  std::vector<std::pair<unsigned int, unsigned int>> crops = {{0, 0}, {0, 0}};
173 
174  return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager,
175  armnn::DataLayout::NHWC, inputShape, input, blockShape,
176  crops, outputShape, expectedOutput);
177 }

◆ BatchToSpaceNdNhwcTest4()

LayerTestResult<T, 4> BatchToSpaceNdNhwcTest4 ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 180 of file BatchToSpaceNdTestImpl.hpp.

References armnn::NHWC.

183 {
184  const unsigned int inputShape[] = {8, 1, 3, 1};
185  const unsigned int outputShape[] = {2, 2, 4, 1};
186 
187  std::vector<float> input({
188  0.0f, 1.0f, 3.0f,
189  0.0f, 9.0f, 11.0f,
190  0.0f, 2.0f, 4.0f,
191  0.0f, 10.0f, 12.0f,
192  0.0f, 5.0f, 7.0f,
193  0.0f, 13.0f, 15.0f,
194  0.0f, 6.0f, 8.0f,
195  0.0f, 14.0f, 16.0f
196  });
197 
198  std::vector<float> expectedOutput({
199  1.0f, 2.0f, 3.0f, 4.0f,
200  5.0f, 6.0f, 7.0f, 8.0f,
201  9.0f, 10.0f, 11.0f, 12.0f,
202  13.0f, 14.0f, 15.0f, 16.0f
203  });
204 
205  std::vector<unsigned int> blockShape({2, 2});
206  std::vector<std::pair<unsigned int, unsigned int>> crops = {{0, 0}, {2, 0}};
207 
208  return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager,
209  armnn::DataLayout::NHWC, inputShape, input, blockShape,
210  crops, outputShape, expectedOutput);
211 }

◆ BatchToSpaceNdNhwcTest5()

LayerTestResult<T, 4> BatchToSpaceNdNhwcTest5 ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 214 of file BatchToSpaceNdTestImpl.hpp.

References armnn::NHWC.

217 {
218  const unsigned int inputShape[] = {4, 2, 2, 1};
219  const unsigned int outputShape[] = {1, 4, 4, 1};
220 
221  std::vector<float> input({1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16});
222  std::vector<float> expectedOutput({1, 5, 2, 6, 9, 13, 10, 14, 3, 7, 4, 8, 11, 15, 12, 16});
223 
224  std::vector<unsigned int> blockShape({2, 2});
225  std::vector<std::pair<unsigned int, unsigned int>> crops = {{0, 0}, {0, 0}};
226 
227  return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager, armnn::DataLayout::NHWC, inputShape,
228  input, blockShape, crops, outputShape, expectedOutput);
229 }

◆ BatchToSpaceNdNhwcTest6()

LayerTestResult<T, 4> BatchToSpaceNdNhwcTest6 ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 232 of file BatchToSpaceNdTestImpl.hpp.

References armnn::NHWC.

235 {
236  const unsigned int inputShape[] = {4, 1, 1, 1};
237  const unsigned int outputShape[] = {1, 2, 2, 1};
238 
239  std::vector<float> input({
240  // Batch 0, Height 0, Width (2) x Channel (1)
241  1, 2, 3, 4
242  });
243 
244  std::vector<float> expectedOutput({1, 2, 3, 4});
245 
246  std::vector<unsigned int> blockShape({2, 2});
247  std::vector<std::pair<unsigned int, unsigned int>> crops = {{0, 0}, {0, 0}};
248 
249  return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager,
250  armnn::DataLayout::NHWC, inputShape, input, blockShape,
251  crops, outputShape, expectedOutput);
252 }

◆ BatchToSpaceNdNhwcTest7()

LayerTestResult<T, 4> BatchToSpaceNdNhwcTest7 ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager 
)

Definition at line 255 of file BatchToSpaceNdTestImpl.hpp.

References armnn::NHWC.

258 {
259  const unsigned int inputShape[] = {4, 1, 1, 3};
260  const unsigned int outputShape[] = {1, 2, 2, 3};
261 
262  std::vector<float> input({1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12});
263 
264  std::vector<float> expectedOutput({1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12});
265 
266  std::vector<unsigned int> blockShape({2, 2});
267  std::vector<std::pair<unsigned int, unsigned int>> crops = {{0, 0}, {0, 0}};
268 
269  return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager,
270  armnn::DataLayout::NHWC, inputShape, input, blockShape,
271  crops, outputShape, expectedOutput);
272 }