diff options
author | Teresa Charlin <teresa.charlinreyes@arm.com> | 2019-06-27 15:41:57 +0100 |
---|---|---|
committer | Teresa Charlin <teresa.charlinreyes@arm.com> | 2019-06-28 10:44:19 +0000 |
commit | a9075df5b704e4f4432bf26027e3ba671d4596f0 (patch) | |
tree | e1899766d94464febc50826ec14fa1e1d6f27e39 /include/armnn | |
parent | 7a3e2feaf419cb6f4c047d67459356ac92aae7e8 (diff) | |
download | armnn-a9075df5b704e4f4432bf26027e3ba671d4596f0.tar.gz |
IVGCVSW-3363 Add frontend support for Resize Layer
Signed-off-by: Teresa Charlin <teresa.charlinreyes@arm.com>
Change-Id: I63493ddb7598515773073deb6db2eb3a635c5dfe
Diffstat (limited to 'include/armnn')
-rw-r--r-- | include/armnn/Descriptors.hpp | 22 | ||||
-rw-r--r-- | include/armnn/DescriptorsFwd.hpp | 1 | ||||
-rw-r--r-- | include/armnn/ILayerSupport.hpp | 5 | ||||
-rw-r--r-- | include/armnn/ILayerVisitor.hpp | 8 | ||||
-rw-r--r-- | include/armnn/INetwork.hpp | 7 | ||||
-rw-r--r-- | include/armnn/LayerVisitorBase.hpp | 4 | ||||
-rw-r--r-- | include/armnn/Types.hpp | 6 |
7 files changed, 53 insertions, 0 deletions
diff --git a/include/armnn/Descriptors.hpp b/include/armnn/Descriptors.hpp index 0655d42fbd..8f72c54da1 100644 --- a/include/armnn/Descriptors.hpp +++ b/include/armnn/Descriptors.hpp @@ -503,6 +503,28 @@ struct ResizeBilinearDescriptor DataLayout m_DataLayout; }; +/// A ResizeDescriptor for the ResizeLayer. +struct ResizeDescriptor +{ + ResizeDescriptor() + : m_TargetWidth(0) + , m_TargetHeight(0) + , m_Method(ResizeMethod::NearestNeighbor) + , m_DataLayout(DataLayout::NCHW) + {} + + /// Target width value. + uint32_t m_TargetWidth; + /// Target height value. + uint32_t m_TargetHeight; + /// The Interpolation method to use + /// (Bilinear, NearestNeighbor). + ResizeMethod m_Method; + /// The data layout to be used (NCHW, NHWC). + DataLayout m_DataLayout; +}; + + /// A ReshapeDescriptor for the ReshapeLayer. struct ReshapeDescriptor { diff --git a/include/armnn/DescriptorsFwd.hpp b/include/armnn/DescriptorsFwd.hpp index b814d48699..9627ddc7f1 100644 --- a/include/armnn/DescriptorsFwd.hpp +++ b/include/armnn/DescriptorsFwd.hpp @@ -26,6 +26,7 @@ struct Pooling2dDescriptor; struct PreCompiledDescriptor; struct ReshapeDescriptor; struct ResizeBilinearDescriptor; +struct ResizeDescriptor; struct SoftmaxDescriptor; struct SpaceToBatchNdDescriptor; struct SpaceToDepthDescriptor; diff --git a/include/armnn/ILayerSupport.hpp b/include/armnn/ILayerSupport.hpp index eb581d3aaa..bf0ac90c59 100644 --- a/include/armnn/ILayerSupport.hpp +++ b/include/armnn/ILayerSupport.hpp @@ -251,6 +251,11 @@ public: const TensorInfo& output, Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const = 0; + virtual bool IsResizeSupported(const TensorInfo& input, + const TensorInfo& output, + const ResizeDescriptor& descriptor, + Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const = 0; + virtual bool IsRsqrtSupported(const TensorInfo& input, const TensorInfo& output, Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const = 0; diff --git a/include/armnn/ILayerVisitor.hpp b/include/armnn/ILayerVisitor.hpp index c98760c7cd..37cd383daf 100644 --- a/include/armnn/ILayerVisitor.hpp +++ b/include/armnn/ILayerVisitor.hpp @@ -318,6 +318,14 @@ public: const ResizeBilinearDescriptor& resizeDesc, const char* name = nullptr) = 0; + /// Function that a resize 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 resizeDescriptor - Parameters for the resize operation. + /// @param name - Optional name for the layer. + virtual void VisitResizeLayer(const IConnectableLayer* layer, + const ResizeDescriptor& resizeDescriptor, + const char* name = nullptr) = 0; + /// Function a Reciprocal of square root 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. diff --git a/include/armnn/INetwork.hpp b/include/armnn/INetwork.hpp index af67764fc9..598e1eb0a4 100644 --- a/include/armnn/INetwork.hpp +++ b/include/armnn/INetwork.hpp @@ -296,6 +296,13 @@ public: virtual IConnectableLayer* AddResizeBilinearLayer(const ResizeBilinearDescriptor& resizeDesc, const char* name = nullptr) = 0; + /// Adds a resize layer to the network. + /// @param resizeDescriptor - Parameters for the resize operation. + /// @param name - Optional name for the layer. + /// @return - Interface for configuring the layer. + virtual IConnectableLayer* AddResizeLayer(const ResizeDescriptor& resizeDescriptor, + const char* name = nullptr) = 0; + /// Adds an L2 normalization layer to the network. /// Normalization is performed along dimension 1, but requires a 4d input. /// @param desc - Parameters for the L2 normalization operation. diff --git a/include/armnn/LayerVisitorBase.hpp b/include/armnn/LayerVisitorBase.hpp index 8406efe068..d657154b47 100644 --- a/include/armnn/LayerVisitorBase.hpp +++ b/include/armnn/LayerVisitorBase.hpp @@ -165,6 +165,10 @@ public: const ResizeBilinearDescriptor&, const char*) override { DefaultPolicy::Apply(__func__); } + void VisitResizeLayer(const IConnectableLayer*, + const ResizeDescriptor&, + const char*) override { DefaultPolicy::Apply(__func__); } + void VisitRsqrtLayer(const IConnectableLayer*, const char*) override { DefaultPolicy::Apply(__func__); } diff --git a/include/armnn/Types.hpp b/include/armnn/Types.hpp index 53aa43748f..12897e2af7 100644 --- a/include/armnn/Types.hpp +++ b/include/armnn/Types.hpp @@ -61,6 +61,12 @@ enum class PoolingAlgorithm L2 = 2 }; +enum class ResizeMethod +{ + Bilinear = 0, + NearestNeighbor = 1 +}; + /// /// The padding method modifies the output of pooling layers. /// In both supported methods, the values are ignored (they are |