diff options
author | Nina Drozd <nina.drozd@arm.com> | 2019-05-16 12:09:18 +0100 |
---|---|---|
committer | Nina Drozd <nina.drozd@arm.com> | 2019-05-20 08:56:46 +0000 |
commit | 58ef2c6f797f6bdb962016c519ebbc980ec2ed50 (patch) | |
tree | 282d50763bd2a6aaf4bb4ef5ea5ed123cfdcedb6 /src/backends/reference/test | |
parent | 39d487d3e2834a6d3024c92a519d84aa05f87925 (diff) | |
download | armnn-58ef2c6f797f6bdb962016c519ebbc980ec2ed50.tar.gz |
IVGCVSW-2967 Support QSymm16 for Constant workloads
* Validate that output is any of supported types in WorkloadData
* Validate that output is any of supported types in RefLayerSupport
* Add test for constant with QuantisedSymm16 in LayerTests
* Add test for creating constant workload in RefCreateWorkloadTests
* Add test for constant with QuantisedSymm16 in RefLayerTests
* Refactor RefConstantWorkload - BaseWorkload instead of TypedWorkload
* Refactor RefConstantWorkload - remove m_RanOnce, use PostAllocationConfigure()
Signed-off-by: Nina Drozd <nina.drozd@arm.com>
Change-Id: Ic30e61319ef4ff9c367689901f7c6d498142a9c5
Diffstat (limited to 'src/backends/reference/test')
-rw-r--r-- | src/backends/reference/test/RefCreateWorkloadTests.cpp | 33 | ||||
-rw-r--r-- | src/backends/reference/test/RefLayerTests.cpp | 3 |
2 files changed, 35 insertions, 1 deletions
diff --git a/src/backends/reference/test/RefCreateWorkloadTests.cpp b/src/backends/reference/test/RefCreateWorkloadTests.cpp index 024bfe1e0c..4827d2867d 100644 --- a/src/backends/reference/test/RefCreateWorkloadTests.cpp +++ b/src/backends/reference/test/RefCreateWorkloadTests.cpp @@ -701,4 +701,37 @@ BOOST_AUTO_TEST_CASE(CreateMergerDim3Uint8Workload) RefCreateMergerWorkloadTest<RefConcatWorkload, armnn::DataType::QuantisedAsymm8>({ 2, 3, 2, 10 }, 3); } +template <typename ConstantWorkloadType, armnn::DataType DataType> +static void RefCreateConstantWorkloadTest(const armnn::TensorShape& outputShape) +{ + armnn::Graph graph; + RefWorkloadFactory factory; + auto workload = CreateConstantWorkloadTest<ConstantWorkloadType, DataType>(factory, graph, outputShape); + + // Check output is as expected + auto queueDescriptor = workload->GetData(); + auto outputHandle = boost::polymorphic_downcast<CpuTensorHandle*>(queueDescriptor.m_Outputs[0]); + BOOST_TEST((outputHandle->GetTensorInfo() == TensorInfo(outputShape, DataType))); +} + +BOOST_AUTO_TEST_CASE(CreateConstantUint8Workload) +{ + RefCreateConstantWorkloadTest<RefConstantWorkload, armnn::DataType::QuantisedAsymm8>({ 2, 3, 2, 10 }); +} + +BOOST_AUTO_TEST_CASE(CreateConstantInt16Workload) +{ + RefCreateConstantWorkloadTest<RefConstantWorkload, armnn::DataType::QuantisedSymm16>({ 2, 3, 2, 10 }); +} + +BOOST_AUTO_TEST_CASE(CreateConstantFloat32Workload) +{ + RefCreateConstantWorkloadTest<RefConstantWorkload, armnn::DataType::Float32>({ 2, 3, 2, 10 }); +} + +BOOST_AUTO_TEST_CASE(CreateConstantSigned32Workload) +{ + RefCreateConstantWorkloadTest<RefConstantWorkload, armnn::DataType::Signed32>({ 2, 3, 2, 10 }); +} + BOOST_AUTO_TEST_SUITE_END() diff --git a/src/backends/reference/test/RefLayerTests.cpp b/src/backends/reference/test/RefLayerTests.cpp index 053de9e14f..55a25167f5 100644 --- a/src/backends/reference/test/RefLayerTests.cpp +++ b/src/backends/reference/test/RefLayerTests.cpp @@ -385,7 +385,8 @@ ARMNN_AUTO_TEST_CASE(PadUint84d, PadUint84dTest) // Constant ARMNN_AUTO_TEST_CASE(Constant, ConstantTest) -ARMNN_AUTO_TEST_CASE(ConstantUint8, ConstantUint8Test) +ARMNN_AUTO_TEST_CASE(ConstantUint8, ConstantUint8CustomQuantizationScaleAndOffsetTest) +ARMNN_AUTO_TEST_CASE(ConstantInt16, ConstantInt16CustomQuantizationScaleAndOffsetTest) // Concat ARMNN_AUTO_TEST_CASE(Concatenation1d, Concatenation1dTest) |