ArmNN
 20.02
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 273 of file BatchToSpaceNdTestImpl.hpp.

References armnn::NCHW.

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

◆ BatchToSpaceNdNchwTest2()

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

Definition at line 305 of file BatchToSpaceNdTestImpl.hpp.

References armnn::NCHW.

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

◆ BatchToSpaceNdNchwTest3()

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

Definition at line 328 of file BatchToSpaceNdTestImpl.hpp.

References armnn::NCHW.

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

◆ BatchToSpaceNdNchwTest4()

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

Definition at line 360 of file BatchToSpaceNdTestImpl.hpp.

References armnn::NCHW.

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

◆ BatchToSpaceNdNchwTest5()

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

Definition at line 392 of file BatchToSpaceNdTestImpl.hpp.

References armnn::NCHW.

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

◆ BatchToSpaceNdNchwTest6()

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

Definition at line 415 of file BatchToSpaceNdTestImpl.hpp.

References armnn::NCHW.

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

◆ BatchToSpaceNdNchwTest7()

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

Definition at line 447 of file BatchToSpaceNdTestImpl.hpp.

References armnn::NCHW.

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

◆ BatchToSpaceNdNhwcTest1()

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

Definition at line 88 of file BatchToSpaceNdTestImpl.hpp.

References armnn::NHWC.

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

◆ BatchToSpaceNdNhwcTest2()

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

Definition at line 135 of file BatchToSpaceNdTestImpl.hpp.

References armnn::NHWC.

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

◆ BatchToSpaceNdNhwcTest3()

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

Definition at line 158 of file BatchToSpaceNdTestImpl.hpp.

References armnn::NHWC.

161 {
162  const unsigned int inputShape[] = {4, 1, 1, 3};
163  const unsigned int outputShape[] = {1, 2, 2, 3};
164 
165  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});
166 
167  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});
168 
169  std::vector<unsigned int> blockShape({2, 2});
170  std::vector<std::pair<unsigned int, unsigned int>> crops = {{0, 0}, {0, 0}};
171 
172  return BatchToSpaceNdHelper<ArmnnType, 4, 4>(workloadFactory, memoryManager,
173  armnn::DataLayout::NHWC, inputShape, input, blockShape,
174  crops, outputShape, expectedOutput);
175 }

◆ BatchToSpaceNdNhwcTest4()

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

Definition at line 178 of file BatchToSpaceNdTestImpl.hpp.

References armnn::NHWC.

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

◆ BatchToSpaceNdNhwcTest5()

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

Definition at line 212 of file BatchToSpaceNdTestImpl.hpp.

References armnn::NHWC.

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

◆ BatchToSpaceNdNhwcTest6()

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

Definition at line 230 of file BatchToSpaceNdTestImpl.hpp.

References armnn::NHWC.

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

◆ BatchToSpaceNdNhwcTest7()

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

Definition at line 253 of file BatchToSpaceNdTestImpl.hpp.

References armnn::NHWC.

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