diff options
Diffstat (limited to 'src/backends/neon/NeonLayerSupport.cpp')
-rw-r--r-- | src/backends/neon/NeonLayerSupport.cpp | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/src/backends/neon/NeonLayerSupport.cpp b/src/backends/neon/NeonLayerSupport.cpp index 46a7e6f79f..898660cc91 100644 --- a/src/backends/neon/NeonLayerSupport.cpp +++ b/src/backends/neon/NeonLayerSupport.cpp @@ -52,10 +52,7 @@ bool IsNeonBackendSupported(Optional<std::string&> reasonIfUnsupported) #if defined(ARMCOMPUTENEON_ENABLED) return true; #else - if (reasonIfUnsupported) - { - reasonIfUnsupported.value() = "The armnn library has been built without NEON support"; - } + SetValueChecked(reasonIfUnsupported, "The armnn library has been built without NEON support"); return false; #endif } @@ -304,7 +301,14 @@ bool NeonLayerSupport::IsMergerSupported(const std::vector<const TensorInfo*> in const OriginsDescriptor& descriptor, Optional<std::string&> reasonIfUnsupported) const { - if(descriptor.GetNumDimensions() - descriptor.GetConcatAxis() == 1) + if (descriptor.GetNumDimensions() <= descriptor.GetConcatAxis()) + { + SetValueChecked(reasonIfUnsupported, "Neon Merger: Concat axis > Number of dimensions."); + return false; + } + + unsigned int concatInnerAxis = (descriptor.GetNumDimensions() - descriptor.GetConcatAxis()) - 1; + if(concatInnerAxis < 3) // Width, height, or channels { FORWARD_WORKLOAD_VALIDATE_FUNC(NeonMergerWorkloadValidate, reasonIfUnsupported, @@ -312,13 +316,23 @@ bool NeonLayerSupport::IsMergerSupported(const std::vector<const TensorInfo*> in output, descriptor); } - else - { - return IsSupportedForDataTypeNeon(reasonIfUnsupported, - inputs[0]->GetDataType(), - &TrueFunc<>, - &TrueFunc<>); - } + else if (concatInnerAxis == 3) + { + for (auto& input : inputs) + { + if (input && !output.IsTypeSpaceMatch(*input)) // Cannot use sub-tensors if the types are not same space + { + SetValueChecked(reasonIfUnsupported, "Neon Merger: Types and quantization parameters must match."); + return false; + } + } + return true; // Sub-tensors support concat along batch + } + else // > 4 dimensions not supported. + { + SetValueChecked(reasonIfUnsupported, "Neon Merger: Maximum of 4 dimensions supported."); + return false; + } } bool NeonLayerSupport::IsMinimumSupported(const TensorInfo& input0, |