From ec6c68093eaef8a2b8e1fd64fcc765237973512e Mon Sep 17 00:00:00 2001 From: Ryan OShea Date: Fri, 5 Jun 2020 17:17:06 +0100 Subject: IVGCVSW-4906 Add front-end support for FILL operator * Added new fill layer * Added visitor tests Signed-off-by: Ryan OShea Change-Id: Iea677014866b4f2d514004623f59ee83f3c0eef8 Signed-off-by: Keith Davis --- include/armnn/Descriptors.hpp | 19 +++++++++++++++++++ include/armnn/DescriptorsFwd.hpp | 1 + include/armnn/ILayerSupport.hpp | 5 +++++ include/armnn/ILayerVisitor.hpp | 8 ++++++++ include/armnn/INetwork.hpp | 9 ++++++++- include/armnn/LayerVisitorBase.hpp | 4 ++++ 6 files changed, 45 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/armnn/Descriptors.hpp b/include/armnn/Descriptors.hpp index 5d0990e816..653e64701a 100644 --- a/include/armnn/Descriptors.hpp +++ b/include/armnn/Descriptors.hpp @@ -711,6 +711,25 @@ struct FakeQuantizationDescriptor float m_Max; }; +/// A FillDescriptor for the FillLayer +struct FillDescriptor +{ + FillDescriptor() + : m_Value(0) + {} + + FillDescriptor(const float& value) + : m_Value(value) + {} + + bool operator ==(const FillDescriptor& rhs) const + { + return m_Value == rhs.m_Value; + } + + float m_Value; +}; + /// A ResizeBilinearDescriptor for the ResizeBilinearLayer. struct ResizeBilinearDescriptor { diff --git a/include/armnn/DescriptorsFwd.hpp b/include/armnn/DescriptorsFwd.hpp index 1c813b534f..e31fb96aec 100644 --- a/include/armnn/DescriptorsFwd.hpp +++ b/include/armnn/DescriptorsFwd.hpp @@ -18,6 +18,7 @@ struct DepthwiseConvolution2dDescriptor; struct DetectionPostProcessDescriptor; struct ElementwiseUnaryDescriptor; struct FakeQuantizationDescriptor; +struct FillDescriptor; struct FullyConnectedDescriptor; struct InstanceNormalizationDescriptor; struct L2NormalizationDescriptor; diff --git a/include/armnn/ILayerSupport.hpp b/include/armnn/ILayerSupport.hpp index 58509c906c..33389eb25f 100644 --- a/include/armnn/ILayerSupport.hpp +++ b/include/armnn/ILayerSupport.hpp @@ -157,6 +157,11 @@ public: const FakeQuantizationDescriptor& descriptor, Optional reasonIfUnsupported = EmptyOptional()) const = 0; + virtual bool IsFillSupported(const TensorInfo& input, + const TensorInfo& output, + const FillDescriptor& descriptor, + Optional reasonIfUnsupported = EmptyOptional()) const = 0; + virtual bool IsFloorSupported(const TensorInfo& input, const TensorInfo& output, Optional reasonIfUnsupported = EmptyOptional()) const = 0; diff --git a/include/armnn/ILayerVisitor.hpp b/include/armnn/ILayerVisitor.hpp index 530e74f30a..aa5bdba33c 100644 --- a/include/armnn/ILayerVisitor.hpp +++ b/include/armnn/ILayerVisitor.hpp @@ -184,6 +184,14 @@ public: virtual void VisitEqualLayer(const IConnectableLayer* layer, const char* name = nullptr) = 0; + /// Function a fill 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 fillDescriptor - Description of the layer + /// @param name - Optional name for the layer. + virtual void VisitFillLayer(const IConnectableLayer* layer, + const FillDescriptor& fillDescriptor, + const char* name = nullptr) = 0; + /// Function a floor 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 name - Optional name for the layer. diff --git a/include/armnn/INetwork.hpp b/include/armnn/INetwork.hpp index 1dd949d038..ade6c52c90 100644 --- a/include/armnn/INetwork.hpp +++ b/include/armnn/INetwork.hpp @@ -213,10 +213,17 @@ public: /// Add an ElementwiseUnary layer to the network. /// @param name - Optional name for the layer. /// @param desc - Descriptor for the elementwiseUnary operation. - /// @ return - Interface for configuring the layer. + /// @return - Interface for configuring the layer. virtual IConnectableLayer* AddElementwiseUnaryLayer(const ElementwiseUnaryDescriptor& elementwiseUnaryDescriptor, const char* name = nullptr) = 0; + /// Add an Fill layer to the network. + /// @param name - Optional name for the layer. + /// @param fillDescriptor - Descriptor for the fill operation. + /// @return - Interface for configuring the layer. + virtual IConnectableLayer* AddFillLayer(const FillDescriptor& fillDescriptor, + const char* name = nullptr) = 0; + /// Adds a fully connected layer to the network. /// @param fullyConnectedDescriptor - Description of the fully connected layer. /// @param weights - Tensor for the weights data. diff --git a/include/armnn/LayerVisitorBase.hpp b/include/armnn/LayerVisitorBase.hpp index 95d6bd37bd..0dc5e545e3 100644 --- a/include/armnn/LayerVisitorBase.hpp +++ b/include/armnn/LayerVisitorBase.hpp @@ -101,6 +101,10 @@ public: void VisitEqualLayer(const IConnectableLayer*, const char*) override { DefaultPolicy::Apply(__func__); } + void VisitFillLayer(const IConnectableLayer*, + const FillDescriptor&, + const char*) override { DefaultPolicy::Apply(__func__); } + void VisitFloorLayer(const IConnectableLayer*, const char*) override { DefaultPolicy::Apply(__func__); } -- cgit v1.2.1