diff options
author | Matteo Martincigh <matteo.martincigh@arm.com> | 2019-06-04 10:59:47 +0100 |
---|---|---|
committer | Narumol Prangnawarat <narumol.prangnawarat@arm.com> | 2019-06-04 15:20:45 +0000 |
commit | f550713476f404a82e59bd68223a8a4955e753f2 (patch) | |
tree | 762b3eae41d412c1da7b45c9ead1ca2547b66f12 /src/backends/backendsCommon/test/LayerTests.cpp | |
parent | 3122bd574a3d29774c535ca2136de361da626e88 (diff) | |
download | armnn-f550713476f404a82e59bd68223a8a4955e753f2.tar.gz |
IVGCVSW-3213 Extend the Reference BatchNormalization workload to
support the new QSymm16 type
* Added QSymm16 to the range of supported types for batch
normalization ref workloads
* Added unit tests for QSymm16
Change-Id: I5b2fcfbd9cb5af149ebfe24e2d95f3affa2e3690
Signed-off-by: Matteo Martincigh <matteo.martincigh@arm.com>
Diffstat (limited to 'src/backends/backendsCommon/test/LayerTests.cpp')
-rw-r--r-- | src/backends/backendsCommon/test/LayerTests.cpp | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/src/backends/backendsCommon/test/LayerTests.cpp b/src/backends/backendsCommon/test/LayerTests.cpp index 5679fffe99..e96f7dc732 100644 --- a/src/backends/backendsCommon/test/LayerTests.cpp +++ b/src/backends/backendsCommon/test/LayerTests.cpp @@ -8259,6 +8259,92 @@ LayerTestResult<uint8_t, 4> BatchNormUint8NhwcTest( 1.f/20.f, 50, armnn::DataLayout::NHWC); } +LayerTestResult<int16_t, 4> BatchNormInt16Test( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) +{ + // BatchSize: 1 + // Channels: 2 + // Height: 3 + // Width: 2 + + const armnn::TensorShape inputOutputShape{ 1, 2, 3, 2 }; + std::vector<float> inputValues + { + // Batch 0, Channel 0, Height (3) x Width (2) + 1.f, 4.f, + 4.f, 2.f, + 1.f, 6.f, + + // Batch 0, Channel 1, Height (3) x Width (2) + 1.f, 1.f, + 4.f, 1.f, + -2.f, 4.f + }; + std::vector<float> expectedOutputValues + { + // Batch 0, Channel 0, Height (3) x Width (2) + 1.f, 4.f, + 4.f, 2.f, + 1.f, 6.f, + + // Batch 0, Channel 1, Height (3) x Width (2) + 3.f, 3.f, + 4.f, 3.f, + 2.f, 4.f + }; + + return BatchNormTestImpl<armnn::DataType::QuantisedSymm16>( + workloadFactory, memoryManager, + inputOutputShape, inputValues, expectedOutputValues, + 1.f/20.f, 50, armnn::DataLayout::NCHW); +} + +LayerTestResult<int16_t, 4> BatchNormInt16NhwcTest( + armnn::IWorkloadFactory& workloadFactory, + const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) +{ + // BatchSize: 1 + // Height: 3 + // Width: 2 + // Channels: 2 + + const armnn::TensorShape inputOutputShape{ 1, 3, 2, 2 }; + std::vector<float> inputValues + { + // Batch 0, Height 0, Width (2) x Channel (2) + 1.f, 1.f, + 4.f, 1.f, + + // Batch 0, Height 1, Width (2) x Channel (2) + 4.f, 4.f, + 2.f, 1.f, + + // Batch 0, Height 2, Width (2) x Channel (2) + 1.f, -2.f, + 6.f, 4.f + }; + std::vector<float> expectedOutputValues + { + // Batch 0, Height 0, Width (2) x Channel (2) + 1.f, 3.f, + 4.f, 3.f, + + // Batch 0, Height 1, Width (2) x Channel (2) + 4.f, 4.f, + 2.f, 3.f, + + // Batch 0, Height 2, Width (2) x Channel (2) + 1.f, 2.f, + 6.f, 4.f + }; + + return BatchNormTestImpl<armnn::DataType::QuantisedSymm16> + (workloadFactory, memoryManager, + inputOutputShape, inputValues, expectedOutputValues, + 1.f/20.f, 50, armnn::DataLayout::NHWC); +} + LayerTestResult<uint8_t, 4> ConstantUint8CustomQuantizationScaleAndOffsetTest( armnn::IWorkloadFactory& workloadFactory, const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager) |