ArmNN
 20.08
ResizeTestImpl.hpp File Reference

Go to the source code of this file.

Functions

template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult< T, 4 > ResizeBilinearNopTest (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::DataLayout dataLayout)
 
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult< T, 4 > SimpleResizeBilinearTest (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::DataLayout dataLayout)
 
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult< T, 4 > ResizeBilinearSqMinTest (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::DataLayout dataLayout)
 
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult< T, 4 > ResizeBilinearMinTest (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::DataLayout dataLayout)
 
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult< T, 4 > ResizeBilinearMagTest (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::DataLayout dataLayout)
 
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult< T, 4 > ResizeNearestNeighborNopTest (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::DataLayout dataLayout)
 
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult< T, 4 > SimpleResizeNearestNeighborTest (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::DataLayout dataLayout)
 
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult< T, 4 > ResizeNearestNeighborSqMinTest (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::DataLayout dataLayout)
 
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult< T, 4 > ResizeNearestNeighborMinTest (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::DataLayout dataLayout)
 
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult< T, 4 > ResizeNearestNeighborMagTest (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::DataLayout dataLayout, float inQuantScale, int32_t inQuantOffset, float outQuantScale, int32_t outQuantOffset)
 
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult< T, 4 > HalfPixelCentersResizeBilinearTest (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::DataLayout dataLayout)
 
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult< T, 4 > AlignCornersResizeBilinearTest (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::DataLayout dataLayout)
 
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult< T, 4 > HalfPixelCentersResizeNearestNeighbourTest (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::DataLayout dataLayout)
 
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult< T, 4 > AlignCornersResizeNearestNeighbourTest (armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager, const armnn::DataLayout dataLayout)
 

Function Documentation

◆ AlignCornersResizeBilinearTest()

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

Definition at line 577 of file ResizeTestImpl.cpp.

References armnn::Bilinear.

581 {
582  ResizeTestParams testParams;
583  testParams.m_ResizeMethod = armnn::ResizeMethod::Bilinear;
584  testParams.m_DataLayout = dataLayout;
585  testParams.m_AlignCorners = true;
586 
587  testParams.m_InputShape = { 1, 1, 2, 2 };
588  testParams.m_OutputShape = { 1, 1, 1, 1 };
589 
590  testParams.m_InputData =
591  {
592  1.0f, 2.0f,
593  3.0f, 4.0f,
594  };
595 
596  testParams.m_ExpectedOutputData =
597  {
598  1.0f
599  };
600 
601  return ResizeTestImpl<4, ArmnnType>(workloadFactory, memoryManager, testParams);
602 }

◆ AlignCornersResizeNearestNeighbourTest()

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

Definition at line 635 of file ResizeTestImpl.cpp.

References armnn::NearestNeighbor.

639 {
640  ResizeTestParams testParams;
641  testParams.m_ResizeMethod = armnn::ResizeMethod::NearestNeighbor;
642  testParams.m_DataLayout = dataLayout;
643  testParams.m_AlignCorners = true;
644 
645  testParams.m_InputShape = { 1, 1, 2, 2 };
646  testParams.m_OutputShape = { 1, 1, 1, 1 };
647 
648  testParams.m_InputData =
649  {
650  1.0f, 2.0f,
651  3.0f, 4.0f,
652  };
653 
654  testParams.m_ExpectedOutputData =
655  {
656  1.0f
657  };
658 
659  return ResizeTestImpl<4, ArmnnType>(workloadFactory, memoryManager, testParams);
660 }

◆ HalfPixelCentersResizeBilinearTest()

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

Definition at line 540 of file ResizeTestImpl.cpp.

References armnn::Bilinear.

