From 81e601c5a5ebf3de3dd6418942708158de50252a Mon Sep 17 00:00:00 2001 From: Matthew Jackson Date: Thu, 11 Jul 2019 12:07:09 +0100 Subject: IVGCVSW-3419 Add reference workload support for the new Stack layer * Added reference workload for the Stack layer * Added factory methods * Added validation support * Added unit tests Signed-off-by: Matthew Jackson Change-Id: Ib14b72c15f53a2a2ca152afc357ce2aa405ccc88 --- src/backends/reference/RefLayerSupport.cpp | 31 ++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'src/backends/reference/RefLayerSupport.cpp') diff --git a/src/backends/reference/RefLayerSupport.cpp b/src/backends/reference/RefLayerSupport.cpp index 59c14c4490..b9aa126a8c 100644 --- a/src/backends/reference/RefLayerSupport.cpp +++ b/src/backends/reference/RefLayerSupport.cpp @@ -419,6 +419,7 @@ bool RefLayerSupport::IsConcatSupported(const std::vector inp "Reference concatenation: output type not supported"); for (const TensorInfo* input : inputs) { + BOOST_ASSERT(input != nullptr); supported &= CheckSupportRule(TypeAnyOf(*input, supportedTypes), reasonIfUnsupported, "Reference concatenation: input type not supported"); @@ -1592,6 +1593,36 @@ bool RefLayerSupport::IsSplitterSupported(const TensorInfo& input, return supported; } +bool RefLayerSupport::IsStackSupported(const std::vector& inputs, + const TensorInfo& output, + const StackDescriptor& descriptor, + Optional reasonIfUnsupported) const +{ + ignore_unused(descriptor); + + bool supported = true; + std::array supportedTypes = + { + DataType::Float32, + DataType::QuantisedAsymm8, + DataType::QuantisedSymm16 + }; + + supported &= CheckSupportRule(TypeAnyOf(output, supportedTypes), reasonIfUnsupported, + "Reference stack: output type not supported"); + for (const TensorInfo* input : inputs) + { + BOOST_ASSERT(input != nullptr); + supported &= CheckSupportRule(TypeAnyOf(*input, supportedTypes), reasonIfUnsupported, + "Reference stack: input type not supported"); + + supported &= CheckSupportRule(TypesAreEqual(*input, output), reasonIfUnsupported, + "Reference stack: input and output types mismatched."); + } + + return supported; +} + bool RefLayerSupport::IsStridedSliceSupported(const TensorInfo& input, const TensorInfo& output, const StridedSliceDescriptor& descriptor, -- cgit v1.2.1