// // Copyright © 2017 Arm Ltd. All rights reserved. // SPDX-License-Identifier: MIT // #pragma once #include #include #include #include "TensorCopyUtils.hpp" #include "WorkloadTestUtils.hpp" #include "TensorUtils.hpp" #include "Permute.hpp" #include #include #include #include #include #include #include #include #include // Layer callables. namespace armnn { class IWorkloadFactory; } template boost::array GetTensorShapeAsArray(const armnn::TensorInfo& tensorInfo) { BOOST_ASSERT_MSG(n == tensorInfo.GetNumDimensions(), "Attempting to construct a shape array of mismatching size"); boost::array shape; for (unsigned int i = 0; i < n; i++) { shape[i] = tensorInfo.GetShape()[i]; } return shape; } template struct LayerTestResult { LayerTestResult(const armnn::TensorInfo& outputInfo) { auto shape( GetTensorShapeAsArray(outputInfo) ); output.resize(shape); outputExpected.resize(shape); supported = true; compareBoolean = false; } boost::multi_array output; boost::multi_array outputExpected; bool supported; bool compareBoolean; }; LayerTestResult SimpleConvolution2d3x5Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, bool biasEnabled, const armnn::DataLayout layout); LayerTestResult SimpleConvolution2d3x3Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, bool biasEnabled, const armnn::DataLayout layout); LayerTestResult SimpleConvolution2d3x3Stride2x2Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, bool biasEnabled, const armnn::DataLayout layout); LayerTestResult SimpleConvolution2d3x3NhwcTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, bool biasEnabled); LayerTestResult Convolution2dAsymmetricPaddingLargerThanHalfKernelSizeTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, armnn::DataLayout layout); LayerTestResult Convolution2dAsymmetricPaddingTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, armnn::DataLayout layout); LayerTestResult Convolution1dTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, bool biasEnabled); LayerTestResult Convolution1dUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, bool biasEnabled); LayerTestResult DepthwiseConvolution2dTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, bool biasEnabled, const armnn::DataLayout layout); template> LayerTestResult Convolution2d3x3Dilation3x3Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, bool biasEnabled, const armnn::DataLayout layout); template> LayerTestResult Convolution2d2x3x3Dilation3x3Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, bool biasEnabled, const armnn::DataLayout layout); template> LayerTestResult Convolution2d2x2Dilation2x2Padding2x2Stride3x3Test( armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr &memoryManager, bool biasEnabled, const armnn::DataLayout layout); template> LayerTestResult DepthwiseConvolution2d3x3Dilation3x3Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, bool biasEnabled, const armnn::DataLayout layout); template> LayerTestResult DepthwiseConvolution2d2x3x3Dilation3x3Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, bool biasEnabled, const armnn::DataLayout layout); LayerTestResult DepthwiseConvolution2dDepthNhwcTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, bool biasEnabled); LayerTestResult DepthwiseConvolution2dDepthMul1Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, bool biasEnabled, const armnn::DataLayout layout); LayerTestResult DepthwiseConvolution2dDepthMul64Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult DepthwiseConvolution2dAsymmetricTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, bool biasEnabled, const armnn::DataLayout layout); LayerTestResult SimpleDepthwiseConvolution2d3x3Dilation3x3NhwcTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult CompareDepthwiseConvolution2dFloatTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, armnn::IWorkloadFactory& refWorkloadFactory, const armnn::DataLayout layout); LayerTestResult CompareDepthwiseConvolution2dUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, armnn::IWorkloadFactory& refWorkloadFactory, const armnn::DataLayout layout); LayerTestResult SimpleMaxPooling2dSize2x2Stride2x2Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, bool forceNoPadding); LayerTestResult SimpleMaxPooling2dSize2x2Stride2x2Uint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, bool forceNoPadding); LayerTestResult SimpleMaxPooling2dSize2x2Stride2x2Int16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, bool forceNoPadding); LayerTestResult SimpleMaxPooling2dSize3x3Stride2x4Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, bool forceNoPadding); LayerTestResult SimpleMaxPooling2dSize3x3Stride2x4Uint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, bool forceNoPadding ); LayerTestResult SimpleMaxPooling2dSize3x3Stride2x4Int16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, bool forceNoPadding ); LayerTestResult SimpleMaxPooling2dTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, const armnn::DataLayout dataLayout); LayerTestResult SimpleMaxPooling2dUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, const armnn::DataLayout dataLayout); LayerTestResult SimpleMaxPooling2dInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, const armnn::DataLayout dataLayout); LayerTestResult IgnorePaddingSimpleMaxPooling2dTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult IgnorePaddingSimpleMaxPooling2dUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult IgnorePaddingSimpleMaxPooling2dInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult IgnorePaddingMaxPooling2dSize3Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult IgnorePaddingMaxPooling2dSize3Uint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult IgnorePaddingMaxPooling2dSize3Int16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SimpleAveragePooling2dTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, const armnn::DataLayout dataLayout); LayerTestResult SimpleAveragePooling2dUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, const armnn::DataLayout dataLayout); LayerTestResult SimpleAveragePooling2dInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, const armnn::DataLayout dataLayout); LayerTestResult LargeTensorsAveragePooling2dTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult LargeTensorsAveragePooling2dUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult LargeTensorsAveragePooling2dInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult IgnorePaddingAveragePooling2dSize3x2Stride2x2Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, bool forceNoPadding); LayerTestResult IgnorePaddingSimpleAveragePooling2dTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult IgnorePaddingSimpleAveragePooling2dUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult IgnorePaddingSimpleAveragePooling2dInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult IgnorePaddingSimpleAveragePooling2dNoPaddingTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult IgnorePaddingSimpleAveragePooling2dNoPaddingUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult IgnorePaddingSimpleAveragePooling2dNoPaddingInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult IgnorePaddingAveragePooling2dSize3Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult IgnorePaddingAveragePooling2dSize3Uint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult IgnorePaddingAveragePooling2dSize3Int16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SimpleL2Pooling2dTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, const armnn::DataLayout dataLayout); LayerTestResult SimpleL2Pooling2dUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, const armnn::DataLayout dataLayout); LayerTestResult SimpleL2Pooling2dInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, const armnn::DataLayout dataLayout); LayerTestResult L2Pooling2dSize3Stride1Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult L2Pooling2dSize3Stride1Uint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult L2Pooling2dSize3Stride1Int16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult L2Pooling2dSize3Stride3Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult L2Pooling2dSize3Stride3Uint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult L2Pooling2dSize3Stride3Int16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult L2Pooling2dSize3Stride4Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult L2Pooling2dSize3Stride4Uint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult L2Pooling2dSize3Stride4Int16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult L2Pooling2dSize7Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult L2Pooling2dSize7Uint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult L2Pooling2dSize7Int16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult L2Pooling2dSize9Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult L2Pooling2dSize9Uint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult L2Pooling2dSize9Int16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult IgnorePaddingSimpleL2Pooling2dTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult IgnorePaddingSimpleL2Pooling2dUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult IgnorePaddingSimpleL2Pooling2dInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult IgnorePaddingL2Pooling2dSize3Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult IgnorePaddingL2Pooling2dSize3Uint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult IgnorePaddingL2Pooling2dSize3Int16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult AsymmetricNonSquarePooling2dTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult AsymmetricNonSquarePooling2dUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult AsymmetricNonSquarePooling2dInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult ComparePooling2dTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, armnn::IWorkloadFactory& refWorkloadFactory, armnn::PoolingAlgorithm poolingType); LayerTestResult ComparePooling2dUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, armnn::IWorkloadFactory& refWorkloadFactory, armnn::PoolingAlgorithm poolingType); LayerTestResult ComparePooling2dInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, armnn::IWorkloadFactory& refWorkloadFactory, armnn::PoolingAlgorithm poolingType); LayerTestResult ConstantLinearActivationTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SimpleNormalizationAcrossTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SimpleNormalizationWithinTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SimpleNormalizationAcrossNhwcTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SimpleSoftmaxTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, float beta); LayerTestResult SimpleAxisSoftmaxTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, float beta, int axis); LayerTestResult Simple3dSoftmaxTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, float beta); LayerTestResult Simple3dAxisSoftmaxTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, float beta, int axis); LayerTestResult Simple4dSoftmaxTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, float beta); LayerTestResult Simple4dAxisSoftmaxTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, float beta, int axis); LayerTestResult SimpleSoftmaxUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, float beta); LayerTestResult Simple3dSoftmaxUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, float beta); LayerTestResult Simple4dSoftmaxUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, float beta); LayerTestResult SimpleSoftmaxUint16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, float beta); LayerTestResult Simple3dSoftmaxUint16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, float beta); LayerTestResult Simple4dSoftmaxUint16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, float beta); LayerTestResult SimpleSigmoidTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); template> LayerTestResult SimpleReshapeTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SimpleFloorTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult Concatenation1dTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult Concatenation2dDim0Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult Concatenation2dDim1Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult Concatenation2dDim0DiffInputDimsTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult Concatenation2dDim1DiffInputDimsTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult Concatenation3dDim0Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult Concatenation3dDim1Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult Concatenation3dDim2Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, bool useSubtensor); LayerTestResult Concatenation3dDim0DiffInputDimsTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult Concatenation3dDim1DiffInputDimsTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult Concatenation3dDim2DiffInputDimsTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, bool useSubtensor); LayerTestResult Concatenation4dDim0Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult Concatenation4dDim1Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult Concatenation4dDim2Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult Concatenation4dDim3Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, bool useSubtensor); LayerTestResult Concatenation4dDiffShapeDim0Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult Concatenation4dDiffShapeDim1Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult Concatenation4dDiffShapeDim2Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult Concatenation4dDiffShapeDim3Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, bool useSubtensor); LayerTestResult Concatenation4dDim0Uint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult Concatenation4dDim1Uint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult Concatenation4dDim2Uint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult Concatenation4dDim3Uint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, bool useSubtensor); LayerTestResult Concatenation4dDiffShapeDim0Uint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult Concatenation4dDiffShapeDim1Uint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult Concatenation4dDiffShapeDim2Uint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult Concatenation4dDiffShapeDim3Uint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, bool useSubtensor); LayerTestResult SimpleSigmoidUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SimpleSigmoidInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult CompareConvolution2dTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, armnn::IWorkloadFactory& refWorkloadFactory); template LayerTestResult CompareDepthwiseConvolution2dTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, armnn::IWorkloadFactory& refWorkloadFactory, const armnn::DataLayout layout); LayerTestResult CompareNormalizationTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, armnn::IWorkloadFactory& refWorkloadFactory, armnn::NormalizationAlgorithmChannel normChannel, armnn::NormalizationAlgorithmMethod normMethod); LayerTestResult CompareSoftmaxTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, armnn::IWorkloadFactory& refWorkloadFactory, float beta); LayerTestResult FullyConnectedFloat32Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, bool biasEnabled, bool transposeWeights); std::vector> SplitterTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult CopyViaSplitterTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult ConcatTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult AdditionTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult AdditionBroadcast1ElementTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult AdditionBroadcastTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult CompareAdditionTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, armnn::IWorkloadFactory& refWorkloadFactory); LayerTestResult SubtractionTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SubtractionBroadcast1ElementTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SubtractionBroadcastTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult CompareActivationTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, armnn::IWorkloadFactory& refWorkloadFactory, armnn::ActivationFunction f, unsigned int batchSize); LayerTestResult DivisionTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult DivisionByZeroTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult DivisionBroadcast1ElementTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult DivisionBroadcast1DVectorTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult MultiplicationTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult MultiplicationBroadcast1ElementTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult MultiplicationBroadcast1DVectorTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult CompareMultiplicationTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, armnn::IWorkloadFactory& refWorkloadFactory); LayerTestResult BatchNormTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult BatchNormNhwcTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult CompareBatchNormTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, armnn::IWorkloadFactory& refWorkloadFactory); LayerTestResult BoundedReLuUpperAndLowerBoundTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult BoundedReLuUint8UpperAndLowerBoundTest( armnn::IWorkloadFactory& workloadFactor, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManagery); LayerTestResult BoundedReLuUpperBoundOnlyTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult BoundedReLuUint8UpperBoundOnlyTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult CompareBoundedReLuTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, armnn::IWorkloadFactory& refWorkloadFactory, float upperBound, float lowerBound); LayerTestResult ReLuTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult ReLuUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult ReLuInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult BoundedReLuInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SoftReLuTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SoftReLuUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SoftReLuInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult LeakyReLuTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult LeakyReLuUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult LeakyReLuInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult AbsTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult AbsUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult AbsInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SqrtTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SqrtUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SqrtInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SquareTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SquareUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SquareInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult TanhTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult TanhUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult TanhInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); // Tests that the output should be identical to the input when the output dimensions match the input ones. template> LayerTestResult ResizeBilinearNopTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, const armnn::DataLayout dataLayout); // Tests the behaviour of the resize bilinear operation when rescaling a 2x2 image into a 1x1 image. template> LayerTestResult SimpleResizeBilinearTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, const armnn::DataLayout dataLayout); // Tests the resize bilinear for minification of a square input matrix (also: input dimensions are a // multiple of output dimensions). template> LayerTestResult ResizeBilinearSqMinTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, const armnn::DataLayout dataLayout); // Tests the resize bilinear for minification (output dimensions smaller than input dimensions). template> LayerTestResult ResizeBilinearMinTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, const armnn::DataLayout dataLayout); // Tests the resize bilinear for magnification (output dimensions bigger than input dimensions). template> LayerTestResult ResizeBilinearMagTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, const armnn::DataLayout dataLayout); // Tests that the output should be identical to the input when the output dimensions match the input ones. template> LayerTestResult ResizeNearestNeighborNopTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, const armnn::DataLayout dataLayout); // Tests the behaviour of the resize NearestNeighbor operation when rescaling a 2x2 image into a 1x1 image. template> LayerTestResult SimpleResizeNearestNeighborTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, const armnn::DataLayout dataLayout); // Tests the resize NearestNeighbor for minification of a square input matrix (also: input dimensions are a // multiple of output dimensions). template> LayerTestResult ResizeNearestNeighborSqMinTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, const armnn::DataLayout dataLayout); // Tests the resize NearestNeighbor for minification (output dimensions smaller than input dimensions). template> LayerTestResult ResizeNearestNeighborMinTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, const armnn::DataLayout dataLayout); // Tests the resize NearestNeighbor for magnification (output dimensions bigger than input dimensions). template> LayerTestResult ResizeNearestNeighborMagTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, const armnn::DataLayout dataLayout, float inQuantScale, int32_t inQuantOffset, float outQuantScale, int32_t outQuantOffset); template> LayerTestResult Rsqrt2dTestCommon( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, const armnn::TensorInfo inputTensorInfo, const armnn::TensorInfo outputTensorInfo, const std::vector& inputValues, const std::vector& expectedOutputValues); template> LayerTestResult Rsqrt2dTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); template> LayerTestResult Rsqrt3dTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); template> LayerTestResult RsqrtZeroTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); template> LayerTestResult RsqrtNegativeTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult BatchNormTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult BatchNormNhwcTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult FakeQuantizationTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult L2NormalizationDefaultEpsilonTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, const armnn::DataLayout layout); LayerTestResult L2NormalizationNonDefaultEpsilonTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, const armnn::DataLayout layout); LayerTestResult L2Normalization1dTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, const armnn::DataLayout layout); LayerTestResult L2Normalization1dInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, const armnn::DataLayout layout); LayerTestResult L2Normalization1dUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, const armnn::DataLayout layout); LayerTestResult L2Normalization2dTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, const armnn::DataLayout layout); LayerTestResult L2Normalization2dInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, const armnn::DataLayout layout); LayerTestResult L2Normalization2dUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, const armnn::DataLayout layout); LayerTestResult L2Normalization2dShapeTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult L2Normalization3dTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, const armnn::DataLayout layout); LayerTestResult L2Normalization3dInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, const armnn::DataLayout layout); LayerTestResult L2Normalization3dUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, const armnn::DataLayout layout); LayerTestResult L2Normalization4dTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, const armnn::DataLayout layout); LayerTestResult L2Normalization4dInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, const armnn::DataLayout layout); LayerTestResult L2Normalization4dUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, const armnn::DataLayout layout); LayerTestResult ConstantTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult ConstantUint8SimpleQuantizationScaleNoOffsetTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult ConstantInt16SimpleQuantizationScaleNoOffsetTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult BoundedReLuUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, float upperBound); LayerTestResult BoundedReLuUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, float upperBound, float lowerBound); template> LayerTestResult FullyConnectedTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, bool biasEnabled); std::vector> SplitterUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); std::vector> SplitterInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult CopyViaSplitterUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult CopyViaSplitterInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult ConcatUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult ConcatUint16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult ConcatUint8DifferentQParamsTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult AdditionUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult AdditionBroadcast1ElementUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult AdditionBroadcastUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult AdditionInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult AdditionBroadcastInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult AdditionBroadcast1ElementInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SubtractionUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SubtractionBroadcast1ElementUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SubtractionBroadcastUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SubtractionInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SubtractionBroadcast1ElementInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SubtractionBroadcastInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult CompareActivationUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, armnn::IWorkloadFactory& refWorkloadFactory, armnn::ActivationFunction f); LayerTestResult CompareActivationInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, armnn::IWorkloadFactory& refWorkloadFactory, armnn::ActivationFunction f); LayerTestResult CompareSoftmaxUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, armnn::IWorkloadFactory& refWorkloadFactory, float beta); LayerTestResult MultiplicationUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult MultiplicationBroadcast1ElementUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult MultiplicationBroadcast1DVectorUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult MultiplicationInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult MultiplicationBroadcast1ElementInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult MultiplicationBroadcast1DVectorInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult DivisionUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult DivisionBroadcast1ElementUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult DivisionBroadcast1DVectorUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult DivisionInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult DivisionBroadcast1ElementInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult DivisionBroadcast1DVectorInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SimpleConvolution2d3x5Uint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, bool biasEnabled, const armnn::DataLayout layout); LayerTestResult SimpleConvolution2d3x3Uint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, bool biasEnabled, const armnn::DataLayout layout); LayerTestResult SimpleConvolution2d3x5QSymm16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, bool biasEnabled, const armnn::DataLayout layout); LayerTestResult SimpleConvolution2d3x3QSymm16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, bool biasEnabled, const armnn::DataLayout layout); LayerTestResult DepthwiseConvolution2dUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, bool biasEnabled, const armnn::DataLayout layout); LayerTestResult DepthwiseConvolution2dDepthMul1Uint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, bool biasEnabled, const armnn::DataLayout layout); LayerTestResult DepthwiseConvolution2dInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, bool biasEnabled, const armnn::DataLayout layout); LayerTestResult DepthwiseConvolution2dDepthMul1Int16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, bool biasEnabled, const armnn::DataLayout layout); LayerTestResult ConstantLinearActivationUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult ConstantLinearActivationInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult BatchNormUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult BatchNormUint8NhwcTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult BatchNormInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult BatchNormInt16NhwcTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult ConstantUint8CustomQuantizationScaleAndOffsetTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult ConstantInt16CustomQuantizationScaleAndOffsetTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult Concatenation1dUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult Concatenation2dDim0Uint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult Concatenation2dDim1Uint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult Concatenation2dDim0DiffInputDimsUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult Concatenation2dDim1DiffInputDimsUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult Concatenation3dDim0Uint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult Concatenation3dDim1Uint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult Concatenation3dDim2Uint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, bool useSubtensor); LayerTestResult Concatenation3dDim0DiffInputDimsUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult Concatenation3dDim1DiffInputDimsUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult Concatenation3dDim2DiffInputDimsUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, bool useSubtensor); LayerTestResult EqualSimpleTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult EqualBroadcast1ElementTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult EqualBroadcast1DVectorTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult EqualUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult EqualBroadcast1ElementUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult EqualBroadcast1DVectorUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult GreaterSimpleTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult GreaterBroadcast1ElementTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult GreaterBroadcast1DVectorTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult GreaterUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult GreaterBroadcast1ElementUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult GreaterBroadcast1DVectorUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult FullyConnectedLargeTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, bool transposeWeights); LayerTestResult PadUint82dTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult PadUint82dCustomPaddingTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult PadUint83dTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult PadUint84dTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult PadFloat322dTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult PadFloat322dCustomPaddingTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult PadFloat323dTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult PadFloat324dTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); template> LayerTestResult Pad2dTestCommon( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, float qScale, int32_t qOffset, const float customPaddingValue = 0.0f); template> LayerTestResult Pad3dTestCommon( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, float qScale, int32_t qOffset); template> LayerTestResult Pad4dTestCommon( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, float qScale, int32_t qOffset); void LstmUtilsZeroVectorTest(); void LstmUtilsMeanStddevNormalizationNoneZeroInputTest(); void LstmUtilsMeanStddevNormalizationAllZeroInputTest(); void LstmUtilsMeanStddevNormalizationMixedZeroInputTest(); void LstmUtilsVectorBatchVectorCwiseProductTest(); void LstmUtilsVectorBatchVectorAddTest(); LayerTestResult LstmLayerFloat32WithCifgWithPeepholeNoProjectionTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult LstmLayerFloat32NoCifgNoPeepholeNoProjectionTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult LstmLayerFloat32NoCifgWithPeepholeWithProjectionTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult LstmLayerFloat32NoCifgWithPeepholeWithProjectionWithLayerNormTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult LstmLayerInt16NoCifgNoPeepholeNoProjectionTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult LstmLayerInt16WithCifgWithPeepholeNoProjectionTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult LstmLayerInt16NoCifgWithPeepholeWithProjectionTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult LstmLayerInt16NoCifgNoPeepholeNoProjectionInt16ConstantTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); // QuantizedLstm LayerTestResult QuantizedLstmTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SimpleConvertFp16ToFp32Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SimpleConvertFp32ToFp16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult MaximumSimpleTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult MaximumBroadcast1ElementTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult MaximumBroadcast1DVectorTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult MaximumUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult MaximumBroadcast1ElementUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult MaximumBroadcast1DVectorUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult MaximumInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult MaximumBroadcast1ElementInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult MaximumBroadcast1DVectorInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); template> LayerTestResult MeanSimpleTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); template> LayerTestResult MeanSimpleAxisTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); template> LayerTestResult MeanKeepDimsTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); template> LayerTestResult MeanMultipleDimsTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); template> LayerTestResult MeanVts1Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); template> LayerTestResult MeanVts2Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); template> LayerTestResult MeanVts3Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult MinimumBroadcast1ElementTest1( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult MinimumBroadcast1ElementTest2( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult MinimumBroadcast1DVectorUint8Test( armnn::IWorkloadFactory & workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr & memoryManager); LayerTestResult MinimumInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult MinimumBroadcast1ElementInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult MinimumBroadcast1DVectorInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult AdditionAfterMaxPoolTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SpaceToBatchNdSimpleFloat32Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SpaceToBatchNdMultiChannelsFloat32Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SpaceToBatchNdMultiBlockFloat32Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SpaceToBatchNdPaddingFloat32Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SpaceToBatchNdSimpleUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SpaceToBatchNdMultiChannelsUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SpaceToBatchNdMultiBlockUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SpaceToBatchNdPaddingUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SpaceToBatchNdSimpleNHWCFloat32Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SpaceToBatchNdMultiChannelsNHWCFloat32Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SpaceToBatchNdMultiBlockNHWCFloat32Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SpaceToBatchNdPaddingNHWCFloat32Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SpaceToBatchNdSimpleNHWCUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SpaceToBatchNdMultiChannelsNHWCUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SpaceToBatchNdMultiBlockNHWCUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SpaceToBatchNdPaddingNHWCUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SpaceToBatchNdSimpleUint16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SpaceToBatchNdMultiChannelsUint16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SpaceToBatchNdMultiBlockUint16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SpaceToBatchNdPaddingUint16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SpaceToBatchNdSimpleNHWCUint16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SpaceToBatchNdMultiChannelsNHWCUint16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SpaceToBatchNdMultiBlockNHWCUint16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SpaceToBatchNdPaddingNHWCUint16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult BatchToSpaceNdNhwcTest1( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult BatchToSpaceNdNhwcTest2( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult BatchToSpaceNdNhwcTest3( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult BatchToSpaceNdNhwcTest4( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult BatchToSpaceNdNchwTest1( armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult BatchToSpaceNdNchwTest2( armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult BatchToSpaceNdNchwTest3( armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult BatchToSpaceNdNhwcTest5( armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult BatchToSpaceNdNhwcTest6( armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult BatchToSpaceNdNhwcTest7( armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult BatchToSpaceNdNchwTest4( armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult BatchToSpaceNdNchwTest5( armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult BatchToSpaceNdNchwTest6( armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult BatchToSpaceNdNchwTest7( armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult StridedSlice4DFloat32Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult StridedSlice4DReverseFloat32Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult StridedSliceSimpleStrideFloat32Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult StridedSliceSimpleRangeMaskFloat32Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult StridedSliceShrinkAxisMaskFloat32Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult StridedSlice3DFloat32Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult StridedSlice3DReverseFloat32Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult StridedSlice2DFloat32Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult StridedSlice2DReverseFloat32Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult StridedSlice4DUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult StridedSlice4DReverseUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult StridedSliceSimpleStrideUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult StridedSliceSimpleRangeMaskUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult StridedSliceShrinkAxisMaskUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult StridedSlice3DUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult StridedSlice3DReverseUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult StridedSlice2DUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult StridedSlice2DReverseUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult StridedSlice4DInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult StridedSlice4DReverseInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult StridedSliceSimpleStrideInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult StridedSliceSimpleRangeMaskInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult StridedSliceShrinkAxisMaskInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult StridedSlice3DInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult StridedSlice3DReverseInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult StridedSlice2DInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult StridedSlice2DReverseInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult Debug4DFloat32Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult Debug3DFloat32Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult Debug2DFloat32Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult Debug1DFloat32Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult Debug4DUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult Debug3DUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult Debug2DUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult Debug1DUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult PreCompiledConvolution2dTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult PreCompiledConvolution2dStride2x2Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult PreCompiledDepthwiseConvolution2dTest( armnn::IWorkloadFactory & workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr & memoryManager); LayerTestResult PreCompiledDepthwiseConvolution2dStride2x2Test( armnn::IWorkloadFactory & workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr & memoryManager); LayerTestResult PreCompiledMaxPooling2dTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult Debug4DFloat32Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult Debug3DFloat32Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult Debug2DFloat32Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult Debug1DFloat32Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult Debug4DUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult Debug3DUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult Debug2DUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult Debug1DUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult Gather1DParamsFloatTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult Gather1DParamsUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult Gather1DParamsInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult GatherMultiDimParamsFloatTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult GatherMultiDimParamsUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult GatherMultiDimParamsInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult GatherMultiDimParamsMultiDimIndicesFloatTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult GatherMultiDimParamsMultiDimIndicesUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult GatherMultiDimParamsMultiDimIndicesInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult DequantizeSimpleUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult DequantizeOffsetUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult DequantizeSimpleInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SpaceToDepthNCHWAsymmQ8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SpaceToDepthNHWCAsymmQ8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SpaceToDepthNHWCFloat32Test1( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SpaceToDepthNCHWFloat32Test1( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SpaceToDepthNHWCFloat32Test2( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SpaceToDepthNCHWFloat32Test2( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SpaceToDepthNHWCQSymm16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult SpaceToDepthNCHWQSymm16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult QuantizeSimpleUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult QuantizeClampUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult QuantizeClampInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); template LayerTestResult SimpleFullyConnectedTestImpl( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, armnn::TensorInfo inputTensorInfo, armnn::TensorInfo outputTensorInfo, armnn::TensorInfo weightsDesc, armnn::TensorInfo biasesDesc, boost::multi_array& weights, boost::multi_array& bias, boost::multi_array& input, bool biasEnabled, bool transposeWeights) { std::unique_ptr inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo); std::unique_ptr outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo); armnn::FullyConnectedQueueDescriptor data; armnn::WorkloadInfo info; armnn::ScopedCpuTensorHandle weightsTensor(weightsDesc); armnn::ScopedCpuTensorHandle biasTensor(biasesDesc); AllocateAndCopyDataToITensorHandle(&weightsTensor, &weights[0][0]); AllocateAndCopyDataToITensorHandle(&biasTensor, &bias[0]); AddInputToWorkload(data, info, inputTensorInfo, inputHandle.get()); AddOutputToWorkload(data, info, outputTensorInfo, outputHandle.get()); data.m_Weight = &weightsTensor; data.m_Bias = &biasTensor; data.m_Parameters.m_BiasEnabled = biasEnabled; data.m_Parameters.m_TransposeWeightMatrix = transposeWeights; std::unique_ptr workload = workloadFactory.CreateFullyConnected(data, info); LayerTestResult result(outputTensorInfo); inputHandle->Allocate(); outputHandle->Allocate(); CopyDataToITensorHandle(inputHandle.get(), &input[0][0][0][0]); ExecuteWorkload(*workload, memoryManager); CopyDataFromITensorHandle(&result.output[0][0], outputHandle.get()); return result; } template > std::vector ConvertToDataType(const std::vector& input, const armnn::TensorInfo& inputTensorInfo) { std::vector output(input.size()); auto outputTensorInfo = inputTensorInfo; outputTensorInfo.SetDataType(ArmnnType); std::unique_ptr> pOutputEncoder = armnn::MakeEncoder(outputTensorInfo, output.data()); armnn::Encoder& rOutputEncoder = *pOutputEncoder; for (auto it = input.begin(); it != input.end(); ++it) { rOutputEncoder.Set(*it); ++rOutputEncoder; } return output; } // Utility method to convert a single value to the correct type template T ConvertToDataType(const float& value, const armnn::TensorInfo& tensorInfo) { std::vector output(1); std::unique_ptr> pEncoder = armnn::MakeEncoder(tensorInfo, output.data()); armnn::Encoder& rEncoder = *pEncoder; rEncoder.Set(value); return output[0]; } template LayerTestResult Rsqrt2dTestCommon( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, const armnn::TensorInfo inputTensorInfo, const armnn::TensorInfo outputTensorInfo, const std::vector& inputValues, const std::vector& expectedOutputValues) { auto inputTensor = MakeTensor(inputTensorInfo, ConvertToDataType(inputValues,inputTensorInfo)); LayerTestResult result(outputTensorInfo); result.outputExpected = MakeTensor(outputTensorInfo, ConvertToDataType(expectedOutputValues,outputTensorInfo)); std::unique_ptr inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo); std::unique_ptr outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo); armnn::RsqrtQueueDescriptor descriptor; armnn::WorkloadInfo info; AddInputToWorkload(descriptor, info, inputTensorInfo, inputHandle.get()); AddOutputToWorkload(descriptor, info, outputTensorInfo, outputHandle.get()); std::unique_ptr workload = workloadFactory.CreateRsqrt(descriptor, info); inputHandle->Allocate(); outputHandle->Allocate(); CopyDataToITensorHandle(inputHandle.get(), &inputTensor[0][0]); workload->PostAllocationConfigure(); workload->Execute(); CopyDataFromITensorHandle(&result.output[0][0], outputHandle.get()); return result; } template LayerTestResult Rsqrt2dTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) { const armnn::TensorShape inputShape{ 2, 2 }; const armnn::TensorShape outputShape{ 2, 2 }; armnn::TensorInfo inputTensorInfo(inputShape, ArmnnType); inputTensorInfo.SetQuantizationScale(0.1f); inputTensorInfo.SetQuantizationOffset(0); armnn::TensorInfo outputTensorInfo(outputShape, ArmnnType); outputTensorInfo.SetQuantizationScale(0.1f); outputTensorInfo.SetQuantizationOffset(0); std::vector inputValues { 1.f, 4.f, 16.f, 25.f }; std::vector expectedOutputValues { 1.f, 0.5f, 0.25f, 0.2f }; return Rsqrt2dTestCommon(workloadFactory, memoryManager, inputTensorInfo, outputTensorInfo, inputValues, expectedOutputValues); } template LayerTestResult Rsqrt3dTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) { const armnn::TensorShape inputShape{ 3, 1, 2 }; const armnn::TensorShape outputShape{ 3, 1, 2 }; armnn::TensorInfo inputTensorInfo(inputShape, ArmnnType); inputTensorInfo.SetQuantizationScale(0.1f); inputTensorInfo.SetQuantizationOffset(0); armnn::TensorInfo outputTensorInfo(outputShape, ArmnnType); outputTensorInfo.SetQuantizationScale(0.1f); outputTensorInfo.SetQuantizationOffset(0); std::vector inputValues { 1.f, 4.f, 16.f, 25.f, 64.f, 100.f }; std::vector expectedOutputValues { 1.f, 0.5f, 0.25f, 0.2f, 0.125f, 0.1f }; auto inputTensor = MakeTensor(inputTensorInfo, ConvertToDataType(inputValues,inputTensorInfo)); LayerTestResult result(outputTensorInfo); result.outputExpected = MakeTensor(outputTensorInfo, ConvertToDataType(expectedOutputValues,outputTensorInfo)); std::unique_ptr inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo); std::unique_ptr outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo); armnn::RsqrtQueueDescriptor descriptor; armnn::WorkloadInfo info; AddInputToWorkload(descriptor, info, inputTensorInfo, inputHandle.get()); AddOutputToWorkload(descriptor, info, outputTensorInfo, outputHandle.get()); std::unique_ptr workload = workloadFactory.CreateRsqrt(descriptor, info); inputHandle->Allocate(); outputHandle->Allocate(); CopyDataToITensorHandle(inputHandle.get(), &inputTensor[0][0][0]); workload->PostAllocationConfigure(); workload->Execute(); CopyDataFromITensorHandle(&result.output[0][0][0], outputHandle.get()); return result; } template LayerTestResult RsqrtZeroTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) { const armnn::TensorShape inputShape{ 1, 2 }; const armnn::TensorShape outputShape{ 1, 2 }; armnn::TensorInfo inputTensorInfo(inputShape, ArmnnType); inputTensorInfo.SetQuantizationScale(0.1f); armnn::TensorInfo outputTensorInfo(outputShape, ArmnnType); outputTensorInfo.SetQuantizationScale(0.1f); std::vector inputValues { 0.f, -0.f }; std::vector expectedOutputValues { INFINITY, -INFINITY }; return Rsqrt2dTestCommon(workloadFactory, memoryManager, inputTensorInfo, outputTensorInfo, inputValues, expectedOutputValues); } template LayerTestResult RsqrtNegativeTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) { const armnn::TensorShape inputShape{ 1, 2 }; const armnn::TensorShape outputShape{ 1, 2 }; armnn::TensorInfo inputTensorInfo(inputShape, ArmnnType); inputTensorInfo.SetQuantizationScale(0.1f); inputTensorInfo.SetQuantizationOffset(0); armnn::TensorInfo outputTensorInfo(outputShape, ArmnnType); outputTensorInfo.SetQuantizationScale(0.1f); outputTensorInfo.SetQuantizationOffset(0); std::vector inputValues { -25.f, -16.f }; std::vector expectedOutputValues { -NAN, -NAN }; return Rsqrt2dTestCommon(workloadFactory, memoryManager, inputTensorInfo, outputTensorInfo, inputValues, expectedOutputValues); } template LayerTestResult SimpleReshapeTestImpl( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, armnn::TensorInfo inputTensorInfo, armnn::TensorInfo outputTensorInfo, const std::vector& inputData, const std::vector& outputExpectedData) { auto input = MakeTensor(inputTensorInfo, inputData); LayerTestResult ret(outputTensorInfo); ret.outputExpected = MakeTensor(outputTensorInfo, outputExpectedData); std::unique_ptr inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo); std::unique_ptr outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo); armnn::ReshapeQueueDescriptor data; armnn::WorkloadInfo info; AddInputToWorkload(data, info, inputTensorInfo, inputHandle.get()); AddOutputToWorkload(data, info, outputTensorInfo, outputHandle.get()); std::unique_ptr workload = workloadFactory.CreateReshape(data, info); inputHandle->Allocate(); outputHandle->Allocate(); CopyDataToITensorHandle(inputHandle.get(), &input[0][0][0][0]); workload->Execute(); CopyDataFromITensorHandle(&ret.output[0][0][0][0], outputHandle.get()); return ret; } template LayerTestResult FullyConnectedTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, bool biasEnabled) { constexpr static unsigned int inputWidth = 3u; constexpr static unsigned int inputHeight = 2u; constexpr static unsigned int inputChannels = 1u; constexpr static unsigned int inputSize = inputWidth * inputHeight * inputChannels; constexpr static unsigned int outputChannels = 2u; armnn::TensorInfo inputTensorInfo({ 1, inputChannels, inputHeight, inputWidth }, ArmnnType); inputTensorInfo.SetQuantizationScale(0.1f); inputTensorInfo.SetQuantizationOffset(63); armnn::TensorInfo outputTensorInfo({ 1, outputChannels }, ArmnnType); outputTensorInfo.SetQuantizationScale(5.f); outputTensorInfo.SetQuantizationOffset(biasEnabled ? -50 : 10); armnn::TensorInfo weightsDesc({ outputChannels, inputSize }, ArmnnType); weightsDesc.SetQuantizationScale(0.2f); weightsDesc.SetQuantizationOffset(93); armnn::TensorInfo biasesDesc({ outputChannels }, GetBiasTypeFromWeightsType(weightsDesc.GetDataType()).value()); biasesDesc.SetQuantizationScale(inputTensorInfo.GetQuantizationScale() * weightsDesc.GetQuantizationScale()); biasesDesc.SetQuantizationOffset(0); LayerTestResult result(outputTensorInfo); auto input = MakeTensor(inputTensorInfo, ConvertToDataType( { -1.2f, 6.1f, -3.5f, 18.8f, -5.5f, 2.9f }, inputTensorInfo)); auto weights = MakeTensor(weightsDesc, ConvertToDataType( { -8.4f, 20.0f, -10.4f, -8, 16.4f, -11.8f, 23.4f, 10.4f, -14.0f, -3.8f, -11.8f, 11.4f }, weightsDesc)); auto bias = MakeTensor(biasesDesc, std::vector{9250, 67500}); result = SimpleFullyConnectedTestImpl( workloadFactory, memoryManager, inputTensorInfo, outputTensorInfo, weightsDesc, biasesDesc, weights, bias, input, biasEnabled, true ); if (biasEnabled) { result.outputExpected = MakeTensor(outputTensorInfo, ConvertToDataType({80.f, 1460.f}, outputTensorInfo)); } else { result.outputExpected = MakeTensor(outputTensorInfo, ConvertToDataType({-107.04f, 110.f}, outputTensorInfo)); } return result; } template LayerTestResult SimpleReshapeTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) { armnn::TensorInfo inputTensorInfo; armnn::TensorInfo outputTensorInfo; unsigned int inputShape[] = { 2, 2, 3, 3 }; unsigned int outputShape[] = { 2, 2, 9, 1 }; inputTensorInfo = armnn::TensorInfo(4, inputShape, ArmnnType); inputTensorInfo.SetQuantizationScale(1.0f); outputTensorInfo = armnn::TensorInfo(4, outputShape, ArmnnType); outputTensorInfo.SetQuantizationScale(1.0f); auto input = ConvertToDataType( { 0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f, 19.0f, 20.0f, 21.0f, 22.0f, 23.0f, 24.0f, 25.0f, 26.0f, 27.0f, 28.0f, 29.0f, 30.0f, 31.0f, 32.0f, 33.0f, 34.0f, 35.0f, }, inputTensorInfo); auto outputExpected = ConvertToDataType( { 0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f, 19.0f, 20.0f, 21.0f, 22.0f, 23.0f, 24.0f, 25.0f, 26.0f, 27.0f, 28.0f, 29.0f, 30.0f, 31.0f, 32.0f, 33.0f, 34.0f, 35.0f, }, outputTensorInfo); return SimpleReshapeTestImpl( workloadFactory, memoryManager, inputTensorInfo, outputTensorInfo, input, outputExpected); } template> LayerTestResult SimpleFloorTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) { armnn::TensorInfo inputTensorInfo({1, 3, 2, 3}, ArmnnType); inputTensorInfo.SetQuantizationScale(0.1f); armnn::TensorInfo outputTensorInfo(inputTensorInfo); outputTensorInfo.SetQuantizationScale(0.1f); auto input = MakeTensor(inputTensorInfo, ConvertToDataType( { -37.5f, -15.2f, -8.76f, -2.0f, -1.5f, -1.3f, -0.5f, -0.4f, 0.0f, 1.0f, 0.4f, 0.5f, 1.3f, 1.5f, 2.0f, 8.76f, 15.2f, 37.5f }, inputTensorInfo)); LayerTestResult ret(outputTensorInfo); ret.outputExpected = MakeTensor(outputTensorInfo, ConvertToDataType( { -38.0f, -16.0f, -9.0f, -2.0f, -2.0f, -2.0f, -1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 2.0f, 8.0f, 15.0f, 37.0f }, outputTensorInfo)); std::unique_ptr inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo); std::unique_ptr outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo); armnn::FloorQueueDescriptor data; armnn::WorkloadInfo info; AddInputToWorkload(data, info, inputTensorInfo, inputHandle.get()); AddOutputToWorkload(data, info, outputTensorInfo, outputHandle.get()); std::unique_ptr workload = workloadFactory.CreateFloor(data, info); inputHandle->Allocate(); outputHandle->Allocate(); CopyDataToITensorHandle(inputHandle.get(), &input[0][0][0][0]); workload->Execute(); CopyDataFromITensorHandle(&ret.output[0][0][0][0], outputHandle.get()); return ret; } template LayerTestResult ResizeBilinearNopTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, const armnn::DataLayout dataLayout) { armnn::TensorInfo inputTensorInfo = armnn::IsQuantizedType() ? armnnUtils::GetTensorInfo(1, 1, 4, 4, dataLayout, ArmnnType) : armnnUtils::GetTensorInfo(1, 2, 4, 4, dataLayout, ArmnnType); armnn::TensorInfo outputTensorInfo = armnn::IsQuantizedType() ? armnnUtils::GetTensorInfo(1, 1, 4, 4, dataLayout, ArmnnType) : armnnUtils::GetTensorInfo(1, 2, 4, 4, dataLayout, ArmnnType); if (armnn::IsQuantizedType()) { inputTensorInfo.SetQuantizationScale(1.5f); inputTensorInfo.SetQuantizationOffset(-3); outputTensorInfo.SetQuantizationScale(1.5f); outputTensorInfo.SetQuantizationOffset(-3); } std::vector inputData = armnn::IsQuantizedType() ? std::initializer_list { 1, 2, 3, 4, 2, 3, 4, 5, 3, 4, 5, 6, 4, 5, 6, 7 } : std::initializer_list { 1.0f, 2.0f, 3.0f, 4.0f, 2.0f, 3.0f, 4.0f, 5.0f, 3.0f, 4.0f, 5.0f, 6.0f, 4.0f, 5.0f, 6.0f, 7.0f, 1.0f, 2.0f, 3.0f, 4.0f, 2.0f, 3.0f, 4.0f, 5.0f, 3.0f, 4.0f, 5.0f, 6.0f, 4.0f, 5.0f, 6.0f, 7.0f }; const armnn::PermutationVector NCHWToNHWC = { 0, 3, 1, 2 }; if (dataLayout == armnn::DataLayout::NHWC) { std::vector tmp(inputData.size()); armnnUtils::Permute(inputTensorInfo.GetShape(), NCHWToNHWC, inputData.data(), tmp.data(), sizeof(float)); inputData = tmp; } auto input = MakeTensor(inputTensorInfo, QuantizedVector(inputTensorInfo.GetQuantizationScale(), inputTensorInfo.GetQuantizationOffset(), inputData)); LayerTestResult result(outputTensorInfo); result.outputExpected = input; std::unique_ptr inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo); std::unique_ptr outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo); armnn::ResizeQueueDescriptor descriptor; descriptor.m_Parameters.m_Method = armnn::ResizeMethod::Bilinear; descriptor.m_Parameters.m_DataLayout = dataLayout; armnn::WorkloadInfo info; AddInputToWorkload(descriptor, info, inputTensorInfo, inputHandle.get()); AddOutputToWorkload(descriptor, info, outputTensorInfo, outputHandle.get()); std::unique_ptr workload = workloadFactory.CreateResize(descriptor, info); inputHandle->Allocate(); outputHandle->Allocate(); CopyDataToITensorHandle(inputHandle.get(), &input[0][0][0][0]); workload->PostAllocationConfigure(); workload->Execute(); CopyDataFromITensorHandle(&result.output[0][0][0][0], outputHandle.get()); return result; } template LayerTestResult SimpleResizeBilinearTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, const armnn::DataLayout dataLayout) { armnn::TensorInfo inputTensorInfo = armnn::IsQuantizedType() ? armnnUtils::GetTensorInfo(1, 1, 2, 2, dataLayout, ArmnnType) : armnnUtils::GetTensorInfo(1, 2, 2, 2, dataLayout, ArmnnType); armnn::TensorInfo outputTensorInfo = armnn::IsQuantizedType() ? armnnUtils::GetTensorInfo(1, 1, 1, 1, dataLayout, ArmnnType) : armnnUtils::GetTensorInfo(1, 2, 1, 1, dataLayout, ArmnnType); if (armnn::IsQuantizedType()) { inputTensorInfo.SetQuantizationScale(0.1567f); inputTensorInfo.SetQuantizationOffset(1); outputTensorInfo.SetQuantizationScale(0.1567f); outputTensorInfo.SetQuantizationOffset(1); } std::vector inputData = armnn::IsQuantizedType() ? std::initializer_list { 1, 255, 200, 250 } : std::initializer_list { 1.0f, 255.0f, 200.0f, 250.0f, 250.0f, 200.0f, 250.0f, 1.0f }; // The 'resize bilinear' operation projects the top-left corner of output texels into the input image, // then figures out the interpolants and weights. Note this is different to projecting the centre of the // output texel. Thus, for a input matrix of 2x2, we'll expect the output 1x1 matrix to contain, as // its single element, the value that was at position (0,0) of the input matrix (rather than an average, // which we would expect if projecting the centre). std::vector outputData = armnn::IsQuantizedType() ? std::initializer_list { 1 } : std::initializer_list { 1.0f, 250.0f }; const armnn::PermutationVector NCHWToNHWC = { 0, 3, 1, 2 }; if (dataLayout == armnn::DataLayout::NHWC) { std::vector tmp(inputData.size()); armnnUtils::Permute(inputTensorInfo.GetShape(), NCHWToNHWC, inputData.data(), tmp.data(), sizeof(float)); inputData = tmp; std::vector tmp1(outputData.size()); armnnUtils::Permute(outputTensorInfo.GetShape(), NCHWToNHWC, outputData.data(), tmp1.data(), sizeof(float)); outputData = tmp1; } auto input = MakeTensor(inputTensorInfo, QuantizedVector(inputTensorInfo.GetQuantizationScale(), inputTensorInfo.GetQuantizationOffset(), inputData)); LayerTestResult result(outputTensorInfo); result.outputExpected = MakeTensor(outputTensorInfo, QuantizedVector(outputTensorInfo.GetQuantizationScale(), outputTensorInfo.GetQuantizationOffset(), outputData)); std::unique_ptr inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo); std::unique_ptr outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo); armnn::ResizeQueueDescriptor descriptor; descriptor.m_Parameters.m_Method = armnn::ResizeMethod::Bilinear; descriptor.m_Parameters.m_DataLayout = dataLayout; armnn::WorkloadInfo info; AddInputToWorkload(descriptor, info, inputTensorInfo, inputHandle.get()); AddOutputToWorkload(descriptor, info, outputTensorInfo, outputHandle.get()); std::unique_ptr workload = workloadFactory.CreateResize(descriptor, info); inputHandle->Allocate(); outputHandle->Allocate(); CopyDataToITensorHandle(inputHandle.get(), &input[0][0][0][0]); workload->PostAllocationConfigure(); workload->Execute(); CopyDataFromITensorHandle(&result.output[0][0][0][0], outputHandle.get()); return result; } template LayerTestResult ResizeBilinearSqMinTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, const armnn::DataLayout dataLayout) { armnn::TensorInfo inputTensorInfo = armnn::IsQuantizedType() ? armnnUtils::GetTensorInfo(1, 1, 4, 4, dataLayout, ArmnnType) : armnnUtils::GetTensorInfo(1, 2, 4, 4, dataLayout, ArmnnType); armnn::TensorInfo outputTensorInfo = armnn::IsQuantizedType() ? armnnUtils::GetTensorInfo(1, 1, 2, 2, dataLayout, ArmnnType) : armnnUtils::GetTensorInfo(1, 2, 2, 2, dataLayout, ArmnnType); if (armnn::IsQuantizedType()) { inputTensorInfo.SetQuantizationScale(3.141592f); inputTensorInfo.SetQuantizationOffset(3); outputTensorInfo.SetQuantizationScale(3.141592f); outputTensorInfo.SetQuantizationOffset(3); } std::vector inputData = armnn::IsQuantizedType() ? std::initializer_list { 1, 2, 3, 4, 2, 3, 4, 5, 3, 4, 5, 6, 4, 5, 6, 7 } : std::initializer_list { 1.0f, 2.0f, 3.0f, 4.0f, 2.0f, 3.0f, 4.0f, 5.0f, 3.0f, 4.0f, 5.0f, 6.0f, 4.0f, 5.0f, 6.0f, 7.0f, 7.0f, 6.0f, 5.0f, 4.0f, 6.0f, 5.0f, 4.0f, 3.0f, 5.0f, 4.0f, 3.0f, 2.0f, 4.0f, 3.0f, 2.0f, 1.0f }; std::vector outputData = armnn::IsQuantizedType() ? std::initializer_list { 1, 3, 3, 5 } : std::initializer_list { 1.0f, 3.0f, 3.0f, 5.0f, 7.0f, 5.0f, 5.0f, 3.0f }; const armnn::PermutationVector NCHWToNHWC = { 0, 3, 1, 2 }; if (dataLayout == armnn::DataLayout::NHWC) { std::vector tmp(inputData.size()); armnnUtils::Permute(inputTensorInfo.GetShape(), NCHWToNHWC, inputData.data(), tmp.data(), sizeof(float)); inputData = tmp; std::vector tmp1(outputData.size()); armnnUtils::Permute(outputTensorInfo.GetShape(), NCHWToNHWC, outputData.data(), tmp1.data(), sizeof(float)); outputData = tmp1; } auto input = MakeTensor(inputTensorInfo, QuantizedVector(inputTensorInfo.GetQuantizationScale(), inputTensorInfo.GetQuantizationOffset(), inputData)); LayerTestResult result(outputTensorInfo); result.outputExpected = MakeTensor(outputTensorInfo, QuantizedVector(outputTensorInfo.GetQuantizationScale(), outputTensorInfo.GetQuantizationOffset(), outputData)); std::unique_ptr inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo); std::unique_ptr outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo); armnn::ResizeQueueDescriptor descriptor; descriptor.m_Parameters.m_Method = armnn::ResizeMethod::Bilinear; descriptor.m_Parameters.m_DataLayout = dataLayout; armnn::WorkloadInfo info; AddInputToWorkload(descriptor, info, inputTensorInfo, inputHandle.get()); AddOutputToWorkload(descriptor, info, outputTensorInfo, outputHandle.get()); std::unique_ptr workload = workloadFactory.CreateResize(descriptor, info); inputHandle->Allocate(); outputHandle->Allocate(); CopyDataToITensorHandle(inputHandle.get(), &input[0][0][0][0]); workload->PostAllocationConfigure(); workload->Execute(); CopyDataFromITensorHandle(&result.output[0][0][0][0], outputHandle.get()); return result; } template LayerTestResult ResizeBilinearMinTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, const armnn::DataLayout dataLayout) { armnn::TensorInfo inputTensorInfo = armnn::IsQuantizedType() ? armnnUtils::GetTensorInfo(1, 1, 2, 3, dataLayout, ArmnnType) : armnnUtils::GetTensorInfo(1, 2, 3, 5, dataLayout, ArmnnType); armnn::TensorInfo outputTensorInfo = armnn::IsQuantizedType() ? armnnUtils::GetTensorInfo(1, 1, 1, 2, dataLayout, ArmnnType) : armnnUtils::GetTensorInfo(1, 2, 2, 3, dataLayout, ArmnnType); if (armnn::IsQuantizedType()) { inputTensorInfo.SetQuantizationScale(1.5f); inputTensorInfo.SetQuantizationOffset(-1); outputTensorInfo.SetQuantizationScale(1.5f); outputTensorInfo.SetQuantizationOffset(-1); } std::vector inputData = armnn::IsQuantizedType() ? std::initializer_list { 3.0f, 4.5f, 6.0f, // 1, 2, 3, : Expected quantised values 9.0f, 13.5f, 21.0f // 5, 8, 13 } : std::initializer_list { 1.0f, 2.0f, 3.0f, 5.0f, 8.0f, 13.0f, 21.0f, 34.0f, 55.0f, 89.0f, 144.0f, 233.0f, 377.0f, 610.0f, 987.0f, 987.0f, 610.0f, 377.0f, 233.0f, 144.0f, 89.0f, 55.0f, 34.0f, 21.0f, 13.0f, 8.0f, 5.0f, 3.0f, 2.0f, 1.0f }; std::vector outputData = armnn::IsQuantizedType() ? std::initializer_list { 3.0f, 5.25f // 1, 3 } : std::initializer_list { 1.0f, 2.6666f, 6.00f, 78.5f, 179.3333f, 401.00f, 987.0f, 454.6670f, 203.33f, 48.5f, 22.3333f, 10.00f }; const armnn::PermutationVector NCHWToNHWC = { 0, 3, 1, 2 }; if (dataLayout == armnn::DataLayout::NHWC) { std::vector tmp(inputData.size()); armnnUtils::Permute(inputTensorInfo.GetShape(), NCHWToNHWC, inputData.data(), tmp.data(), sizeof(float)); inputData = tmp; std::vector tmp1(outputData.size()); armnnUtils::Permute(outputTensorInfo.GetShape(), NCHWToNHWC, outputData.data(), tmp1.data(), sizeof(float)); outputData = tmp1; } auto input = MakeTensor(inputTensorInfo, QuantizedVector(inputTensorInfo.GetQuantizationScale(), inputTensorInfo.GetQuantizationOffset(), inputData)); LayerTestResult result(outputTensorInfo); result.outputExpected = MakeTensor(outputTensorInfo, QuantizedVector(outputTensorInfo.GetQuantizationScale(), outputTensorInfo.GetQuantizationOffset(), outputData)); std::unique_ptr inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo); std::unique_ptr outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo); armnn::ResizeQueueDescriptor descriptor; descriptor.m_Parameters.m_Method = armnn::ResizeMethod::Bilinear; descriptor.m_Parameters.m_DataLayout = dataLayout; armnn::WorkloadInfo info; AddInputToWorkload(descriptor, info, inputTensorInfo, inputHandle.get()); AddOutputToWorkload(descriptor, info, outputTensorInfo, outputHandle.get()); std::unique_ptr workload = workloadFactory.CreateResize(descriptor, info); inputHandle->Allocate(); outputHandle->Allocate(); CopyDataToITensorHandle(inputHandle.get(), &input[0][0][0][0]); workload->PostAllocationConfigure(); workload->Execute(); CopyDataFromITensorHandle(&result.output[0][0][0][0], outputHandle.get()); return result; } template LayerTestResult ResizeBilinearMagTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, const armnn::DataLayout dataLayout) { armnn::TensorInfo inputTensorInfo = armnn::IsQuantizedType() ? armnnUtils::GetTensorInfo(1, 1, 3, 2, dataLayout, ArmnnType) : armnnUtils::GetTensorInfo(1, 2, 3, 2, dataLayout, ArmnnType); armnn::TensorInfo outputTensorInfo = armnn::IsQuantizedType() ? armnnUtils::GetTensorInfo(1, 1, 3, 5, dataLayout, ArmnnType) : armnnUtils::GetTensorInfo(1, 2, 3, 5, dataLayout, ArmnnType); if (armnn::IsQuantizedType()) { inputTensorInfo.SetQuantizationScale(0.010765f); inputTensorInfo.SetQuantizationOffset(7); outputTensorInfo.SetQuantizationScale(0.010132f); outputTensorInfo.SetQuantizationOffset(-18); } std::vector inputData = armnn::IsQuantizedType() ? std::initializer_list { 0.183005f, 2.379065f, // 24, 228, : Expected quantised values 1.05497f, 1.302565f, // 105, 128, 2.400595f, 0.68896f // 230, 71 } : std::initializer_list { 1.0f, 2.0f, 13.0f, 21.0f, 144.0f, 233.0f, 233.0f, 144.0f, 21.0f, 13.0f, 2.0f, 1.0f }; std::vector outputData = armnn::IsQuantizedType() ? std::initializer_list { 0.18300501f, 1.06142902f, 1.93985295f, 2.37906504f, 2.37906504f, 1.05497003f, 1.15400803f, 1.25304604f, 1.30256498f, 1.30256498f, 2.40059495f, 1.71594095f, 1.03128707f, 0.68896002f, 0.68896002f // 0, 87, 173, 217, 217, : Expected quantised values // 86, 96, 106, 111, 111, // 219, 151, 84, 50, 50 } : std::initializer_list { 1.0f, 1.4f, 1.8f, 2.0f, 2.0f, 13.0f, 16.2f, 19.4f, 21.0f, 21.0f, 144.0f, 179.6f, 215.2f, 233.0f, 233.0f, 233.0f, 197.4f, 161.8f, 144.0f, 144.0f, 21.0f, 17.8f, 14.6f, 13.0f, 13.0f, 2.0f, 1.6f, 1.2f, 1.0f, 1.0f }; const armnn::PermutationVector NCHWToNHWC = { 0, 3, 1, 2 }; if (dataLayout == armnn::DataLayout::NHWC) { std::vector tmp(inputData.size()); armnnUtils::Permute(inputTensorInfo.GetShape(), NCHWToNHWC, inputData.data(), tmp.data(), sizeof(float)); inputData = tmp; std::vector tmp1(outputData.size()); armnnUtils::Permute(outputTensorInfo.GetShape(), NCHWToNHWC, outputData.data(), tmp1.data(), sizeof(float)); outputData = tmp1; } auto input = MakeTensor(inputTensorInfo, QuantizedVector(inputTensorInfo.GetQuantizationScale(), inputTensorInfo.GetQuantizationOffset(), inputData)); LayerTestResult result(outputTensorInfo); result.outputExpected = MakeTensor(outputTensorInfo, QuantizedVector(outputTensorInfo.GetQuantizationScale(), outputTensorInfo.GetQuantizationOffset(), outputData)); std::unique_ptr inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo); std::unique_ptr outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo); armnn::ResizeQueueDescriptor descriptor; descriptor.m_Parameters.m_Method = armnn::ResizeMethod::Bilinear; descriptor.m_Parameters.m_DataLayout = dataLayout; armnn::WorkloadInfo info; AddInputToWorkload(descriptor, info, inputTensorInfo, inputHandle.get()); AddOutputToWorkload(descriptor, info, outputTensorInfo, outputHandle.get()); std::unique_ptr workload = workloadFactory.CreateResize(descriptor, info); inputHandle->Allocate(); outputHandle->Allocate(); CopyDataToITensorHandle(inputHandle.get(), &input[0][0][0][0]); workload->PostAllocationConfigure(); workload->Execute(); CopyDataFromITensorHandle(&result.output[0][0][0][0], outputHandle.get()); return result; } template LayerTestResult ResizeNearestNeighborNopTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, const armnn::DataLayout dataLayout) { armnn::TensorInfo inputTensorInfo = armnn::IsQuantizedType() ? armnnUtils::GetTensorInfo(1, 1, 4, 4, dataLayout, ArmnnType) : armnnUtils::GetTensorInfo(1, 2, 4, 4, dataLayout, ArmnnType); armnn::TensorInfo outputTensorInfo = armnn::IsQuantizedType() ? armnnUtils::GetTensorInfo(1, 1, 4, 4, dataLayout, ArmnnType) : armnnUtils::GetTensorInfo(1, 2, 4, 4, dataLayout, ArmnnType); if (armnn::IsQuantizedType()) { inputTensorInfo.SetQuantizationScale(1.5f); inputTensorInfo.SetQuantizationOffset(-3); outputTensorInfo.SetQuantizationScale(1.5f); outputTensorInfo.SetQuantizationOffset(-3); } std::vector inputData = armnn::IsQuantizedType() ? std::initializer_list { 1, 2, 3, 4, 2, 3, 4, 5, 3, 4, 5, 6, 4, 5, 6, 7 } : std::initializer_list { 1.0f, 2.0f, 3.0f, 4.0f, 2.0f, 3.0f, 4.0f, 5.0f, 3.0f, 4.0f, 5.0f, 6.0f, 4.0f, 5.0f, 6.0f, 7.0f, 1.0f, 2.0f, 3.0f, 4.0f, 2.0f, 3.0f, 4.0f, 5.0f, 3.0f, 4.0f, 5.0f, 6.0f, 4.0f, 5.0f, 6.0f, 7.0f }; const armnn::PermutationVector NCHWToNHWC = { 0, 3, 1, 2 }; if (dataLayout == armnn::DataLayout::NHWC) { std::vector tmp(inputData.size()); armnnUtils::Permute(inputTensorInfo.GetShape(), NCHWToNHWC, inputData.data(), tmp.data(), sizeof(float)); inputData = tmp; } auto input = MakeTensor(inputTensorInfo, QuantizedVector(inputTensorInfo.GetQuantizationScale(), inputTensorInfo.GetQuantizationOffset(), inputData)); LayerTestResult result(outputTensorInfo); result.outputExpected = input; std::unique_ptr inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo); std::unique_ptr outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo); armnn::ResizeQueueDescriptor descriptor; descriptor.m_Parameters.m_Method = armnn::ResizeMethod::NearestNeighbor; descriptor.m_Parameters.m_DataLayout = dataLayout; armnn::WorkloadInfo info; AddInputToWorkload(descriptor, info, inputTensorInfo, inputHandle.get()); AddOutputToWorkload(descriptor, info, outputTensorInfo, outputHandle.get()); std::unique_ptr workload = workloadFactory.CreateResize(descriptor, info); inputHandle->Allocate(); outputHandle->Allocate(); CopyDataToITensorHandle(inputHandle.get(), &input[0][0][0][0]); workload->PostAllocationConfigure(); workload->Execute(); CopyDataFromITensorHandle(&result.output[0][0][0][0], outputHandle.get()); return result; } template LayerTestResult SimpleResizeNearestNeighborTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, const armnn::DataLayout dataLayout) { armnn::TensorInfo inputTensorInfo = armnn::IsQuantizedType() ? armnnUtils::GetTensorInfo(1, 1, 2, 2, dataLayout, ArmnnType) : armnnUtils::GetTensorInfo(1, 2, 2, 2, dataLayout, ArmnnType); armnn::TensorInfo outputTensorInfo = armnn::IsQuantizedType() ? armnnUtils::GetTensorInfo(1, 1, 1, 1, dataLayout, ArmnnType) : armnnUtils::GetTensorInfo(1, 2, 1, 1, dataLayout, ArmnnType); if (armnn::IsQuantizedType()) { inputTensorInfo.SetQuantizationScale(0.1567f); inputTensorInfo.SetQuantizationOffset(1); outputTensorInfo.SetQuantizationScale(0.1567f); outputTensorInfo.SetQuantizationOffset(1); } std::vector inputData = armnn::IsQuantizedType() ? std::initializer_list { 1, 255, 200, 250 } : std::initializer_list { 1.0f, 255.0f, 200.0f, 250.0f, 250.0f, 200.0f, 250.0f, 1.0f }; // The 'resize' operation projects the top-left corner of output texels into the input image, // then figures out the interpolants and weights. Note this is different to projecting the centre of the // output texel. Thus, for a input matrix of 2x2, we'll expect the output 1x1 matrix to contain, as // its single element, the value that was at position (0,0) of the input matrix (rather than an average, // which we would expect if projecting the centre). std::vector outputData = armnn::IsQuantizedType() ? std::initializer_list { 1 } : std::initializer_list { 1.0f, 250.0f }; const armnn::PermutationVector NCHWToNHWC = { 0, 3, 1, 2 }; if (dataLayout == armnn::DataLayout::NHWC) { std::vector tmp(inputData.size()); armnnUtils::Permute(inputTensorInfo.GetShape(), NCHWToNHWC, inputData.data(), tmp.data(), sizeof(float)); inputData = tmp; std::vector tmp1(outputData.size()); armnnUtils::Permute(outputTensorInfo.GetShape(), NCHWToNHWC, outputData.data(), tmp1.data(), sizeof(float)); outputData = tmp1; } auto input = MakeTensor(inputTensorInfo, QuantizedVector(inputTensorInfo.GetQuantizationScale(), inputTensorInfo.GetQuantizationOffset(), inputData)); LayerTestResult result(outputTensorInfo); result.outputExpected = MakeTensor(outputTensorInfo, QuantizedVector(outputTensorInfo.GetQuantizationScale(), outputTensorInfo.GetQuantizationOffset(), outputData)); std::unique_ptr inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo); std::unique_ptr outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo); armnn::ResizeQueueDescriptor descriptor; descriptor.m_Parameters.m_DataLayout = dataLayout; descriptor.m_Parameters.m_Method = armnn::ResizeMethod::NearestNeighbor; armnn::WorkloadInfo info; AddInputToWorkload(descriptor, info, inputTensorInfo, inputHandle.get()); AddOutputToWorkload(descriptor, info, outputTensorInfo, outputHandle.get()); std::unique_ptr workload = workloadFactory.CreateResize(descriptor, info); inputHandle->Allocate(); outputHandle->Allocate(); CopyDataToITensorHandle(inputHandle.get(), &input[0][0][0][0]); workload->PostAllocationConfigure(); workload->Execute(); CopyDataFromITensorHandle(&result.output[0][0][0][0], outputHandle.get()); return result; } template LayerTestResult ResizeNearestNeighborSqMinTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, const armnn::DataLayout dataLayout) { armnn::TensorInfo inputTensorInfo = armnn::IsQuantizedType() ? armnnUtils::GetTensorInfo(1, 1, 4, 4, dataLayout, ArmnnType) : armnnUtils::GetTensorInfo(1, 2, 4, 4, dataLayout, ArmnnType); armnn::TensorInfo outputTensorInfo = armnn::IsQuantizedType() ? armnnUtils::GetTensorInfo(1, 1, 2, 2, dataLayout, ArmnnType) : armnnUtils::GetTensorInfo(1, 2, 2, 2, dataLayout, ArmnnType); if (armnn::IsQuantizedType()) { inputTensorInfo.SetQuantizationScale(3.141592f); inputTensorInfo.SetQuantizationOffset(3); outputTensorInfo.SetQuantizationScale(3.141592f); outputTensorInfo.SetQuantizationOffset(3); } std::vector inputData = armnn::IsQuantizedType() ? std::initializer_list { 1, 2, 3, 4, 2, 3, 4, 5, 3, 4, 5, 6, 4, 5, 6, 7 } : std::initializer_list { 1.0f, 2.0f, 3.0f, 4.0f, 2.0f, 3.0f, 4.0f, 5.0f, 3.0f, 4.0f, 5.0f, 6.0f, 4.0f, 5.0f, 6.0f, 7.0f, 7.0f, 6.0f, 5.0f, 4.0f, 6.0f, 5.0f, 4.0f, 3.0f, 5.0f, 4.0f, 3.0f, 2.0f, 4.0f, 3.0f, 2.0f, 1.0f }; std::vector outputData = armnn::IsQuantizedType() ? std::initializer_list { 1, 3, 3, 5 } : std::initializer_list { 1.0f, 3.0f, 3.0f, 5.0f, 7.0f, 5.0f, 5.0f, 3.0f }; const armnn::PermutationVector NCHWToNHWC = { 0, 3, 1, 2 }; if (dataLayout == armnn::DataLayout::NHWC) { std::vector tmp(inputData.size()); armnnUtils::Permute(inputTensorInfo.GetShape(), NCHWToNHWC, inputData.data(), tmp.data(), sizeof(float)); inputData = tmp; std::vector tmp1(outputData.size()); armnnUtils::Permute(outputTensorInfo.GetShape(), NCHWToNHWC, outputData.data(), tmp1.data(), sizeof(float)); outputData = tmp1; } auto input = MakeTensor(inputTensorInfo, QuantizedVector(inputTensorInfo.GetQuantizationScale(), inputTensorInfo.GetQuantizationOffset(), inputData)); LayerTestResult result(outputTensorInfo); result.outputExpected = MakeTensor(outputTensorInfo, QuantizedVector(outputTensorInfo.GetQuantizationScale(), outputTensorInfo.GetQuantizationOffset(), outputData)); std::unique_ptr inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo); std::unique_ptr outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo); armnn::ResizeQueueDescriptor descriptor; descriptor.m_Parameters.m_DataLayout = dataLayout; descriptor.m_Parameters.m_Method = armnn::ResizeMethod::NearestNeighbor; armnn::WorkloadInfo info; AddInputToWorkload(descriptor, info, inputTensorInfo, inputHandle.get()); AddOutputToWorkload(descriptor, info, outputTensorInfo, outputHandle.get()); std::unique_ptr workload = workloadFactory.CreateResize(descriptor, info); inputHandle->Allocate(); outputHandle->Allocate(); CopyDataToITensorHandle(inputHandle.get(), &input[0][0][0][0]); workload->PostAllocationConfigure(); workload->Execute(); CopyDataFromITensorHandle(&result.output[0][0][0][0], outputHandle.get()); return result; } template LayerTestResult ResizeNearestNeighborMinTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, const armnn::DataLayout dataLayout) { armnn::TensorInfo inputTensorInfo = armnn::IsQuantizedType() ? armnnUtils::GetTensorInfo(1, 1, 2, 3, dataLayout, ArmnnType) : armnnUtils::GetTensorInfo(1, 2, 3, 5, dataLayout, ArmnnType); armnn::TensorInfo outputTensorInfo = armnn::IsQuantizedType() ? armnnUtils::GetTensorInfo(1, 1, 1, 2, dataLayout, ArmnnType) : armnnUtils::GetTensorInfo(1, 2, 2, 3, dataLayout, ArmnnType); if (armnn::IsQuantizedType()) { inputTensorInfo.SetQuantizationScale(1.5f); inputTensorInfo.SetQuantizationOffset(-1); outputTensorInfo.SetQuantizationScale(1.5f); outputTensorInfo.SetQuantizationOffset(-1); } std::vector inputData = armnn::IsQuantizedType() ? std::initializer_list { 3.0f, 4.5f, 6.0f, // 1, 2, 3, : Expected quantised values 9.0f, 13.5f, 21.0f // 5, 8, 13 } : std::initializer_list { 1.0f, 2.0f, 3.0f, 5.0f, 8.0f, 13.0f, 21.0f, 34.0f, 55.0f, 89.0f, 144.0f, 233.0f, 377.0f, 610.0f, 987.0f, 987.0f, 610.0f, 377.0f, 233.0f, 144.0f, 89.0f, 55.0f, 34.0f, 21.0f, 13.0f, 8.0f, 5.0f, 3.0f, 2.0f, 1.0f }; std::vector outputData = armnn::IsQuantizedType() ? std::initializer_list { 3.0f, 4.5f // 1, 3 } : std::initializer_list { 1.f, 2.f, 5.f, 13.f, 21.f, 55.f, 987.f, 610.f, 233.f, 89.f, 55.f, 21.f }; const armnn::PermutationVector NCHWToNHWC = { 0, 3, 1, 2 }; if (dataLayout == armnn::DataLayout::NHWC) { std::vector tmp(inputData.size()); armnnUtils::Permute(inputTensorInfo.GetShape(), NCHWToNHWC, inputData.data(), tmp.data(), sizeof(float)); inputData = tmp; std::vector tmp1(outputData.size()); armnnUtils::Permute(outputTensorInfo.GetShape(), NCHWToNHWC, outputData.data(), tmp1.data(), sizeof(float)); outputData = tmp1; } auto input = MakeTensor(inputTensorInfo, QuantizedVector(inputTensorInfo.GetQuantizationScale(), inputTensorInfo.GetQuantizationOffset(), inputData)); LayerTestResult result(outputTensorInfo); result.outputExpected = MakeTensor(outputTensorInfo, QuantizedVector(outputTensorInfo.GetQuantizationScale(), outputTensorInfo.GetQuantizationOffset(), outputData)); std::unique_ptr inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo); std::unique_ptr outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo); armnn::ResizeQueueDescriptor descriptor; descriptor.m_Parameters.m_DataLayout = dataLayout; descriptor.m_Parameters.m_Method = armnn::ResizeMethod::NearestNeighbor; armnn::WorkloadInfo info; AddInputToWorkload(descriptor, info, inputTensorInfo, inputHandle.get()); AddOutputToWorkload(descriptor, info, outputTensorInfo, outputHandle.get()); std::unique_ptr workload = workloadFactory.CreateResize(descriptor, info); inputHandle->Allocate(); outputHandle->Allocate(); CopyDataToITensorHandle(inputHandle.get(), &input[0][0][0][0]); workload->PostAllocationConfigure(); workload->Execute(); CopyDataFromITensorHandle(&result.output[0][0][0][0], outputHandle.get()); return result; } template LayerTestResult ResizeNearestNeighborMagTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, const armnn::DataLayout dataLayout, float inQuantScale, int32_t inQuantOffset, float outQuantScale, int32_t outQuantOffset) { armnn::TensorInfo inputTensorInfo = armnn::IsQuantizedType() ? armnnUtils::GetTensorInfo(1, 1, 3, 2, dataLayout, ArmnnType) : armnnUtils::GetTensorInfo(1, 2, 3, 2, dataLayout, ArmnnType); armnn::TensorInfo outputTensorInfo = armnn::IsQuantizedType() ? armnnUtils::GetTensorInfo(1, 1, 3, 5, dataLayout, ArmnnType) : armnnUtils::GetTensorInfo(1, 2, 3, 5, dataLayout, ArmnnType); if (armnn::IsQuantizedType()) { inputTensorInfo.SetQuantizationScale(inQuantScale); inputTensorInfo.SetQuantizationOffset(inQuantOffset); outputTensorInfo.SetQuantizationScale(outQuantScale); outputTensorInfo.SetQuantizationOffset(outQuantOffset); } std::vector inputData = armnn::IsQuantizedType() ? std::initializer_list { 0.183005f, 2.379065f, // 24, 228, : expected quantised values 1.054970f, 1.302565f, // 105, 128, 2.400595f, 0.688960f // 230, 71 } : std::initializer_list { 1.0f, 2.0f, 13.0f, 21.0f, 144.0f, 233.0f, 233.0f, 144.0f, 21.0f, 13.0f, 2.0f, 1.0f }; std::vector outputData = armnn::IsQuantizedType() ? std::initializer_list { 0.183005f, 0.183005f, 0.183005f, 2.379065f, 2.379065f, 1.054970f, 1.054970f, 1.054970f, 1.302565f, 1.302565f, 2.400595f, 2.400595f, 2.400595f, 0.688960f, 0.688960f } : std::initializer_list { 1.f, 1.f, 1.f, 2.f, 2.f, 13.f, 13.f, 13.f, 21.f, 21.f, 144.f, 144.f, 144.f, 233.f, 233.f, 233.f, 233.f, 233.f, 144.f, 144.f, 21.f, 21.f, 21.f, 13.f, 13.f, 2.f, 2.f, 2.f, 1.f, 1.f }; const armnn::PermutationVector NCHWToNHWC = { 0, 3, 1, 2 }; if (dataLayout == armnn::DataLayout::NHWC) { std::vector tmp(inputData.size()); armnnUtils::Permute(inputTensorInfo.GetShape(), NCHWToNHWC, inputData.data(), tmp.data(), sizeof(float)); inputData = tmp; std::vector tmp1(outputData.size()); armnnUtils::Permute(outputTensorInfo.GetShape(), NCHWToNHWC, outputData.data(), tmp1.data(), sizeof(float)); outputData = tmp1; } auto input = MakeTensor(inputTensorInfo, QuantizedVector(inputTensorInfo.GetQuantizationScale(), inputTensorInfo.GetQuantizationOffset(), inputData)); LayerTestResult result(outputTensorInfo); result.outputExpected = MakeTensor(outputTensorInfo, QuantizedVector(outputTensorInfo.GetQuantizationScale(), outputTensorInfo.GetQuantizationOffset(), outputData)); std::unique_ptr inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo); std::unique_ptr outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo); armnn::ResizeQueueDescriptor descriptor; descriptor.m_Parameters.m_DataLayout = dataLayout; descriptor.m_Parameters.m_Method = armnn::ResizeMethod::NearestNeighbor; armnn::WorkloadInfo info; AddInputToWorkload(descriptor, info, inputTensorInfo, inputHandle.get()); AddOutputToWorkload(descriptor, info, outputTensorInfo, outputHandle.get()); std::unique_ptr workload = workloadFactory.CreateResize(descriptor, info); inputHandle->Allocate(); outputHandle->Allocate(); CopyDataToITensorHandle(inputHandle.get(), &input[0][0][0][0]); workload->PostAllocationConfigure(); workload->Execute(); CopyDataFromITensorHandle(&result.output[0][0][0][0], outputHandle.get()); return result; } template LayerTestResult MeanTestHelper( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, const unsigned int* inputShape, const std::vector& inputData, const std::vector& axis, bool keepDims, const unsigned int* outputShape, const std::vector& outputData, float scale = 1.0f, int32_t offset = 0) { armnn::TensorInfo inputTensorInfo(InputDim, inputShape, ArmnnType); armnn::TensorInfo outputTensorInfo(OutputDim, outputShape, ArmnnType); inputTensorInfo.SetQuantizationScale(scale); inputTensorInfo.SetQuantizationOffset(offset); outputTensorInfo.SetQuantizationScale(scale); outputTensorInfo.SetQuantizationOffset(offset); auto input = MakeTensor(inputTensorInfo, ConvertToDataType(inputData, inputTensorInfo)); LayerTestResult result(outputTensorInfo); result.outputExpected = MakeTensor( outputTensorInfo, ConvertToDataType(outputData, outputTensorInfo)); std::unique_ptr inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo); std::unique_ptr outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo); armnn::MeanQueueDescriptor data; data.m_Parameters.m_Axis = axis; data.m_Parameters.m_KeepDims = keepDims; armnn::WorkloadInfo info; AddInputToWorkload(data, info, inputTensorInfo, inputHandle.get()); AddOutputToWorkload(data, info, outputTensorInfo, outputHandle.get()); std::unique_ptr workload = workloadFactory.CreateMean(data, info); inputHandle->Allocate(); outputHandle->Allocate(); CopyDataToITensorHandle(inputHandle.get(), input.origin()); workload->PostAllocationConfigure(); workload->Execute(); CopyDataFromITensorHandle(result.output.origin(), outputHandle.get()); return result; } template LayerTestResult MeanSimpleTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) { const unsigned int inputShape[] = { 3, 2 }; const unsigned int outputShape[] = { 1 }; std::vector input({ 1.5f, 1.5f, 2.5f, 2.5f, 3.5f, 3.5f }); std::vector output({ 2.5f }); return MeanTestHelper( workloadFactory, memoryManager, inputShape, input, {}, false, outputShape, output); } template LayerTestResult MeanSimpleAxisTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) { const unsigned int inputShape[] = { 2, 3, 1, 2 }; const unsigned int outputShape[] = { 3, 1, 2 }; std::vector input({ 1.5f, 2.5f, 3.5f, 4.5f, 5.5f, 6.5f, 1.5f, 2.5f, 3.5f, 4.5f, 5.5f, 6.5f }); std::vector output({ 1.5f, 2.5f, 3.5f, 4.5f, 5.5f, 6.5f }); return MeanTestHelper( workloadFactory, memoryManager, inputShape, input, { 0 }, false, outputShape, output); } template LayerTestResult MeanKeepDimsTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) { const unsigned int inputShape[] = { 1, 1, 3, 2 }; const unsigned int outputShape[] = { 1, 1, 1, 2 }; std::vector input({ 1.5f, 1.5f, 2.5f, 2.5f, 3.5f, 3.5f }); std::vector output({ 2.5f, 2.5f }); return MeanTestHelper( workloadFactory, memoryManager, inputShape, input, { 2 }, true, outputShape, output); } template LayerTestResult MeanMultipleDimsTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) { const unsigned int inputShape[] = { 2, 3, 1, 2 }; const unsigned int outputShape[] = { 1, 3, 1, 1 }; std::vector input({ 1.5f, 2.5f, 3.5f, 4.5f, 5.5f, 6.5f, 1.5f, 2.5f, 3.5f, 4.5f, 5.5f, 6.5 }); std::vector output({ 2.0f, 4.0f, 6.0f }); return MeanTestHelper( workloadFactory, memoryManager, inputShape, input, { 0, 3 }, true, outputShape, output); } template LayerTestResult MeanVts1Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) { const unsigned int inputShape[] = { 4, 3, 2 }; const unsigned int outputShape[] = { 2 }; std::vector 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, 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f, 19.0f, 20.0f, 21.0f, 22.0f, 23.0f, 24.0f }); std::vector output({ 12.0f, 13.0f }); return MeanTestHelper( workloadFactory, memoryManager, inputShape, input, { 0, 1 }, false, outputShape, output); } template LayerTestResult MeanVts2Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) { const unsigned int inputShape[] = { 4, 3, 2 }; const unsigned int outputShape[] = { 1, 3, 1 }; std::vector 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, 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f, 19.0f, 20.0f, 21.0f, 22.0f, 23.0f, 24.0f }); std::vector output({ 10.5f, 12.5f, 14.5f }); return MeanTestHelper( workloadFactory, memoryManager, inputShape, input, { 0, 2 }, true, outputShape, output); } template LayerTestResult MeanVts3Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) { const unsigned int inputShape[] = { 1, 2, 2, 1 }; const unsigned int outputShape[] = { 1, 2, 1 }; std::vector input({ 1.0f, 2.0f, 3.0f, 4.0f }); std::vector output({ 1.5f, 3.5f }); return MeanTestHelper( workloadFactory, memoryManager, inputShape, input, { 2 }, false, outputShape, output); } template> LayerTestResult ConcatDifferentInputOutputQParamTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, bool useSubtensor) { // Defines the tensor descriptors. armnn::TensorInfo outputTensorInfo({ 3, 6, 3 }, ArmnnType); armnn::TensorInfo inputTensorInfo1({ 3, 6, 2 }, ArmnnType); armnn::TensorInfo inputTensorInfo2({ 3, 6, 1 }, ArmnnType); std::vector inputTensorShapes({inputTensorInfo1.GetShape(), inputTensorInfo2.GetShape()}); // Quantized input1 tensor. const float inputScale1 = 0.5f; const int32_t inputOffset1 = 5; auto input1 = MakeTensor(inputTensorInfo1, std::vector( { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36 })); // Quatized input2 tensor. const float inputScale2 = 0.2f; const int32_t inputOffset2 = 10; auto input2 = MakeTensor(inputTensorInfo2, std::vector( { 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54 })); // Quantized output tensor. const float outputScale = 0.1f; const int32_t outputOffset = 20; LayerTestResult ret(outputTensorInfo); ret.outputExpected = MakeTensor(outputTensorInfo, std::vector( { 0, 5, 74, 10, 15, 76, 20, 25, 78, 30, 35, 80, 40, 45, 82, 50, 55, 84, 60, 65, 86, 70, 75, 88, 80, 85, 90, 90, 95, 92, 100, 105, 94, 110, 115, 96, 120, 125, 98, 130, 135, 100, 140, 145, 102, 150, 155, 104, 160, 165, 106, 170, 175, 108 })); outputTensorInfo.SetQuantizationScale(outputScale); outputTensorInfo.SetQuantizationOffset(outputOffset); inputTensorInfo1.SetQuantizationScale(inputScale1); inputTensorInfo1.SetQuantizationOffset(inputOffset1); inputTensorInfo2.SetQuantizationScale(inputScale2); inputTensorInfo2.SetQuantizationOffset(inputOffset2); std::vector wOrigin1 = { 0, 0, 0 }; //Extent of the window is defined by size of input[0]. armnn::ConcatQueueDescriptor::ViewOrigin window1(wOrigin1); std::vector wOrigin2 = { 0, 0, 2 }; //Extent of the window is defined by size of input[1]. armnn::ConcatQueueDescriptor::ViewOrigin window2(wOrigin2); std::unique_ptr outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo); bool subTensorsSupported = useSubtensor && workloadFactory.SupportsSubTensors(); std::unique_ptr inputHandle1 = subTensorsSupported ? workloadFactory.CreateSubTensorHandle(*outputHandle, inputTensorInfo1.GetShape(), wOrigin1.data()) : workloadFactory.CreateTensorHandle(inputTensorInfo1); std::unique_ptr inputHandle2 = subTensorsSupported ? workloadFactory.CreateSubTensorHandle(*outputHandle, inputTensorInfo2.GetShape(), wOrigin2.data()) : workloadFactory.CreateTensorHandle(inputTensorInfo2); armnn::ConcatQueueDescriptor data; armnn::OriginsDescriptor desc = armnn::CreateDescriptorForConcatenation( inputTensorShapes.begin(),inputTensorShapes.end(), 2); data.m_Parameters = desc; armnn::WorkloadInfo info; AddInputToWorkload(data, info, inputTensorInfo1, inputHandle1.get()); AddInputToWorkload(data, info, inputTensorInfo2, inputHandle2.get()); AddOutputToWorkload(data, info, outputTensorInfo, outputHandle.get()); data.m_ViewOrigins.push_back(window1); data.m_ViewOrigins.push_back(window2); std::unique_ptr workload = workloadFactory.CreateConcat(data, info); inputHandle1->Allocate(); inputHandle2->Allocate(); outputHandle->Allocate(); CopyDataToITensorHandle(inputHandle1.get(), &input1[0][0][0]); CopyDataToITensorHandle(inputHandle2.get(), &input2[0][0][0]); workload->PostAllocationConfigure(); workload->Execute(); CopyDataFromITensorHandle(&ret.output[0][0][0], outputHandle.get()); return ret; } template> LayerTestResult PreluTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) { armnn::TensorInfo inputTensorInfo ({ 1, 2, 2, 3 }, ArmnnType); armnn::TensorInfo alphaTensorInfo ({ 1, 1, 1, 3 }, ArmnnType); armnn::TensorInfo outputTensorInfo({ 1, 2, 2, 3 }, ArmnnType); if (armnn::IsQuantizedType()) { inputTensorInfo.SetQuantizationScale(0.25f); inputTensorInfo.SetQuantizationOffset(128); alphaTensorInfo.SetQuantizationScale(0.25f); alphaTensorInfo.SetQuantizationOffset(50); outputTensorInfo.SetQuantizationScale(0.5f); outputTensorInfo.SetQuantizationOffset(120); } std::vector inputData { // Expected quantized values: // 128, 128, 128, 132, 132, 132, 124, 124, 124, 120, 120, 120 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, -1.0f, -1.0f, -1.0f, -2.0f, -2.0f, -2.0f }; std::vector alphaData { // Expected quantized values: // 50, 54, 58 0.0f, 1.0f, 2.0f }; std::vector outputExpectedData = { // Expected quantized values: // 20, 120, 120, 122, 122, 122, 120, 118, 116, 120, 116, 112 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, -1.0f, -2.0f, 0.0f, -2.0f, -4.0f }; auto input = MakeTensor(inputTensorInfo, QuantizedVector(inputTensorInfo.GetQuantizationScale(), inputTensorInfo.GetQuantizationOffset(), inputData)); auto alpha = MakeTensor(alphaTensorInfo, QuantizedVector(alphaTensorInfo.GetQuantizationScale(), alphaTensorInfo.GetQuantizationOffset(), alphaData)); LayerTestResult result(outputTensorInfo); result.outputExpected = MakeTensor(outputTensorInfo, QuantizedVector(outputTensorInfo.GetQuantizationScale(), outputTensorInfo.GetQuantizationOffset(), outputExpectedData)); std::unique_ptr inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo); std::unique_ptr alphaHandle = workloadFactory.CreateTensorHandle(alphaTensorInfo); std::unique_ptr outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo); armnn::PreluQueueDescriptor descriptor; armnn::WorkloadInfo info; AddInputToWorkload (descriptor, info, inputTensorInfo, inputHandle.get()); AddInputToWorkload (descriptor, info, alphaTensorInfo, alphaHandle.get()); AddOutputToWorkload(descriptor, info, outputTensorInfo, outputHandle.get()); std::unique_ptr workload = workloadFactory.CreatePrelu(descriptor, info); inputHandle->Allocate(); alphaHandle->Allocate(); outputHandle->Allocate(); CopyDataToITensorHandle(inputHandle.get(), &input[0][0][0][0]); CopyDataToITensorHandle(alphaHandle.get(), &alpha[0][0][0][0]); workload->Execute(); CopyDataFromITensorHandle(&result.output[0][0][0][0], outputHandle.get()); return result; } template> LayerTestResult BatchToSpaceNdHelper( armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, const armnn::DataLayout& dataLayout, const unsigned int *inputShape, const std::vector &inputData, const std::vector &blockShape, const std::vector> &crops, const unsigned int *outputShape, const std::vector &outputData, float scale = 1.0f, int32_t offset = 0) { armnn::TensorInfo inputTensorInfo(InputDim, inputShape, ArmnnType); armnn::TensorInfo outputTensorInfo(OutputDim, outputShape, ArmnnType); inputTensorInfo.SetQuantizationScale(scale); inputTensorInfo.SetQuantizationOffset(offset); outputTensorInfo.SetQuantizationScale(scale); outputTensorInfo.SetQuantizationOffset(offset); auto input = MakeTensor(inputTensorInfo, ConvertToDataType(inputData, inputTensorInfo)); LayerTestResult result(outputTensorInfo); result.outputExpected = MakeTensor(outputTensorInfo, ConvertToDataType(outputData, outputTensorInfo)); std::unique_ptr inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo); std::unique_ptr outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo); armnn::BatchToSpaceNdQueueDescriptor data; data.m_Parameters.m_DataLayout = dataLayout; data.m_Parameters.m_BlockShape = blockShape; data.m_Parameters.m_Crops = crops; armnn::WorkloadInfo info; AddInputToWorkload(data, info, inputTensorInfo, inputHandle.get()); AddOutputToWorkload(data, info, outputTensorInfo, outputHandle.get()); std::unique_ptr workload = workloadFactory.CreateBatchToSpaceNd(data, info); inputHandle->Allocate(); outputHandle->Allocate(); CopyDataToITensorHandle(inputHandle.get(), input.origin()); workload->PostAllocationConfigure(); workload->Execute(); CopyDataFromITensorHandle(&result.output[0][0][0][0], outputHandle.get()); return result; } template> LayerTestResult BatchToSpaceNdNhwcTest1( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) { const unsigned int inputShape[] = {4, 2, 2, 1}; const unsigned int outputShape[] = {1, 4, 4, 1}; std::vector input({ // Batch 0, Height 0, Width (2) x Channel (1) 1.0f, 3.0f, // Batch 0, Height 1, Width (2) x Channel (1) 9.0f, 11.0f, // Batch 1, Height 0, Width (2) x Channel (1) 2.0f, 4.0f, // Batch 1, Height 1, Width (2) x Channel (1) 10.0f, 12.0f, // Batch 2, Height 0, Width (2) x Channel (1) 5.0f, 7.0f, // Batch 2, Height 1, Width (2) x Channel (1) 13.0f, 15.0f, // Batch 3, Height 0, Width (2) x Channel (3) 6.0f, 8.0f, // Batch 3, Height 1, Width (2) x Channel (1) 14.0f, 16.0f }); std::vector 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, 13.0f, 14.0f, 15.0f, 16.0f }); std::vector blockShape {2, 2}; std::vector> crops = {{0, 0}, {0, 0}}; return BatchToSpaceNdHelper(workloadFactory, memoryManager, armnn::DataLayout::NHWC, inputShape, input, blockShape, crops, outputShape, expectedOutput); } template> LayerTestResult BatchToSpaceNdNhwcTest2( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) { const unsigned int inputShape[] = {4, 1, 1, 1}; const unsigned int outputShape[] = {1, 2, 2, 1}; std::vector input({ // Batch 0, Height 0, Width (2) x Channel (1) 1.0f, 2.0f, 3.0f, 4.0f }); std::vector expectedOutput({1.0f, 2.0f, 3.0f, 4.0f}); std::vector blockShape({2, 2}); std::vector> crops = {{0, 0}, {0, 0}}; return BatchToSpaceNdHelper(workloadFactory, memoryManager, armnn::DataLayout::NHWC, inputShape, input, blockShape, crops, outputShape, expectedOutput); } template> LayerTestResult BatchToSpaceNdNhwcTest3( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) { const unsigned int inputShape[] = {4, 1, 1, 3}; const unsigned int outputShape[] = {1, 2, 2, 3}; std::vector 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}); std::vector 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}); std::vector blockShape({2, 2}); std::vector> crops = {{0, 0}, {0, 0}}; return BatchToSpaceNdHelper(workloadFactory, memoryManager, armnn::DataLayout::NHWC, inputShape, input, blockShape, crops, outputShape, expectedOutput); } template> LayerTestResult BatchToSpaceNdNhwcTest4( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) { const unsigned int inputShape[] = {8, 1, 3, 1}; const unsigned int outputShape[] = {2, 2, 4, 1}; std::vector input({ 0.0f, 1.0f, 3.0f, 0.0f, 9.0f, 11.0f, 0.0f, 2.0f, 4.0f, 0.0f, 10.0f, 12.0f, 0.0f, 5.0f, 7.0f, 0.0f, 13.0f, 15.0f, 0.0f, 6.0f, 8.0f, 0.0f, 14.0f, 16.0f }); std::vector 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, 13.0f, 14.0f, 15.0f, 16.0f }); std::vector blockShape({2, 2}); std::vector> crops = {{0, 0}, {2, 0}}; return BatchToSpaceNdHelper(workloadFactory, memoryManager, armnn::DataLayout::NHWC, inputShape, input, blockShape, crops, outputShape, expectedOutput); } template> LayerTestResult BatchToSpaceNdNhwcTest5( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) { const unsigned int inputShape[] = {4, 2, 2, 1}; const unsigned int outputShape[] = {1, 4, 4, 1}; std::vector input({1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}); std::vector expectedOutput({1, 5, 2, 6, 9, 13, 10, 14, 3, 7, 4, 8, 11, 15, 12, 16}); std::vector blockShape({2, 2}); std::vector> crops = {{0, 0}, {0, 0}}; return BatchToSpaceNdHelper(workloadFactory, memoryManager, armnn::DataLayout::NHWC, inputShape, input, blockShape, crops, outputShape, expectedOutput); } template> LayerTestResult BatchToSpaceNdNhwcTest6( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) { const unsigned int inputShape[] = {4, 1, 1, 1}; const unsigned int outputShape[] = {1, 2, 2, 1}; std::vector input({ // Batch 0, Height 0, Width (2) x Channel (1) 1, 2, 3, 4 }); std::vector expectedOutput({1, 2, 3, 4}); std::vector blockShape({2, 2}); std::vector> crops = {{0, 0}, {0, 0}}; return BatchToSpaceNdHelper(workloadFactory, memoryManager, armnn::DataLayout::NHWC, inputShape, input, blockShape, crops, outputShape, expectedOutput); } template> LayerTestResult BatchToSpaceNdNhwcTest7( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) { const unsigned int inputShape[] = {4, 1, 1, 3}; const unsigned int outputShape[] = {1, 2, 2, 3}; std::vector input({1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}); std::vector expectedOutput({1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}); std::vector blockShape({2, 2}); std::vector> crops = {{0, 0}, {0, 0}}; return BatchToSpaceNdHelper(workloadFactory, memoryManager, armnn::DataLayout::NHWC, inputShape, input, blockShape, crops, outputShape, expectedOutput); } template> LayerTestResult BatchToSpaceNdNchwTest1( armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) { const unsigned int inputShape[] = {4, 3, 1, 1}; const unsigned int outputShape[] = {1, 3, 2, 2}; std::vector 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}); std::vector expectedOutput({ // Batch 0, Channel 0, Height (2) x Width (2) 1.0f, 4.0f, 7.0f, 10.0f, // Batch 0, Channel 1, Height (2) x Width (2) 2.0f, 5.0f, 8.0f, 11.0f, // Batch 0, Channel 2, Height (2) x Width (2) 3.0f, 6.0f, 9.0f, 12.0f, }); std::vector blockShape({2, 2}); std::vector> crops = {{0, 0}, {0, 0}}; return BatchToSpaceNdHelper(workloadFactory, memoryManager, armnn::DataLayout::NCHW, inputShape, input, blockShape, crops, outputShape, expectedOutput); } template> LayerTestResult BatchToSpaceNdNchwTest2( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) { const unsigned int inputShape[] = {4, 1, 1, 1}; const unsigned int outputShape[] = {1, 1, 2, 2}; std::vector input({ // Batch 0, Height 0, Width (2) x Channel (1) 1.0f, 2.0f, 3.0f, 4.0f }); std::vector expectedOutput({1.0f, 2.0f, 3.0f, 4.0f}); std::vector blockShape({2, 2}); std::vector> crops = {{0, 0}, {0, 0}}; return BatchToSpaceNdHelper(workloadFactory, memoryManager, armnn::DataLayout::NCHW, inputShape, input, blockShape, crops, outputShape, expectedOutput); } template> LayerTestResult BatchToSpaceNdNchwTest3( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) { const unsigned int inputShape[] = {4, 3, 1, 1}; const unsigned int outputShape[] = {1, 3, 2, 2}; std::vector 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}); std::vector expectedOutput({ // Batch 0, Channel 0, Height (2) x Width (2) 1.0f, 7.0f, 2.0f, 8.0f, // Batch 0, Channel 1, Height (2) x Width (2) 3.0f, 9.0f, 4.0f, 10.0f, // Batch 0, Channel 2, Height (2) x Width (2) 5.0f, 11.0f, 6.0f, 12.0f, }); std::vector blockShape({2, 2}); std::vector> crops = {{0, 0}, {0, 0}}; return BatchToSpaceNdHelper(workloadFactory, memoryManager, armnn::DataLayout::NCHW, inputShape, input, blockShape, crops, outputShape, expectedOutput); } template> LayerTestResult BatchToSpaceNdNchwTest4( armnn::IWorkloadFactory &workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) { const unsigned int inputShape[] = {4, 3, 1, 1}; const unsigned int outputShape[] = {1, 3, 2, 2}; std::vector input({1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}); std::vector expectedOutput({ // Batch 0, Channel 0, Height (2) x Width (2) 1, 4, 7, 10, // Batch 0, Channel 1, Height (2) x Width (2) 2, 5, 8, 11, // Batch 0, Channel 2, Height (2) x Width (2) 3, 6, 9, 12, }); std::vector blockShape({2, 2}); std::vector> crops = {{0, 0}, {0, 0}}; return BatchToSpaceNdHelper(workloadFactory, memoryManager, armnn::DataLayout::NCHW, inputShape, input, blockShape, crops, outputShape, expectedOutput); } template> LayerTestResult BatchToSpaceNdNchwTest5( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) { const unsigned int inputShape[] = {4, 1, 1, 1}; const unsigned int outputShape[] = {1, 1, 2, 2}; std::vector input({ // Batch 0, Height 0, Width (2) x Channel (1) 1, 2, 3, 4 }); std::vector expectedOutput({1, 2, 3, 4}); std::vector blockShape({2, 2}); std::vector> crops = {{0, 0}, {0, 0}}; return BatchToSpaceNdHelper(workloadFactory, memoryManager, armnn::DataLayout::NCHW, inputShape, input, blockShape, crops, outputShape, expectedOutput); } template> LayerTestResult BatchToSpaceNdNchwTest6( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) { const unsigned int inputShape[] = {4, 3, 1, 1}; const unsigned int outputShape[] = {1, 3, 2, 2}; std::vector input({1, 3, 5, 7, 9, 11, 2, 4, 6, 8, 10, 12}); std::vector expectedOutput({ // Batch 0, Channel 0, Height (2) x Width (2) 1, 7, 2, 8, // Batch 0, Channel 1, Height (2) x Width (2) 3, 9, 4, 10, // Batch 0, Channel 2, Height (2) x Width (2) 5, 11, 6, 12, }); std::vector blockShape({2, 2}); std::vector> crops = {{0, 0}, {0, 0}}; return BatchToSpaceNdHelper(workloadFactory, memoryManager, armnn::DataLayout::NCHW, inputShape, input, blockShape, crops, outputShape, expectedOutput); } template> LayerTestResult BatchToSpaceNdNchwTest7( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) { const unsigned int inputShape[] = {8, 1, 1, 3}; const unsigned int outputShape[] = {2, 1, 2, 4}; std::vector input({ 0, 1, 3, 0, 9, 11, 0, 2, 4, 0, 10, 12, 0, 5, 7, 0, 13, 15, 0, 6, 8, 0, 14, 16 }); std::vector expectedOutput({ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }); std::vector blockShape({2, 2}); std::vector> crops = {{0, 0}, {2, 0}}; return BatchToSpaceNdHelper(workloadFactory, memoryManager, armnn::DataLayout::NCHW, inputShape, input, blockShape, crops, outputShape, expectedOutput); } template LayerTestResult, 4> PreluTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); template LayerTestResult, 4> PreluTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); template LayerTestResult, 4> PreluTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); template LayerTestResult StackTestHelper( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, const armnn::TensorInfo& inputTensorInfo, const armnn::TensorInfo& outputTensorInfo, unsigned int axis, const std::vector>& inputData, const std::vector& outputExpectedData) { unsigned int numInputs = static_cast(inputData.size()); std::vector> inputs; for (unsigned int i = 0; i < numInputs; ++i) { inputs.push_back(MakeTensor(inputTensorInfo, inputData[i])); } LayerTestResult result(outputTensorInfo); result.outputExpected = MakeTensor(outputTensorInfo, outputExpectedData); std::vector> inputHandles; for (unsigned int i = 0; i < numInputs; ++i) { inputHandles.push_back(workloadFactory.CreateTensorHandle(inputTensorInfo)); } std::unique_ptr outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo); armnn::StackQueueDescriptor descriptor; descriptor.m_Parameters.m_Axis = axis; descriptor.m_Parameters.m_InputShape = inputTensorInfo.GetShape(); descriptor.m_Parameters.m_NumInputs = numInputs; armnn::WorkloadInfo info; for (unsigned int i = 0; i < numInputs; ++i) { std::unique_ptr& inputHandle = inputHandles[i]; AddInputToWorkload(descriptor, info, inputTensorInfo, inputHandle.get()); inputHandle->Allocate(); CopyDataToITensorHandle(inputHandle.get(), inputs[i].origin()); } AddOutputToWorkload(descriptor, info, outputTensorInfo, outputHandle.get()); outputHandle->Allocate(); std::unique_ptr workload = workloadFactory.CreateStack(descriptor, info); workload->Execute(); CopyDataFromITensorHandle(result.output.origin(), outputHandle.get()); return result; } template> LayerTestResult Stack0AxisTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) { armnn::TensorInfo inputTensorInfo ({ 3, 2, 3 }, ArmnnType); armnn::TensorInfo outputTensorInfo({ 2, 3, 2, 3 }, ArmnnType); std::vector> inputData; inputData.push_back( { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 }); inputData.push_back( { 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36 }); std::vector outputExpectedData = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36 }; return StackTestHelper( workloadFactory, memoryManager, inputTensorInfo, outputTensorInfo, 0U, inputData, outputExpectedData ); } template> LayerTestResult Stack4dOutput1AxisTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) { armnn::TensorInfo inputTensorInfo ({ 3, 2, 3 }, ArmnnType); armnn::TensorInfo outputTensorInfo({ 3, 2, 2, 3 }, ArmnnType); std::vector> inputData; inputData.push_back( { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 }); inputData.push_back( { 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36 }); std::vector outputExpectedData = { 1, 2, 3, 4, 5, 6, 19, 20, 21, 22, 23, 24, 7, 8, 9, 10, 11, 12, 25, 26, 27, 28, 29, 30, 13, 14, 15, 16, 17, 18, 31, 32, 33, 34, 35, 36 }; return StackTestHelper( workloadFactory, memoryManager, inputTensorInfo, outputTensorInfo, 1U, inputData, outputExpectedData ); } template> LayerTestResult Stack4dOutput2AxisTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) { armnn::TensorInfo inputTensorInfo ({ 3, 2, 3 }, ArmnnType); armnn::TensorInfo outputTensorInfo({ 3, 2, 2, 3 }, ArmnnType); std::vector> inputData; inputData.push_back( { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 }); inputData.push_back( { 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36 }); std::vector outputExpectedData = { 1, 2, 3, 19, 20, 21, 4, 5, 6, 22, 23, 24, 7, 8, 9, 25, 26, 27, 10, 11, 12, 28, 29, 30, 13, 14, 15, 31, 32, 33, 16, 17, 18, 34, 35, 36 }; return StackTestHelper( workloadFactory, memoryManager, inputTensorInfo, outputTensorInfo, 2U, inputData, outputExpectedData ); } template> LayerTestResult Stack4dOutput3AxisTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) { armnn::TensorInfo inputTensorInfo ({ 3, 2, 3 }, ArmnnType); armnn::TensorInfo outputTensorInfo({ 3, 2, 3, 2 }, ArmnnType); std::vector> inputData; inputData.push_back( { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 }); inputData.push_back( { 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36 }); std::vector outputExpectedData = { 1, 19, 2, 20, 3, 21, 4, 22, 5, 23, 6, 24, 7, 25, 8, 26, 9, 27, 10, 28, 11, 29, 12, 30, 13, 31, 14, 32, 15, 33, 16, 34, 17, 35, 18, 36 }; return StackTestHelper( workloadFactory, memoryManager, inputTensorInfo, outputTensorInfo, 3U, inputData, outputExpectedData ); } template> LayerTestResult Stack3dOutput1Axis3InputTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) { armnn::TensorInfo inputTensorInfo ({ 3, 3 }, ArmnnType); armnn::TensorInfo outputTensorInfo({ 3, 3, 3 }, ArmnnType); std::vector> inputData; inputData.push_back( { 1, 2, 3, 4, 5, 6, 7, 8, 9 }); inputData.push_back( { 10, 11, 12, 13, 14, 15, 16, 17, 18 }); inputData.push_back( { 19, 20, 21, 22, 23, 24, 25, 26, 27 }); std::vector outputExpectedData = { 1, 2, 3, 10, 11, 12, 19, 20, 21, 4, 5, 6, 13, 14, 15, 22, 23, 24, 7, 8, 9, 16, 17, 18, 25, 26, 27 }; return StackTestHelper( workloadFactory, memoryManager, inputTensorInfo, outputTensorInfo, 1U, inputData, outputExpectedData ); }