544 {
545  ResizeTestParams testParams;
546  testParams.m_ResizeMethod = armnn::ResizeMethod::Bilinear;
547  testParams.m_DataLayout = dataLayout;
548  testParams.m_HalfPixelCenters = true;
549 
550  testParams.m_InputShape = { 2, 1, 2, 2 };
551  testParams.m_OutputShape = { 2, 1, 3, 3 };
552 
553  testParams.m_InputData =
554  {
555  1.0f, 2.0f,
556  3.0f, 4.0f,
557 
558  1.0f, 2.0f,
559  3.0f, 4.0f
560  };
561 
562  testParams.m_ExpectedOutputData =
563  {
564  1.0f, 1.5f, 2.0f,
565  2.0f, 2.5f, 3.0f,
566  3.0f, 3.5f, 4.0f,
567 
568  1.0f, 1.5f, 2.0f,
569  2.0f, 2.5f, 3.0f,
570  3.0f, 3.5f, 4.0f,
571  };
572 
573  return ResizeTestImpl<4, ArmnnType>(workloadFactory, memoryManager, testParams);
574 }

◆ HalfPixelCentersResizeNearestNeighbourTest()

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

Definition at line 605 of file ResizeTestImpl.cpp.

References armnn::NearestNeighbor.

609 {
610  ResizeTestParams testParams;
611  testParams.m_ResizeMethod = armnn::ResizeMethod::NearestNeighbor;
612  testParams.m_DataLayout = dataLayout;
613  testParams.m_HalfPixelCenters = true;
614 
615  testParams.m_InputShape = { 1, 1, 2, 5 };
616  testParams.m_OutputShape = { 1, 1, 2, 2 };
617 
618  testParams.m_InputData =
619  {
620  1.0f, 2.0f, 3.0f, 4.0f, 5.0f,
621 
622  1.0f, 2.0f, 3.0f, 4.0f, 5.0f
623  };
624 
625  testParams.m_ExpectedOutputData =
626  {
627  2.0f, 4.0f,
628  2.0f, 4.0f
629  };
630 
631  return ResizeTestImpl<4, ArmnnType>(workloadFactory, memoryManager, testParams);
632 }

◆ ResizeBilinearMagTest()

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

Definition at line 301 of file ResizeTestImpl.cpp.

References armnn::Bilinear.

305 {
306  ResizeTestParams testParams;
307  testParams.m_ResizeMethod = armnn::ResizeMethod::Bilinear;
308  testParams.m_DataLayout = dataLayout;
309 
310  testParams.m_InputShape = { 1, 2, 3, 2 };
311  testParams.m_OutputShape = { 1, 2, 3, 5 };
312 
313  testParams.m_InputData =
314  {
315  1.0f, 2.0f,
316  13.0f, 21.0f,
317  144.0f, 233.0f,
318 
319  233.0f, 144.0f,
320  21.0f, 13.0f,
321  2.0f, 1.0f
322  };
323 
324  testParams.m_ExpectedOutputData =
325  {
326  1.0f, 1.4f, 1.8f, 2.0f, 2.0f,
327  13.0f, 16.2f, 19.4f, 21.0f, 21.0f,
328  144.0f, 179.6f, 215.2f, 233.0f, 233.0f,
329 
330  233.0f, 197.4f, 161.8f, 144.0f, 144.0f,
331  21.0f, 17.8f, 14.6f, 13.0f, 13.0f,
332  2.0f, 1.6f, 1.2f, 1.0f, 1.0f
333  };
334 
335  testParams.SetInQuantParams(1.0f, 0);
336 
337  return ResizeTestImpl<4, ArmnnType>(workloadFactory, memoryManager, testParams);
338 }

◆ ResizeBilinearMinTest()

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

Definition at line 263 of file ResizeTestImpl.cpp.

References armnn::Bilinear.

267 {
268  ResizeTestParams testParams;
269  testParams.m_ResizeMethod = armnn::ResizeMethod::Bilinear;
270  testParams.m_DataLayout = dataLayout;
271 
272  testParams.m_InputShape = { 1, 2, 3, 5 };
273  testParams.m_OutputShape = { 1, 2, 2, 3 };
274 
275  testParams.m_InputData =
276  {
277  1.5f, 3.0f, 4.5f, 6.0f, 7.5f,
278  9.0f, 10.5f, 12.0f, 13.5f, 15.0f,
279  16.5f, 18.0f, 19.5f, 21.0f, 22.5f,
280 
281  16.5f, 18.0f, 19.5f, 21.0f, 22.5f,
282  9.0f, 10.5f, 12.0f, 13.5f, 15.0f,
283  1.5f, 3.0f, 4.5f, 6.0f, 7.5f
284  };
285 
286  testParams.m_ExpectedOutputData =
287  {
288  1.50f, 4.00f, 6.50f,
289  12.75f, 15.25f, 17.75f,
290 
291  16.50f, 19.00f, 21.50f,
292  5.25f, 7.75f, 10.25f
293  };
294 
295  testParams.SetInOutQuantParams(1.5f, -1);
296 
297  return ResizeTestImpl<4, ArmnnType>(workloadFactory, memoryManager, testParams);
298 }

