diff options
author | Narumol Prangnawarat <narumol.prangnawarat@arm.com> | 2019-05-20 15:31:05 +0100 |
---|---|---|
committer | Matteo Martincigh <matteo.martincigh@arm.com> | 2019-05-23 13:37:29 +0000 |
commit | 15eb5832f45d35c5041ba35a43787e8003e22edb (patch) | |
tree | 09fed880bfb9f384d3170aad5c76e4d565267e20 /src/backends/neon/NeonLayerSupport.cpp | |
parent | 495852f2adef1d11fbf13ce6347cf61973ce1a65 (diff) | |
download | armnn-15eb5832f45d35c5041ba35a43787e8003e22edb.tar.gz |
IVGCVSW-2771 Fix SubTensor error in vgg16 ExecuteNetwork NEON
* Add check if Sub-tensors cannot be used, call ACL function
* Add computation of SplitAxis from SplitterDescriptor
* Add NeonSplitterWorkload functions
* Modify IsSplitterSupported to call ACL validate function
if sub-tensor cannot be used
* Also check if quantization parameters match when using sub-tensors
* Add more unit tests for Splitter in TfParser and TfLiteParser
Signed-off-by: Narumol Prangnawarat <narumol.prangnawarat@arm.com>
Change-Id: I31e4c7d055117c83c65b598c4125442173242226
Diffstat (limited to 'src/backends/neon/NeonLayerSupport.cpp')
-rw-r--r-- | src/backends/neon/NeonLayerSupport.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/backends/neon/NeonLayerSupport.cpp b/src/backends/neon/NeonLayerSupport.cpp index f4599ff8e4..fd9aac5bc5 100644 --- a/src/backends/neon/NeonLayerSupport.cpp +++ b/src/backends/neon/NeonLayerSupport.cpp @@ -17,6 +17,7 @@ #include <boost/core/ignore_unused.hpp> #if defined(ARMCOMPUTENEON_ENABLED) +#include <aclCommon/ArmComputeUtils.hpp> #include "workloads/NeonAdditionWorkload.hpp" #include "workloads/NeonActivationWorkload.hpp" #include "workloads/NeonBatchNormalizationWorkload.hpp" @@ -36,6 +37,7 @@ #include "workloads/NeonPooling2dWorkload.hpp" #include "workloads/NeonResizeBilinearWorkload.hpp" #include "workloads/NeonSoftmaxBaseWorkload.hpp" +#include "workloads/NeonSplitterWorkload.hpp" #include "workloads/NeonSubtractionWorkload.hpp" #endif @@ -478,6 +480,38 @@ bool NeonLayerSupport::IsSplitterSupported(const TensorInfo& input, &TrueFunc<>); } +bool NeonLayerSupport::IsSplitterSupported(const TensorInfo& input, + const std::vector<std::reference_wrapper<TensorInfo>>& outputs, + const ViewsDescriptor& descriptor, + Optional<std::string&> reasonIfUnsupported) const +{ +#if defined(ARMCOMPUTENEON_ENABLED) + // Split along the last dimension, cannot use sub-tensors + // as width and height of the sub-tensors do not match + // the width and height of the parent tensor + // in case of input with more than 2D. + std::set<unsigned int> splitAxis = ComputeSplitAxis(descriptor, input.GetShape()); + if (descriptor.GetNumDimensions() > 2 && splitAxis.size() == 1 && + *splitAxis.begin() == descriptor.GetNumDimensions() - 1 ) + { + FORWARD_WORKLOAD_VALIDATE_FUNC(NeonSplitterWorkloadValidate, + reasonIfUnsupported, + input, + outputs, + *splitAxis.begin()); + } +#endif + for (auto output : outputs) + { + if (!input.IsTypeSpaceMatch(output)) // Cannot use sub-tensors if the types are not same space + { + SetValueChecked(reasonIfUnsupported, "Neon Splitter: Types and quantization parameters must match."); + return false; + } + } + return true; +} + bool NeonLayerSupport::IsSubtractionSupported(const TensorInfo& input0, const TensorInfo& input1, const TensorInfo& output, |