aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAron Virginas-Tar <Aron.Virginas-Tar@arm.com>2019-09-19 14:31:17 +0100
committerÁron Virginás-Tar <aron.virginas-tar@arm.com>2019-09-20 14:18:22 +0000
commitdd6247f52dcb33bd03391b7ee573d7082e18cca7 (patch)
treefb849d8afc6ffd74c1f6334d1f81b92a367fd024 /include
parenta2f4b4be6adbd8b53e4e860c4d7c3a704e343395 (diff)
downloadarmnn-dd6247f52dcb33bd03391b7ee573d7082e18cca7.tar.gz
IVGCVSW-3883 Add frontend for DepthToSpace layer
Signed-off-by: Aron Virginas-Tar <Aron.Virginas-Tar@arm.com> Change-Id: I18d957af6e988ffb6b9ee46ac836d1f38600e10b
Diffstat (limited to 'include')
-rw-r--r--include/armnn/Descriptors.hpp12
-rw-r--r--include/armnn/DescriptorsFwd.hpp2
-rw-r--r--include/armnn/ILayerSupport.hpp5
-rw-r--r--include/armnn/ILayerVisitor.hpp8
-rw-r--r--include/armnn/INetwork.hpp7
-rw-r--r--include/armnn/LayerVisitorBase.hpp4
6 files changed, 36 insertions, 2 deletions
diff --git a/include/armnn/Descriptors.hpp b/include/armnn/Descriptors.hpp
index 686536f53e..c973089df6 100644
--- a/include/armnn/Descriptors.hpp
+++ b/include/armnn/Descriptors.hpp
@@ -589,16 +589,24 @@ struct SpaceToBatchNdDescriptor
struct SpaceToDepthDescriptor
{
SpaceToDepthDescriptor()
- : m_BlockSize(1u)
- , m_DataLayout(DataLayout::NHWC)
+ : SpaceToDepthDescriptor(1u, DataLayout::NHWC)
+ {}
+
+ SpaceToDepthDescriptor(unsigned int blockSize, DataLayout dataLayout)
+ : m_BlockSize(blockSize)
+ , m_DataLayout(dataLayout)
{}
/// Scalar specifying the input block size. It must be >= 1
unsigned int m_BlockSize;
+
/// The data layout to be used (NCHW, NHWC).
DataLayout m_DataLayout;
};
+/// A DepthToSpaceDescriptor for the DepthToSpaceLayer
+using DepthToSpaceDescriptor = SpaceToDepthDescriptor;
+
/// An LstmDescriptor for the LstmLayer.
struct LstmDescriptor
{
diff --git a/include/armnn/DescriptorsFwd.hpp b/include/armnn/DescriptorsFwd.hpp
index bddb0cad59..e9624f18ce 100644
--- a/include/armnn/DescriptorsFwd.hpp
+++ b/include/armnn/DescriptorsFwd.hpp
@@ -37,6 +37,8 @@ struct StridedSliceDescriptor;
struct TransposeConvolution2dDescriptor;
struct ViewsDescriptor;
+using DepthToSpaceDescriptor = SpaceToDepthDescriptor;
+
// MergerDescriptor is deprecated use ConcatDescriptor instead
using MergerDescriptor = OriginsDescriptor;
using ConcatDescriptor = OriginsDescriptor;
diff --git a/include/armnn/ILayerSupport.hpp b/include/armnn/ILayerSupport.hpp
index cab2df19af..e18b86acfd 100644
--- a/include/armnn/ILayerSupport.hpp
+++ b/include/armnn/ILayerSupport.hpp
@@ -88,6 +88,11 @@ public:
const TensorInfo& output,
Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const = 0;
+ virtual bool IsDepthToSpaceSupported(const TensorInfo& input,
+ const TensorInfo& output,
+ const DepthToSpaceDescriptor& descriptor,
+ Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const = 0;
+
virtual bool IsDepthwiseConvolutionSupported(
const TensorInfo& input,
const TensorInfo& output,
diff --git a/include/armnn/ILayerVisitor.hpp b/include/armnn/ILayerVisitor.hpp
index 6c0977303c..486a13f847 100644
--- a/include/armnn/ILayerVisitor.hpp
+++ b/include/armnn/ILayerVisitor.hpp
@@ -115,6 +115,14 @@ public:
const Optional<ConstTensor>& biases,
const char* name = nullptr) = 0;
+ /// Function a depth to space layer should call back to when its Accept(ILayerVisitor&) function is invoked.
+ /// @param layer - pointer to the layer which is calling back to this visit function.
+ /// @param depthToSpaceDescriptor - Parameters for the depth to space operation.
+ /// @param name - Optional name for the layer.
+ virtual void VisitDepthToSpaceLayer(const IConnectableLayer* layer,
+ const DepthToSpaceDescriptor& depthToSpaceDescriptor,
+ const char* name = nullptr) = 0;
+
/// Function that a 2D depthwise convolution layer with biases should call back to when its
/// Accept(ILayerVisitor&) function is invoked.
/// @param layer - pointer to the layer which is calling back to this visit function.
diff --git a/include/armnn/INetwork.hpp b/include/armnn/INetwork.hpp
index 09026ad9e6..0e0b99a718 100644
--- a/include/armnn/INetwork.hpp
+++ b/include/armnn/INetwork.hpp
@@ -141,6 +141,13 @@ public:
const ConstTensor& biases,
const char* name = nullptr) = 0;
+ /// Adds a depth to space layer to the network.
+ /// @param depthToSpaceDescriptor - Parameters for the depth to space operation.
+ /// @param name - Optional name for the layer.
+ /// @return - Interface for configuring the layer.
+ virtual IConnectableLayer* AddDepthToSpaceLayer(const DepthToSpaceDescriptor& depthToSpaceDescriptor,
+ const char* name = nullptr) = 0;
+
/// Adds a 2D depthwise convolution layer to the network.
/// @param convolution2dDescriptor - Description of the 2D depthwise convolution layer.
/// @param weights - Tensor for the weights. Expected format: [channelMultiplier, inputChannels, height, width].
diff --git a/include/armnn/LayerVisitorBase.hpp b/include/armnn/LayerVisitorBase.hpp
index d626c712ba..65d23039b7 100644
--- a/include/armnn/LayerVisitorBase.hpp
+++ b/include/armnn/LayerVisitorBase.hpp
@@ -69,6 +69,10 @@ public:
const Optional<ConstTensor>&,
const char*) override { DefaultPolicy::Apply(__func__); }
+ void VisitDepthToSpaceLayer(const IConnectableLayer*,
+ const DepthToSpaceDescriptor&,
+ const char*) override { DefaultPolicy::Apply(__func__); }
+
void VisitDepthwiseConvolution2dLayer(const IConnectableLayer*,
const DepthwiseConvolution2dDescriptor&,
const ConstTensor&,