◆ ResizeBilinearNopTest()

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

Definition at line 151 of file ResizeTestImpl.cpp.

References armnn::Bilinear.

155 {
156  ResizeTestParams testParams;
157  testParams.m_ResizeMethod = armnn::ResizeMethod::Bilinear;
158  testParams.m_DataLayout = dataLayout;
159 
160  testParams.m_InputShape = { 1, 2, 4, 4 };
161  testParams.m_OutputShape = testParams.m_InputShape;
162 
163  testParams.m_InputData =
164  {
165  1.0f, 2.0f, 3.0f, 4.0f,
166  2.0f, 3.0f, 4.0f, 5.0f,
167  3.0f, 4.0f, 5.0f, 6.0f,
168  4.0f, 5.0f, 6.0f, 7.0f,
169 
170  1.0f, 2.0f, 3.0f, 4.0f,
171  2.0f, 3.0f, 4.0f, 5.0f,
172  3.0f, 4.0f, 5.0f, 6.0f,
173  4.0f, 5.0f, 6.0f, 7.0f
174  };
175 
176  testParams.m_ExpectedOutputData = testParams.m_InputData;
177 
178  testParams.SetInOutQuantParams(1.5f, 3);
179 
180  return ResizeTestImpl<4, ArmnnType>(workloadFactory, memoryManager, testParams);
181 }

◆ ResizeBilinearSqMinTest()

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

Definition at line 223 of file ResizeTestImpl.cpp.

References armnn::Bilinear.

227 {
228  ResizeTestParams testParams;
229  testParams.m_ResizeMethod = armnn::ResizeMethod::Bilinear;
230  testParams.m_DataLayout = dataLayout;
231 
232  testParams.m_InputShape = { 1, 2, 4, 4 };
233  testParams.m_OutputShape = { 1, 2, 2, 2 };
234 
235  testParams.m_InputData =
236  {
237  1.0f, 2.0f, 3.0f, 4.0f,
238  2.0f, 3.0f, 4.0f, 5.0f,
239  3.0f, 4.0f, 5.0f, 6.0f,
240  4.0f, 5.0f, 6.0f, 7.0f,
241 
242  7.0f, 6.0f, 5.0f, 4.0f,
243  6.0f, 5.0f, 4.0f, 3.0f,
244  5.0f, 4.0f, 3.0f, 2.0f,
245  4.0f, 3.0f, 2.0f, 1.0f
246  };
247 
248  testParams.m_ExpectedOutputData =
249  {
250  1.0f, 3.0f,
251  3.0f, 5.0f,
252 
253  7.0f, 5.0f,
254  5.0f, 3.0f
255  };
256 
257  testParams.SetInOutQuantParams(3.141592f, 3);
258 
259  return ResizeTestImpl<4, ArmnnType>(workloadFactory, memoryManager, testParams);
260 }

◆ ResizeNearestNeighborMagTest()

LayerTestResult<T, 4> ResizeNearestNeighborMagTest ( armnn::IWorkloadFactory workloadFactory,
const armnn::IBackendInternal::IMemoryManagerSharedPtr memoryManager,
const armnn::DataLayout  dataLayout,
float  inQuantScale,
int32_t  inQuantOffset,
float  outQuantScale,
int32_t  outQuantOffset 
)

Definition at line 495 of file ResizeTestImpl.cpp.

References armnn::NearestNeighbor.

