From 4e1e136cce3fca73ba49b570cfcb620f4ec574da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89anna=20=C3=93=20Cath=C3=A1in?= Date: Mon, 12 Nov 2018 11:36:34 +0000 Subject: IVGCVSW-2054: BATCH_TO_SPACE_ND Reference implementation and Unit tests. Change-Id: I13c6728dbb60643d0e086d171225c5d802987f92 --- include/armnn/Descriptors.hpp | 19 +++++++++++++++++++ include/armnn/DescriptorsFwd.hpp | 1 + include/armnn/ILayerSupport.hpp | 5 +++++ include/armnn/INetwork.hpp | 7 +++++++ include/armnn/LayerSupport.hpp | 8 ++++++++ 5 files changed, 40 insertions(+) (limited to 'include') diff --git a/include/armnn/Descriptors.hpp b/include/armnn/Descriptors.hpp index 656afb1756..bda8cf7396 100644 --- a/include/armnn/Descriptors.hpp +++ b/include/armnn/Descriptors.hpp @@ -296,6 +296,25 @@ struct BatchNormalizationDescriptor DataLayoutIndexed m_DataLayout; }; +struct BatchToSpaceNdDescriptor +{ + BatchToSpaceNdDescriptor() + : m_BlockShape() + , m_Crops() + , m_DataLayout(DataLayout::NCHW) + {} + + BatchToSpaceNdDescriptor(std::vector blockShape, std::vector> crops) + : m_BlockShape(blockShape) + , m_Crops(crops) + , m_DataLayout(DataLayout::NCHW) + {} + + std::vector m_BlockShape; + std::vector> m_Crops; + DataLayoutIndexed m_DataLayout; +}; + struct FakeQuantizationDescriptor { FakeQuantizationDescriptor() diff --git a/include/armnn/DescriptorsFwd.hpp b/include/armnn/DescriptorsFwd.hpp index a2974d797d..0e96c360d3 100644 --- a/include/armnn/DescriptorsFwd.hpp +++ b/include/armnn/DescriptorsFwd.hpp @@ -8,6 +8,7 @@ namespace armnn { struct ActivationDescriptor; struct BatchNormalizationDescriptor; +struct BatchToSpaceNdDescriptor; struct Convolution2dDescriptor; struct DepthwiseConvolution2dDescriptor; struct FakeQuantizationDescriptor; diff --git a/include/armnn/ILayerSupport.hpp b/include/armnn/ILayerSupport.hpp index 0e7adff0af..1bf268f409 100644 --- a/include/armnn/ILayerSupport.hpp +++ b/include/armnn/ILayerSupport.hpp @@ -41,6 +41,11 @@ public: const BatchNormalizationDescriptor& descriptor, Optional reasonIfUnsupported = EmptyOptional()) const; + virtual bool IsBatchToSpaceNdSupported(const TensorInfo& input, + const TensorInfo& output, + const BatchToSpaceNdDescriptor& descriptor, + Optional reasonIfUnsupported = EmptyOptional()) const; + virtual bool IsConstantSupported(const TensorInfo& output, Optional reasonIfUnsupported = EmptyOptional()) const; diff --git a/include/armnn/INetwork.hpp b/include/armnn/INetwork.hpp index 2cb8f28d87..df274d6dc1 100644 --- a/include/armnn/INetwork.hpp +++ b/include/armnn/INetwork.hpp @@ -149,6 +149,13 @@ public: virtual IConnectableLayer* AddPermuteLayer(const PermuteDescriptor& permuteDescriptor, const char* name = nullptr) = 0; + /// Adds a batch to space ND layer to the network. + /// @param batchToSpaceNdDescriptor - Description of the layer. + /// @param name - Optional name for the layer. + /// @return - Interface for configuring the layer. + virtual IConnectableLayer* AddBatchToSpaceNdLayer(const BatchToSpaceNdDescriptor& batchToSpaceNdDescriptor, + const char* name = nullptr) = 0; + /// Adds a pooling layer to the network. /// @param pooling2dDescriptor - Pooling2dDescriptor to configure the pooling. /// @param name - Optional name for the layer. diff --git a/include/armnn/LayerSupport.hpp b/include/armnn/LayerSupport.hpp index eb6b5da7b9..bd20f185da 100644 --- a/include/armnn/LayerSupport.hpp +++ b/include/armnn/LayerSupport.hpp @@ -40,6 +40,14 @@ bool IsBatchNormalizationSupported(const BackendId& backend, char* reasonIfUnsupported = nullptr, size_t reasonIfUnsupportedMaxLength = 1024); +/// Deprecated in favor of IBackend and ILayerSupport interfaces +bool IsBatchToSpaceNdSupported(const BackendId& backend, + const TensorInfo& input, + const TensorInfo& output, + const BatchToSpaceNdDescriptor& descriptor, + char* reasonIfUnsupported = nullptr, + size_t reasonIfUnsupportedMaxLength = 1024); + /// Deprecated in favor of IBackend and ILayerSupport interfaces bool IsConstantSupported(const BackendId& backend, const TensorInfo& output, -- cgit v1.2.1