From: Teresa Charlin Date: Fri, 22 May 2020 17:08:23 +0000 (+0100) Subject: IVGCVSW-4863 ADD,SUB,DIV,MUL,MAXIMUM and MINIMUM int32 VTS test X-Git-Tag: submit/tizen/20210421.062230~514 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ecb6b8e2ef33daf7b5cd6b61cdea5c6339cf9c51;p=platform%2Fupstream%2Farmnn.git IVGCVSW-4863 ADD,SUB,DIV,MUL,MAXIMUM and MINIMUM int32 VTS test skipped in CpuRef Signed-off-by: Teresa Charlin Change-Id: I1c870ac258e8c3805a95b259cb40731f8e81541e --- diff --git a/src/backends/backendsCommon/WorkloadData.cpp b/src/backends/backendsCommon/WorkloadData.cpp index 8f751c4..d3e58b6 100644 --- a/src/backends/backendsCommon/WorkloadData.cpp +++ b/src/backends/backendsCommon/WorkloadData.cpp @@ -1074,7 +1074,8 @@ void AdditionQueueDescriptor::Validate(const WorkloadInfo& workloadInfo) const DataType::Float16, DataType::QAsymmS8, DataType::QAsymmU8, - DataType::QSymmS16 + DataType::QSymmS16, + DataType::Signed32 }; ValidateDataTypes(inputTensorInfo0, supportedTypes, descriptorName); @@ -1110,7 +1111,8 @@ void MultiplicationQueueDescriptor::Validate(const WorkloadInfo& workloadInfo) c DataType::Float32, DataType::QAsymmS8, DataType::QAsymmU8, - DataType::QSymmS16 + DataType::QSymmS16, + DataType::Signed32 }; ValidateDataTypes(inputTensorInfo0, supportedTypes, descriptorName); @@ -2161,7 +2163,8 @@ void DivisionQueueDescriptor::Validate(const WorkloadInfo& workloadInfo) const DataType::Float32, DataType::QAsymmS8, DataType::QAsymmU8, - DataType::QSymmS16 + DataType::QSymmS16, + DataType::Signed32 }; ValidateDataTypes(inputTensorInfo0, supportedTypes, descriptorName); @@ -2194,7 +2197,8 @@ void SubtractionQueueDescriptor::Validate(const WorkloadInfo& workloadInfo) cons DataType::Float32, DataType::QAsymmS8, DataType::QAsymmU8, - DataType::QSymmS16 + DataType::QSymmS16, + DataType::Signed32, }; ValidateDataTypes(inputTensorInfo0, supportedTypes, descriptorName); diff --git a/src/backends/backendsCommon/test/layerTests/AdditionTestImpl.cpp b/src/backends/backendsCommon/test/layerTests/AdditionTestImpl.cpp index bfe0282..4ae0f5a 100644 --- a/src/backends/backendsCommon/test/layerTests/AdditionTestImpl.cpp +++ b/src/backends/backendsCommon/test/layerTests/AdditionTestImpl.cpp @@ -343,6 +343,14 @@ LayerTestResult AdditionBroadcastInt16Test( workloadFactory, memoryManager, 2.f, 0); } +LayerTestResult AdditionBroadcastInt32Test( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) +{ + return AdditionBroadcastTestImpl( + workloadFactory, memoryManager, 1.f, 0); +} + LayerTestResult AdditionBroadcast1ElementTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) @@ -367,6 +375,14 @@ LayerTestResult AdditionBroadcast1ElementInt16Test( workloadFactory, memoryManager, 0.1333333f, 0); } +LayerTestResult AdditionBroadcast1ElementInt32Test( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) +{ + return AdditionBroadcast1ElementTestImpl( + workloadFactory, memoryManager, 1.f, 0); +} + LayerTestResult AdditionUint8Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) @@ -451,6 +467,48 @@ LayerTestResult AdditionInt16Test( 0); } +LayerTestResult AdditionInt32Test( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) +{ + const unsigned int shape0[] = { 1, 2, 2, 3 }; + const unsigned int shape1[] = { 1, 2, 2, 3 }; + + std::vector input0 = + { + 63, 35, 77, 70, 56, 112, // 441, 245, 539, 490, 392, 184 + 203, 28, 252, 168, 245, 91 // 1421, 196, 1764, 1176, 1715, 637 + }; + + std::vector input1 = + { + 21, 7, 175, 231, 175, 210, // 126, 28, 1204, 1596, 1204, 1449 + 126, 161, 63, 21, 105, 126 // 861, 1106, 420, 126, 714, 861 + }; + + std::vector output = + { + 84, 42, 252, 301, 231, 322, // 588, 294, 1764, 2107(clamped), 1617, 2254(clamped) + 329, 189, 315, 189, 350, 217, // 2303(clamped), 1323, 2205(clamped), 1323, 2450(clamped), 1519 + }; + + return ElementwiseTestHelper<4, armnn::AdditionQueueDescriptor, armnn::DataType::Signed32>( + workloadFactory, + memoryManager, + shape0, + input0, + 1.0f, + 0, + shape1, + input1, + 1.0f, + 0, + shape0, + output, + 1.0f, + 0); +} + LayerTestResult AdditionAfterMaxPoolTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) @@ -627,4 +685,4 @@ LayerTestResult CompareAdditionTest( CopyDataFromITensorHandle(&ret.outputExpected[0][0][0][0], outputHandleRef.get()); return ret; -} +} \ No newline at end of file diff --git a/src/backends/backendsCommon/test/layerTests/AdditionTestImpl.hpp b/src/backends/backendsCommon/test/layerTests/AdditionTestImpl.hpp index eb65c54..8c5385f 100644 --- a/src/backends/backendsCommon/test/layerTests/AdditionTestImpl.hpp +++ b/src/backends/backendsCommon/test/layerTests/AdditionTestImpl.hpp @@ -50,6 +50,18 @@ LayerTestResult AdditionBroadcast1ElementInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); +LayerTestResult AdditionInt32Test( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + +LayerTestResult AdditionBroadcastInt32Test( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + +LayerTestResult AdditionBroadcast1ElementInt32Test( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + LayerTestResult AdditionAfterMaxPoolTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); diff --git a/src/backends/backendsCommon/test/layerTests/DivisionTestImpl.cpp b/src/backends/backendsCommon/test/layerTests/DivisionTestImpl.cpp index 2359f77..c52c5ce 100644 --- a/src/backends/backendsCommon/test/layerTests/DivisionTestImpl.cpp +++ b/src/backends/backendsCommon/test/layerTests/DivisionTestImpl.cpp @@ -453,3 +453,104 @@ LayerTestResult DivisionBroadcast1DVectorInt16Test( shape0, output); } + +LayerTestResult DivisionInt32Test( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) +{ + const unsigned int width = 2u; + const unsigned int height = 2u; + const unsigned int channelCount = 2u; + const unsigned int batchSize = 2u; + + unsigned int shape[] = { batchSize, channelCount, height, width }; + + std::vector input0 = + { + 8, 8, 8, 8, 6, 6, 6, 6, + 8, 8, 8, 8, 5, 5, 5, 5 + }; + + std::vector input1 = + { + 4, 4, 4, 4, 2, 2, 2, 2, + 2, 2, 2, 2, 1, 1, 1, 1 + }; + + std::vector output = + { + 2, 2, 2, 2, 3, 3, 3, 3, + 4, 4, 4, 4, 5, 5, 5, 5 + }; + + + return ElementwiseTestHelper<4, armnn::DivisionQueueDescriptor, armnn::DataType::Signed32>( + workloadFactory, + memoryManager, + shape, + input0, + shape, + input1, + shape, + output, + 1.f, + 0); +} + +LayerTestResult DivisionBroadcast1ElementInt32Test( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) +{ + unsigned int shape0[] = { 1, 2, 2, 2 }; + unsigned int shape1[] = { 1, 1, 1, 1 }; + + std::vector input0 = { 2, 4, 6, 8, 10, 12, 14, 16}; + + std::vector input1 = { 2 }; + + std::vector output = { 1, 2, 3, 4, 5, 6, 7, 8}; + + return ElementwiseTestHelper<4, armnn::DivisionQueueDescriptor, armnn::DataType::Signed32>( + workloadFactory, + memoryManager, + shape0, + input0, + shape1, + input1, + shape0, + output); +} + +LayerTestResult DivisionBroadcast1DVectorInt32Test( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) +{ + unsigned int shape0[] = { 1, 3, 3, 2 }; + unsigned int shape1[] = { 1, 1, 1, 2 }; + + std::vector input0 = + { + 1, 4, 3, 8, 5, 12, + 7, 16, 9, 20, 11, 24, + 13, 28, 15, 32, 17, 36 + }; + + std::vector input1 = { 1, 2 }; + + std::vector output = + { + 1, 2, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18 + }; + + return ElementwiseTestHelper<4, armnn::DivisionQueueDescriptor, armnn::DataType::Signed32>( + workloadFactory, + memoryManager, + shape0, + input0, + shape1, + input1, + shape0, + output); +} \ No newline at end of file diff --git a/src/backends/backendsCommon/test/layerTests/DivisionTestImpl.hpp b/src/backends/backendsCommon/test/layerTests/DivisionTestImpl.hpp index 5e8c502..4e6a910 100644 --- a/src/backends/backendsCommon/test/layerTests/DivisionTestImpl.hpp +++ b/src/backends/backendsCommon/test/layerTests/DivisionTestImpl.hpp @@ -63,3 +63,15 @@ LayerTestResult DivisionBroadcast1ElementInt16Test( LayerTestResult DivisionBroadcast1DVectorInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + +LayerTestResult DivisionInt32Test( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + +LayerTestResult DivisionBroadcast1ElementInt32Test( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + +LayerTestResult DivisionBroadcast1DVectorInt32Test( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); \ No newline at end of file diff --git a/src/backends/backendsCommon/test/layerTests/MaximumTestImpl.cpp b/src/backends/backendsCommon/test/layerTests/MaximumTestImpl.cpp index 0e66d9f..02fea52 100644 --- a/src/backends/backendsCommon/test/layerTests/MaximumTestImpl.cpp +++ b/src/backends/backendsCommon/test/layerTests/MaximumTestImpl.cpp @@ -401,3 +401,93 @@ LayerTestResult MaximumBroadcast1DVectorInt16Test( shape0, output); } + +LayerTestResult MaximumInt32Test( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) +{ + unsigned int shape[] = { 2, 2, 2, 2 }; + + std::vector input0({ 1, 1, 1, 1, 6, 6, 6, 6, + 3, 3, 3, 3, 4, 4, 4, 4 }); + + std::vector input1({ 2, 2, 2, 2, 3, 3, 3, 3, + 4, 4, 4, 4, 5, 5, 5, 5 }); + + std::vector output({ 2, 2, 2, 2, 6, 6, 6, 6, + 4, 4, 4, 4, 5, 5, 5, 5 }); + + return ElementwiseTestHelper<4, armnn::MaximumQueueDescriptor, armnn::DataType::Signed32>( + workloadFactory, + memoryManager, + shape, + input0, + shape, + input1, + shape, + output); +} + +LayerTestResult MaximumBroadcast1ElementInt32Test( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) +{ + const unsigned int shape0[] = { 1, 2, 2, 3 }; + const unsigned int shape1[] = { 1, 1, 1, 1 }; + + std::vector input0 = + { + 1, 2, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12 + }; + + std::vector input1 = { 2 }; + + std::vector output = + { + 2, 2, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12 + }; + + return ElementwiseTestHelper<4, armnn::MaximumQueueDescriptor, armnn::DataType::Signed32>( + workloadFactory, + memoryManager, + shape0, + input0, + shape1, + input1, + shape0, + output); +} + +LayerTestResult MaximumBroadcast1DVectorInt32Test( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) +{ + const unsigned int shape0[] = { 1, 2, 2, 3 }; + const unsigned int shape1[] = { 1, 1, 1, 3 }; + + std::vector input0 = + { + 1, 2, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12 + }; + + std::vector input1 = { 1, 10, 3 }; + + std::vector output = + { + 1, 10, 3, 4, 10, 6, + 7, 10, 9, 10, 11, 12 + }; + + return ElementwiseTestHelper<4, armnn::MaximumQueueDescriptor, armnn::DataType::Signed32>( + workloadFactory, + memoryManager, + shape0, + input0, + shape1, + input1, + shape0, + output); +} \ No newline at end of file diff --git a/src/backends/backendsCommon/test/layerTests/MaximumTestImpl.hpp b/src/backends/backendsCommon/test/layerTests/MaximumTestImpl.hpp index 005d586..082ce6e 100644 --- a/src/backends/backendsCommon/test/layerTests/MaximumTestImpl.hpp +++ b/src/backends/backendsCommon/test/layerTests/MaximumTestImpl.hpp @@ -16,32 +16,32 @@ LayerTestResult MaximumSimpleTest(armnn::IWorkloadFactory& workloadFac const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult MaximumBroadcast1ElementTest( - armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult MaximumBroadcast1DVectorTest( - armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult MaximumFloat16Test( - armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult MaximumBroadcast1ElementFloat16Test( - armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult MaximumBroadcast1DVectorFloat16Test( - armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult MaximumUint8Test( - armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult MaximumBroadcast1ElementUint8Test( - armnn::IWorkloadFactory& workloadFactory, - const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); LayerTestResult MaximumBroadcast1DVectorUint8Test( armnn::IWorkloadFactory& workloadFactory, @@ -58,3 +58,15 @@ LayerTestResult MaximumBroadcast1ElementInt16Test( LayerTestResult MaximumBroadcast1DVectorInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + +LayerTestResult MaximumInt32Test( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + +LayerTestResult MaximumBroadcast1ElementInt32Test( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + +LayerTestResult MaximumBroadcast1DVectorInt32Test( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); \ No newline at end of file diff --git a/src/backends/backendsCommon/test/layerTests/MinimumTestImpl.cpp b/src/backends/backendsCommon/test/layerTests/MinimumTestImpl.cpp index ae54746..371dc27 100644 --- a/src/backends/backendsCommon/test/layerTests/MinimumTestImpl.cpp +++ b/src/backends/backendsCommon/test/layerTests/MinimumTestImpl.cpp @@ -300,3 +300,102 @@ LayerTestResult MinimumBroadcast1DVectorInt16Test( shape0, output); } + +LayerTestResult MinimumInt32Test( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) +{ + unsigned int shape[] = { 2, 2, 2, 2 }; + + std::vector input0 = + { + 1, 1, 1, 1, 6, 6, 6, 6, + 3, 3, 3, 3, 4, 4, 4, 4 + }; + + std::vector input1 = + { + 2, 2, 2, 2, 3, 3, 3, 3, + 4, 4, 4, 4, 5, 5, 5, 5 + }; + + std::vector output + { + 1, 1, 1, 1, 3, 3, 3, 3, + 3, 3, 3, 3, 4, 4, 4, 4 + }; + + return ElementwiseTestHelper<4, armnn::MinimumQueueDescriptor, armnn::DataType::Signed32>( + workloadFactory, + memoryManager, + shape, + input0, + shape, + input1, + shape, + output); +} + +LayerTestResult MinimumBroadcast1ElementInt32Test( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) +{ + const unsigned int shape0[] = { 1, 2, 2, 3 }; + const unsigned int shape1[] = { 1, 1, 1, 1 }; + + std::vector input0 = + { + 1, 2, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12 + }; + + std::vector input1 = { 2 }; + + std::vector output = + { + 1, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2 + }; + + return ElementwiseTestHelper<4, armnn::MinimumQueueDescriptor, armnn::DataType::Signed32>( + workloadFactory, + memoryManager, + shape0, + input0, + shape1, + input1, + shape0, + output); +} + +LayerTestResult MinimumBroadcast1DVectorInt32Test( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) +{ + const unsigned int shape0[] = { 1, 2, 2, 3 }; + const unsigned int shape1[] = { 1, 1, 1, 3 }; + + std::vector input0 = + { + 1, 2, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12 + }; + + std::vector input1 = { 1, 10, 3 }; + + std::vector output = + { + 1, 2, 3, 1, 5, 3, + 1, 8, 3, 1, 10, 3 + }; + + return ElementwiseTestHelper<4, armnn::MinimumQueueDescriptor, armnn::DataType::Signed32>( + workloadFactory, + memoryManager, + shape0, + input0, + shape1, + input1, + shape0, + output); +} \ No newline at end of file diff --git a/src/backends/backendsCommon/test/layerTests/MinimumTestImpl.hpp b/src/backends/backendsCommon/test/layerTests/MinimumTestImpl.hpp index b1e38dc..f932e64 100644 --- a/src/backends/backendsCommon/test/layerTests/MinimumTestImpl.hpp +++ b/src/backends/backendsCommon/test/layerTests/MinimumTestImpl.hpp @@ -47,3 +47,15 @@ LayerTestResult MinimumBroadcast1ElementInt16Test( LayerTestResult MinimumBroadcast1DVectorInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + +LayerTestResult MinimumInt32Test( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + +LayerTestResult MinimumBroadcast1ElementInt32Test( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + +LayerTestResult MinimumBroadcast1DVectorInt32Test( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); \ No newline at end of file diff --git a/src/backends/backendsCommon/test/layerTests/MultiplicationTestImpl.cpp b/src/backends/backendsCommon/test/layerTests/MultiplicationTestImpl.cpp index 1a9cf5b..18f4831 100644 --- a/src/backends/backendsCommon/test/layerTests/MultiplicationTestImpl.cpp +++ b/src/backends/backendsCommon/test/layerTests/MultiplicationTestImpl.cpp @@ -396,6 +396,105 @@ LayerTestResult MultiplicationBroadcast1DVectorInt16Test( output); } +LayerTestResult MultiplicationInt32Test( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) +{ + const unsigned int shape[] = { 1, 2, 2, 3 }; + + std::vector input0 = + { + 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17 + }; + + std::vector input1 = + { + 1, 2, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12 + }; + + std::vector output = + { + 6, 14, 24, 36, 50, 66, + 84, 104, 126, 150, 176, 204 + }; + + return ElementwiseTestHelper<4, armnn::MultiplicationQueueDescriptor, armnn::DataType::Signed32>( + workloadFactory, + memoryManager, + shape, + input0, + shape, + input1, + shape, + output); +} + +LayerTestResult MultiplicationBroadcast1ElementInt32Test( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) +{ + const unsigned int shape0[] = { 1, 2, 2, 3 }; + const unsigned int shape1[] = { 1, 1, 1, 1 }; + + std::vector input0 = + { + 1, 2, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12 + }; + + std::vector input1 = { 2 }; + + std::vector output = + { + 2, 4, 6, 8, 10, 12, + 14, 16, 18, 20, 22, 24 + }; + + return ElementwiseTestHelper<4, armnn::MultiplicationQueueDescriptor, armnn::DataType::Signed32>( + workloadFactory, + memoryManager, + shape0, + input0, + shape1, + input1, + shape0, + output); +} + +LayerTestResult MultiplicationBroadcast1DVectorInt32Test( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) +{ + const unsigned int shape0[] = { 1, 2, 2, 3 }; + const unsigned int shape1[] = { 1, 1, 1, 3 }; + + std::vector input0 = + { + 1, 2, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12 + }; + + std::vector input1 = { 1, 2, 3 }; + + std::vector output = + { + 1, 4, 9, 4, 10, 18, + 7, 16, 27, 10, 22, 36 + }; + + return ElementwiseTestHelper<4, armnn::MultiplicationQueueDescriptor, armnn::DataType::Signed32>( + workloadFactory, + memoryManager, + shape0, + input0, + shape1, + input1, + shape0, + output); +} + LayerTestResult CompareMultiplicationTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, diff --git a/src/backends/backendsCommon/test/layerTests/MultiplicationTestImpl.hpp b/src/backends/backendsCommon/test/layerTests/MultiplicationTestImpl.hpp index 3e2f2ff..7ef9c42 100644 --- a/src/backends/backendsCommon/test/layerTests/MultiplicationTestImpl.hpp +++ b/src/backends/backendsCommon/test/layerTests/MultiplicationTestImpl.hpp @@ -50,6 +50,18 @@ LayerTestResult MultiplicationBroadcast1DVectorInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); +LayerTestResult MultiplicationInt32Test( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + +LayerTestResult MultiplicationBroadcast1ElementInt32Test( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + +LayerTestResult MultiplicationBroadcast1DVectorInt32Test( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + LayerTestResult CompareMultiplicationTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, diff --git a/src/backends/backendsCommon/test/layerTests/SubtractionTestImpl.cpp b/src/backends/backendsCommon/test/layerTests/SubtractionTestImpl.cpp index 525fb46..eb1ba6b 100644 --- a/src/backends/backendsCommon/test/layerTests/SubtractionTestImpl.cpp +++ b/src/backends/backendsCommon/test/layerTests/SubtractionTestImpl.cpp @@ -324,3 +324,84 @@ LayerTestResult SubtractionBroadcastInt16Test( shape0, output); } + +LayerTestResult SubtractionInt32Test( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) +{ + const unsigned int shape[] = { 1, 1, 2, 2 }; + + std::vector input0 = { 5, 6, 7, 8 }; + std::vector input1 = { 1, 2, 1, 2 }; + std::vector output = { 4, 4, 6, 6 }; + + return ElementwiseTestHelper<4, armnn::SubtractionQueueDescriptor, armnn::DataType::Signed32>( + workloadFactory, + memoryManager, + shape, + input0, + 1.0f, + 0, + shape, + input1, + 1.0f, + 0, + shape, + output, + 1.0f, + 0); +} + +LayerTestResult SubtractionBroadcast1ElementInt32Test( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) +{ + const unsigned int shape0[] = { 1, 1, 2, 2 }; + const unsigned int shape1[] = { 1, 1, 1, 1 }; + + std::vector input0 = { 5, 6, 7, 8 }; + + std::vector input1 = { 2 }; + + std::vector output = { 3, 4, 5, 6 }; + + return ElementwiseTestHelper<4, armnn::SubtractionQueueDescriptor, armnn::DataType::Signed32>( + workloadFactory, + memoryManager, + shape0, + input0, + 1.0f, + 0, + shape1, + input1, + 1.0f, + 0, + shape0, + output, + 1.0f, + 0); +} + +LayerTestResult SubtractionBroadcastInt32Test( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) +{ + const unsigned int shape0[] = { 1, 1, 2, 2 }; + const unsigned int shape1[] = { 1, 1, 2, 1 }; + + std::vector input0 = { 10, 12, 14, 16 }; + + std::vector input1 = { 2, 1 }; + + std::vector output = { 8, 11, 12, 15 }; + + return ElementwiseTestHelper<4, armnn::SubtractionQueueDescriptor, armnn::DataType::Signed32>( + workloadFactory, + memoryManager, + shape0, + input0, + shape1, + input1, + shape0, + output); +} \ No newline at end of file diff --git a/src/backends/backendsCommon/test/layerTests/SubtractionTestImpl.hpp b/src/backends/backendsCommon/test/layerTests/SubtractionTestImpl.hpp index 327aa90..f3de5df 100644 --- a/src/backends/backendsCommon/test/layerTests/SubtractionTestImpl.hpp +++ b/src/backends/backendsCommon/test/layerTests/SubtractionTestImpl.hpp @@ -59,3 +59,15 @@ LayerTestResult SubtractionBroadcast1ElementInt16Test( LayerTestResult SubtractionBroadcastInt16Test( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + +LayerTestResult SubtractionInt32Test( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + +LayerTestResult SubtractionBroadcast1ElementInt32Test( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); + +LayerTestResult SubtractionBroadcastInt32Test( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager); diff --git a/src/backends/reference/RefLayerSupport.cpp b/src/backends/reference/RefLayerSupport.cpp index 8ca18b5..da8672a 100644 --- a/src/backends/reference/RefLayerSupport.cpp +++ b/src/backends/reference/RefLayerSupport.cpp @@ -145,13 +145,14 @@ bool RefLayerSupport::IsAdditionSupported(const TensorInfo& input0, { bool supported = true; - std::array supportedTypes = { + std::array supportedTypes = { DataType::BFloat16, DataType::Float32, DataType::Float16, DataType::QAsymmS8, DataType::QAsymmU8, - DataType::QSymmS16 + DataType::QSymmS16, + DataType::Signed32 }; supported &= CheckSupportRule(TypeAnyOf(input0, supportedTypes), reasonIfUnsupported, @@ -759,13 +760,14 @@ bool RefLayerSupport::IsDivisionSupported(const TensorInfo& input0, { bool supported = true; - std::array supportedTypes = { + std::array supportedTypes = { DataType::BFloat16, DataType::Float32, DataType::Float16, DataType::QAsymmS8, DataType::QAsymmU8, - DataType::QSymmS16 + DataType::QSymmS16, + DataType::Signed32 }; supported &= CheckSupportRule(TypeAnyOf(input0, supportedTypes), reasonIfUnsupported, @@ -1239,13 +1241,14 @@ bool RefLayerSupport::IsMaximumSupported(const TensorInfo& input0, { bool supported = true; - std::array supportedTypes = { + std::array supportedTypes = { DataType::BFloat16, DataType::Float32, DataType::Float16, DataType::QAsymmS8, DataType::QAsymmU8, - DataType::QSymmS16 + DataType::QSymmS16, + DataType::Signed32 }; supported &= CheckSupportRule(TypeAnyOf(input0, supportedTypes), reasonIfUnsupported, @@ -1376,13 +1379,14 @@ bool RefLayerSupport::IsMinimumSupported(const TensorInfo& input0, { bool supported = true; - std::array supportedTypes = { + std::array supportedTypes = { DataType::BFloat16, DataType::Float32, DataType::Float16, DataType::QAsymmS8, DataType::QAsymmU8, - DataType::QSymmS16 + DataType::QSymmS16, + DataType::Signed32 }; supported &= CheckSupportRule(TypeAnyOf(input0, supportedTypes), reasonIfUnsupported, @@ -1413,13 +1417,14 @@ bool RefLayerSupport::IsMultiplicationSupported(const TensorInfo& input0, { bool supported = true; - std::array supportedTypes = { + std::array supportedTypes = { DataType::BFloat16, DataType::Float32, DataType::Float16, DataType::QAsymmS8, DataType::QAsymmU8, - DataType::QSymmS16 + DataType::QSymmS16, + DataType::Signed32 }; supported &= CheckSupportRule(TypeAnyOf(input0, supportedTypes), reasonIfUnsupported, @@ -1965,13 +1970,14 @@ bool RefLayerSupport::IsSubtractionSupported(const TensorInfo& input0, { bool supported = true; - std::array supportedTypes = { + std::array supportedTypes = { DataType::BFloat16, DataType::Float32, DataType::Float16, DataType::QAsymmS8, DataType::QAsymmU8, - DataType::QSymmS16 + DataType::QSymmS16, + DataType::Signed32 }; supported &= CheckSupportRule(TypeAnyOf(input0, supportedTypes), reasonIfUnsupported, diff --git a/src/backends/reference/test/RefLayerTests.cpp b/src/backends/reference/test/RefLayerTests.cpp index 3164a92..fc30b0d 100644 --- a/src/backends/reference/test/RefLayerTests.cpp +++ b/src/backends/reference/test/RefLayerTests.cpp @@ -614,6 +614,10 @@ ARMNN_AUTO_TEST_CASE(AdditionInt16, AdditionInt16Test) ARMNN_AUTO_TEST_CASE(AddBroadcastInt16, AdditionBroadcastInt16Test) ARMNN_AUTO_TEST_CASE(AddBroadcast1ElementInt16, AdditionBroadcast1ElementInt16Test) +ARMNN_AUTO_TEST_CASE(AdditionInt32, AdditionInt32Test) +ARMNN_AUTO_TEST_CASE(AddBroadcastInt32, AdditionBroadcastInt32Test) +ARMNN_AUTO_TEST_CASE(AddBroadcast1ElementInt32, AdditionBroadcast1ElementInt32Test) + // Sub ARMNN_AUTO_TEST_CASE(SimpleSub, SubtractionTest) ARMNN_AUTO_TEST_CASE(SubBroadcast1Element, SubtractionBroadcast1ElementTest) @@ -631,6 +635,10 @@ ARMNN_AUTO_TEST_CASE(SubtractionInt16, SubtractionInt16Test) ARMNN_AUTO_TEST_CASE(SubBroadcastInt16, SubtractionBroadcastInt16Test) ARMNN_AUTO_TEST_CASE(SubBroadcast1ElementInt16, SubtractionBroadcast1ElementInt16Test) +ARMNN_AUTO_TEST_CASE(SubtractionInt32, SubtractionInt32Test) +ARMNN_AUTO_TEST_CASE(SubBroadcastInt32, SubtractionBroadcastInt32Test) +ARMNN_AUTO_TEST_CASE(SubBroadcast1ElementInt32, SubtractionBroadcast1ElementInt32Test) + // Div ARMNN_AUTO_TEST_CASE(SimpleDivision, DivisionTest) ARMNN_AUTO_TEST_CASE(DivisionByZero, DivisionByZeroTest) @@ -651,6 +659,10 @@ ARMNN_AUTO_TEST_CASE(DivisionInt16, DivisionInt16Test) ARMNN_AUTO_TEST_CASE(DivisionInt16Broadcast1Element, DivisionBroadcast1ElementInt16Test) ARMNN_AUTO_TEST_CASE(DivisionInt16Broadcast1DVector, DivisionBroadcast1DVectorInt16Test) +ARMNN_AUTO_TEST_CASE(DivisionInt32, DivisionInt32Test) +ARMNN_AUTO_TEST_CASE(DivisionInt32Broadcast1Element, DivisionBroadcast1ElementInt32Test) +ARMNN_AUTO_TEST_CASE(DivisionInt32Broadcast1DVector, DivisionBroadcast1DVectorInt32Test) + // Equal ARMNN_AUTO_TEST_CASE(EqualSimple, EqualSimpleTest) ARMNN_AUTO_TEST_CASE(EqualBroadcast1Element, EqualBroadcast1ElementTest) @@ -742,6 +754,9 @@ ARMNN_AUTO_TEST_CASE(MaximumBroadcast1DVectorUint8, MaximumBroadcast1DVectorUint ARMNN_AUTO_TEST_CASE(MaximumInt16, MaximumInt16Test) ARMNN_AUTO_TEST_CASE(MaximumBroadcast1ElementInt16, MaximumBroadcast1ElementInt16Test) ARMNN_AUTO_TEST_CASE(MaximumBroadcast1DVectorInt16, MaximumBroadcast1DVectorInt16Test) +ARMNN_AUTO_TEST_CASE(MaximumInt32, MaximumInt32Test) +ARMNN_AUTO_TEST_CASE(MaximumBroadcast1ElementInt32, MaximumBroadcast1ElementInt32Test) +ARMNN_AUTO_TEST_CASE(MaximumBroadcast1DVectorInt32, MaximumBroadcast1DVectorInt32Test) // Min ARMNN_AUTO_TEST_CASE(SimpleMinimum1, MinimumBroadcast1ElementTest1) @@ -753,6 +768,9 @@ ARMNN_AUTO_TEST_CASE(MinimumBroadcast1DVectorFloat16, MinimumBroadcast1DVectorFl ARMNN_AUTO_TEST_CASE(MinimumInt16, MinimumInt16Test) ARMNN_AUTO_TEST_CASE(MinimumBroadcast1ElementInt16, MinimumBroadcast1ElementInt16Test) ARMNN_AUTO_TEST_CASE(MinimumBroadcast1DVectorInt16, MinimumBroadcast1DVectorInt16Test) +ARMNN_AUTO_TEST_CASE(MinimumInt32, MinimumInt32Test) +ARMNN_AUTO_TEST_CASE(MinimumBroadcast1ElementInt32, MinimumBroadcast1ElementInt32Test) +ARMNN_AUTO_TEST_CASE(MinimumBroadcast1DVectorInt32, MinimumBroadcast1DVectorInt32Test) // Mul ARMNN_AUTO_TEST_CASE(SimpleMultiplication, MultiplicationTest) @@ -764,6 +782,9 @@ ARMNN_AUTO_TEST_CASE(MultiplicationBroadcast1DVectorUint8, MultiplicationBroadca ARMNN_AUTO_TEST_CASE(MultiplicationInt16, MultiplicationInt16Test) ARMNN_AUTO_TEST_CASE(MultiplicationBroadcast1ElementInt16, MultiplicationBroadcast1ElementInt16Test) ARMNN_AUTO_TEST_CASE(MultiplicationBroadcast1DVectorInt16, MultiplicationBroadcast1DVectorInt16Test) +ARMNN_AUTO_TEST_CASE(MultiplicationInt32, MultiplicationInt32Test) +ARMNN_AUTO_TEST_CASE(MultiplicationBroadcast1ElementInt32, MultiplicationBroadcast1ElementInt32Test) +ARMNN_AUTO_TEST_CASE(MultiplicationBroadcast1DVectorInt32, MultiplicationBroadcast1DVectorInt32Test) ARMNN_AUTO_TEST_CASE(Multiplication5d, Multiplication5dTest) // Batch Norm