diff options
author | Derek Lamberti <derek.lamberti@arm.com> | 2019-03-25 15:41:58 +0000 |
---|---|---|
committer | Derek Lamberti <derek.lamberti@arm.com> | 2019-04-01 13:47:10 +0100 |
commit | 5f400d6d23b463ca810180b45dd84c3f99b24690 (patch) | |
tree | bbdc67d931cfc989ac4bf51eb1b81aa4e18aafc1 /src/backends/reference/RefLayerSupport.cpp | |
parent | 8a54ac09dc4b9be1c1826bc63d4baf5101dafd53 (diff) | |
download | armnn-5f400d6d23b463ca810180b45dd84c3f99b24690.tar.gz |
IVGCVSW-2871 Ref QuantizeLayer workload
Change-Id: If048b2a053c542b31ae344fe0af04d9b4f40eb6d
Signed-off-by: Derek Lamberti <derek.lamberti@arm.com>
Diffstat (limited to 'src/backends/reference/RefLayerSupport.cpp')
-rw-r--r-- | src/backends/reference/RefLayerSupport.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/backends/reference/RefLayerSupport.cpp b/src/backends/reference/RefLayerSupport.cpp index 532c8eaf98..4d164d58a2 100644 --- a/src/backends/reference/RefLayerSupport.cpp +++ b/src/backends/reference/RefLayerSupport.cpp @@ -122,6 +122,14 @@ struct ShapesAreSameRank : public Rule } }; +struct ShapesAreSameTotalSize : public Rule +{ + ShapesAreSameTotalSize(const TensorInfo& info0, const TensorInfo& info1) + { + m_Res = info0.GetNumElements() == info1.GetNumElements(); + } +}; + struct ShapesAreBroadcastCompatible : public Rule { unsigned int CalcInputSize(const TensorShape& in, const TensorShape& out, unsigned int idx) @@ -719,6 +727,34 @@ bool RefLayerSupport::IsPooling2dSupported(const TensorInfo& input, &TrueFunc<>); } +bool RefLayerSupport::IsQuantizeSupported(const TensorInfo& input, + const TensorInfo& output, + Optional<std::string&> reasonIfUnsupported) const +{ + bool supported = true; + + // Define supported output types. + std::array<DataType,2> supportedInputTypes = { + DataType::Float32, + }; + + supported &= CheckSupportRule(TypeAnyOf(input, supportedInputTypes), reasonIfUnsupported, + "Reference quantize: input type not supported."); + + // Define supported output types. + std::array<DataType,2> supportedOutputTypes = { + DataType::QuantisedAsymm8, + DataType::QuantisedSymm16 + }; + supported &= CheckSupportRule(TypeAnyOf(output, supportedOutputTypes), reasonIfUnsupported, + "Reference quantize: output type not supported."); + + supported &= CheckSupportRule(ShapesAreSameTotalSize(input, output), reasonIfUnsupported, + "Reference quantize: input and output shapes have different num total elements."); + + return supported; +} + bool RefLayerSupport::IsReshapeSupported(const TensorInfo& input, const ReshapeDescriptor& descriptor, Optional<std::string&> reasonIfUnsupported) const |