diff options
author | Ellen Norris-Thompson <ellen.norris-thompson@arm.com> | 2019-06-24 09:23:38 +0100 |
---|---|---|
committer | Ellen Norris-Thompson <ellen.norris-thompson@arm.com> | 2019-06-25 17:12:20 +0100 |
commit | e0dbedfa9fad91c94ae610c48057fc7c24ceb0d4 (patch) | |
tree | 438d24b8411f41d155a5eb4d3b088d87ca3e2766 /src/backends/reference | |
parent | e440329a22e03e1813ecaaa9dad34a7d9dfd446e (diff) | |
download | armnn-e0dbedfa9fad91c94ae610c48057fc7c24ceb0d4.tar.gz |
IVGCVSW-3250 Extend the Gather workload for QSymm16 support
* Add LayerTests and EndToEndTests for QSymm16
* Updated GatherQueueDescriptor::Validate function
* Reimplemented RefLayerSupport::IsGatherSupported
Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
Change-Id: I5b4df55d31b5ee3c5563d2df17b412a387c27595
Diffstat (limited to 'src/backends/reference')
-rw-r--r-- | src/backends/reference/RefLayerSupport.cpp | 35 | ||||
-rw-r--r-- | src/backends/reference/test/RefEndToEndTests.cpp | 10 | ||||
-rw-r--r-- | src/backends/reference/test/RefLayerTests.cpp | 3 |
3 files changed, 42 insertions, 6 deletions
diff --git a/src/backends/reference/RefLayerSupport.cpp b/src/backends/reference/RefLayerSupport.cpp index a1807819e3..4e9a67879f 100644 --- a/src/backends/reference/RefLayerSupport.cpp +++ b/src/backends/reference/RefLayerSupport.cpp @@ -130,6 +130,14 @@ struct TypeAnyOf : public Rule } }; +struct TypeIs : public Rule +{ + TypeIs(const TensorInfo& info, DataType dt) + { + m_Res = dt == info.GetDataType(); + } +}; + struct BiasAndWeightsTypesMatch : public Rule { BiasAndWeightsTypesMatch(const TensorInfo& biases, const TensorInfo& weights) @@ -721,12 +729,27 @@ bool RefLayerSupport::IsGatherSupported(const armnn::TensorInfo& input0, const armnn::TensorInfo& output, armnn::Optional<std::string&> reasonIfUnsupported) const { - ignore_unused(input1); - ignore_unused(output); - return IsSupportedForDataTypeRef(reasonIfUnsupported, - input0.GetDataType(), - &TrueFunc<>, - &TrueFunc<>); + bool supported = true; + std::array<DataType,3> supportedTypes = + { + DataType::Float32, + DataType::QuantisedAsymm8, + DataType::QuantisedSymm16 + }; + + supported &= CheckSupportRule(TypeAnyOf(input0, supportedTypes), reasonIfUnsupported, + "Reference Gather: input type not supported"); + + supported &= CheckSupportRule(TypeAnyOf(output, supportedTypes), reasonIfUnsupported, + "Reference Gather: output type not supported"); + + supported &= CheckSupportRule(TypeIs(input1, DataType::Signed32), reasonIfUnsupported, + "Reference Gather: indices (input1) type not supported"); + + supported &= CheckSupportRule(TypesAreEqual(input0, output), reasonIfUnsupported, + "Reference Gather: input and output types not matching"); + + return supported; } bool RefLayerSupport::IsGreaterSupported(const TensorInfo& input0, diff --git a/src/backends/reference/test/RefEndToEndTests.cpp b/src/backends/reference/test/RefEndToEndTests.cpp index be73116f65..c186c03984 100644 --- a/src/backends/reference/test/RefEndToEndTests.cpp +++ b/src/backends/reference/test/RefEndToEndTests.cpp @@ -448,6 +448,11 @@ BOOST_AUTO_TEST_CASE(RefGatherUint8Test) GatherEndToEnd<armnn::DataType::QuantisedAsymm8>(defaultBackends); } +BOOST_AUTO_TEST_CASE(RefGatherInt16Test) +{ + GatherEndToEnd<armnn::DataType::QuantisedSymm16>(defaultBackends); +} + BOOST_AUTO_TEST_CASE(RefGatherMultiDimFloatTest) { GatherMultiDimEndToEnd<armnn::DataType::Float32>(defaultBackends); @@ -458,6 +463,11 @@ BOOST_AUTO_TEST_CASE(RefGatherMultiDimUint8Test) GatherMultiDimEndToEnd<armnn::DataType::QuantisedAsymm8>(defaultBackends); } +BOOST_AUTO_TEST_CASE(RefGatherMultiDimInt16Test) +{ + GatherMultiDimEndToEnd<armnn::DataType::QuantisedSymm16>(defaultBackends); +} + BOOST_AUTO_TEST_CASE(DequantizeEndToEndSimpleTest) { DequantizeEndToEndSimple<armnn::DataType::QuantisedAsymm8>(defaultBackends); diff --git a/src/backends/reference/test/RefLayerTests.cpp b/src/backends/reference/test/RefLayerTests.cpp index 4cb261f07d..f933bfe3e1 100644 --- a/src/backends/reference/test/RefLayerTests.cpp +++ b/src/backends/reference/test/RefLayerTests.cpp @@ -896,10 +896,13 @@ ARMNN_AUTO_TEST_CASE(Debug1DUint8, Debug1DUint8Test) // Gather ARMNN_AUTO_TEST_CASE(Gather1DParamsFloat, Gather1DParamsFloatTest) ARMNN_AUTO_TEST_CASE(Gather1DParamsUint8, Gather1DParamsUint8Test) +ARMNN_AUTO_TEST_CASE(Gather1DParamsInt16, Gather1DParamsInt16Test) ARMNN_AUTO_TEST_CASE(GatherMultiDimParamsFloat, GatherMultiDimParamsFloatTest) ARMNN_AUTO_TEST_CASE(GatherMultiDimParamsUint8, GatherMultiDimParamsUint8Test) +ARMNN_AUTO_TEST_CASE(GatherMultiDimParamsInt16, GatherMultiDimParamsInt16Test) ARMNN_AUTO_TEST_CASE(GatherMultiDimParamsMultiDimIndicesFloat, GatherMultiDimParamsMultiDimIndicesFloatTest) ARMNN_AUTO_TEST_CASE(GatherMultiDimParamsMultiDimIndicesUint8, GatherMultiDimParamsMultiDimIndicesUint8Test) +ARMNN_AUTO_TEST_CASE(GatherMultiDimParamsMultiDimIndicesInt16, GatherMultiDimParamsMultiDimIndicesInt16Test) // Detection PostProcess BOOST_AUTO_TEST_CASE(DetectionPostProcessRegularNmsFloat) |