503 {
504  ResizeTestParams testParams;
505  testParams.m_ResizeMethod = armnn::ResizeMethod::NearestNeighbor;
506  testParams.m_DataLayout = dataLayout;
507 
508  testParams.m_InputShape = { 1, 2, 3, 2 };
509  testParams.m_OutputShape = { 1, 2, 3, 5 };
510 
511  testParams.m_InputData =
512  {
513  0.183005f, 2.379065f,
514  1.054970f, 1.302565f,
515  2.400595f, 0.688960f,
516 
517  2.400595f, 0.688960f,
518  1.054970f, 1.302565f,
519  0.183005f, 2.379065f,
520  };
521 
522  testParams.m_ExpectedOutputData =
523  {
524  0.183005f, 0.183005f, 0.183005f, 2.379065f, 2.379065f,
525  1.054970f, 1.054970f, 1.054970f, 1.302565f, 1.302565f,
526  2.400595f, 2.400595f, 2.400595f, 0.688960f, 0.688960f,
527 
528  2.400595f, 2.400595f, 2.400595f, 0.688960f, 0.688960f,
529  1.054970f, 1.054970f, 1.054970f, 1.302565f, 1.302565f,
530  0.183005f, 0.183005f, 0.183005f, 2.379065f, 2.379065f
531  };
532 
533  testParams.SetInQuantParams(inQuantScale, inQuantOffset);
534  testParams.SetOutQuantParams(outQuantScale, outQuantOffset);
535 
536  return ResizeTestImpl<4, ArmnnType>(workloadFactory, memoryManager, testParams);
537 }

◆ ResizeNearestNeighborMinTest()

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

Definition at line 457 of file ResizeTestImpl.cpp.

References armnn::NearestNeighbor.

461 {
462  ResizeTestParams testParams;
463  testParams.m_ResizeMethod = armnn::ResizeMethod::NearestNeighbor;
464  testParams.m_DataLayout = dataLayout;
465 
466  testParams.m_InputShape = { 1, 2, 3, 5 };
467  testParams.m_OutputShape = { 1, 2, 2, 3 };
468 
469  testParams.m_InputData =
470  {
471  1.5f, 3.0f, 4.5f, 6.0f, 7.5f,
472  9.0f, 10.5f, 12.0f, 13.5f, 15.0f,
473  16.5f, 18.0f, 19.5f, 21.0f, 22.5f,
474 
475  16.5f, 18.0f, 19.5f, 21.0f, 22.5f,
476  9.0f, 10.5f, 12.0f, 13.5f, 15.0f,
477  1.5f, 3.0f, 4.5f, 6.0f, 7.5f
478  };
479 
480  testParams.m_ExpectedOutputData =
481  {
482  1.5f, 3.0f, 6.0f,
483  9.0f, 10.5f, 13.5f,
484 
485  16.5f, 18.0f, 21.0f,
486  9.0f, 10.5f, 13.5f
487  };
488 
489  testParams.SetInOutQuantParams(1.5f, -1);
490 
491  return ResizeTestImpl<4, ArmnnType>(workloadFactory, memoryManager, testParams);
492 }

◆ ResizeNearestNeighborNopTest()

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

Definition at line 345 of file ResizeTestImpl.cpp.

References armnn::NearestNeighbor.

349 {
350  ResizeTestParams testParams;
351  testParams.m_ResizeMethod = armnn::ResizeMethod::NearestNeighbor;
352  testParams.m_DataLayout = dataLayout;
353 
354  testParams.m_InputShape = { 1, 2, 4, 4 };
355  testParams.m_OutputShape = testParams.m_InputShape;
356 
357  testParams.m_InputData =
358  {
359  1.0f, 2.0f, 3.0f, 4.0f,
360  2.0f, 3.0f, 4.0f, 5.0f,
361  3.0f, 4.0f, 5.0f, 6.0f,
362  4.0f, 5.0f, 6.0f, 7.0f,
363 
364  1.0f, 2.0f, 3.0f, 4.0f,
365  2.0f, 3.0f, 4.0f, 5.0f,
366  3.0f, 4.0f, 5.0f, 6.0f,
367  4.0f, 5.0f, 6.0f, 7.0f
368  };
369 
370  testParams.m_ExpectedOutputData = testParams.m_InputData;
371 
372  testParams.SetInOutQuantParams(1.5f, 3);
373 
374  return ResizeTestImpl<4, ArmnnType>(workloadFactory, memoryManager, testParams);
375 }

◆ ResizeNearestNeighborSqMinTest()

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

Definition at line 417 of file ResizeTestImpl.cpp.

References armnn::NearestNeighbor.

421 {
422  ResizeTestParams testParams;
423  testParams.m_ResizeMethod = armnn::ResizeMethod::NearestNeighbor;
424  testParams.m_DataLayout = dataLayout;
425 
426  testParams.m_InputShape = { 1, 2, 4, 4 };
427  testParams.m_OutputShape = { 1, 2, 2, 2 };
428 
429  testParams.m_InputData =
430  {
431  1.0f, 2.0f, 3.0f, 4.0f,
432  2.0f, 3.0f, 4.0f, 5.0f,
433  3.0f, 4.0f, 5.0f, 6.0f,
434  4.0f, 5.0f, 6.0f, 7.0f,
435 
436  7.0f, 6.0f, 5.0f, 4.0f,
437  6.0f, 5.0f, 4.0f, 3.0f,
438  5.0f, 4.0f, 3.0f, 2.0f,
439  4.0f, 3.0f, 2.0f, 1.0f
440  };
441 
442  testParams.m_ExpectedOutputData =
443  {
444  1.0f, 3.0f,
445  3.0f, 5.0f,
446 
447  7.0f, 5.0f,
448  5.0f, 3.0f
449  };
450 
451  testParams.SetInOutQuantParams(3.141592f, 3);
452 
453  return ResizeTestImpl<4, ArmnnType>(workloadFactory, memoryManager, testParams);
454 }

◆ SimpleResizeBilinearTest()

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

Definition at line 184 of file ResizeTestImpl.cpp.

References armnn::Bilinear.

188 {
189  ResizeTestParams testParams;
190  testParams.m_ResizeMethod = armnn::ResizeMethod::Bilinear;
191  testParams.m_DataLayout = dataLayout;
192 
193  testParams.m_InputShape = { 1, 2, 2, 2 };
194  testParams.m_OutputShape = { 1, 2, 1, 1 };
195 
196  testParams.m_InputData =
197  {
198  1.0f, 255.0f,
199  200.0f, 250.0f,
200 
201  250.0f, 200.0f,
202  250.0f, 1.0f
203  };
204 
205  // The 'resize' operation projects the top-left corner of output texels into the input image,
206  // then figures out the interpolants and weights. Note this is different to projecting the centre of the
207  // output texel. Thus, for a input matrix of 2x2, we'll expect the output 1x1 matrix to contain, as
208  // its single element, the value that was at position (0,0) of the input matrix (rather than an average,
209  // which we would expect if projecting the centre).
210  testParams.m_ExpectedOutputData =
211  {
212  1.0f,
213 
214  250.0f
215  };
216 
217  testParams.SetInOutQuantParams(0.1567f, 1);
218 
219  return ResizeTestImpl<4, ArmnnType>(workloadFactory, memoryManager, testParams);
220 }

◆ SimpleResizeNearestNeighborTest()

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

Definition at line 378 of file ResizeTestImpl.cpp.

References armnn::NearestNeighbor.

382 {
383  ResizeTestParams testParams;
384  testParams.m_ResizeMethod = armnn::ResizeMethod::NearestNeighbor;
385  testParams.m_DataLayout = dataLayout;
386 
387  testParams.m_InputShape = { 1, 2, 2, 2 };
388  testParams.m_OutputShape = { 1, 2, 1, 1 };
389 
390  testParams.m_InputData =
391  {
392  1.0f, 255.0f,
393  200.0f, 250.0f,
394 
395  250.0f, 200.0f,
396  250.0f, 1.0f
397  };
398 
399  // The 'resize' operation projects the top-left corner of output texels into the input image,
400  // then figures out the interpolants and weights. Note this is different to projecting the centre of the
401  // output texel. Thus, for a input matrix of 2x2, we'll expect the output 1x1 matrix to contain, as
402  // its single element, the value that was at position (0,0) of the input matrix (rather than an average,
403  // which we would expect if projecting the centre).
404  testParams.m_ExpectedOutputData =
405  {
406  1.0f,
407 
408  250.0f
409  };
410 
411  testParams.SetInOutQuantParams(0.1567f, 1);
412 
413  return ResizeTestImpl<4, ArmnnType>(workloadFactory, memoryManager, testParams);
414 }