From 1f88630874fe346cd0cca8d8e38e0fb96cc1a3f4 Mon Sep 17 00:00:00 2001 From: Nattapat Chaimanowong Date: Fri, 5 Apr 2019 13:37:19 +0100 Subject: IVGCVSW-2915 Add Merge Layer and no-op factory method Change-Id: I54549671e0d3b207904cf9796a843eb2b0a631f7 Signed-off-by: Nattapat Chaimanowong --- include/armnn/ILayerSupport.hpp | 5 +++++ include/armnn/ILayerVisitor.hpp | 8 +++++++- include/armnn/INetwork.hpp | 5 +++++ include/armnn/LayerSupport.hpp | 8 ++++++++ include/armnn/LayerVisitorBase.hpp | 3 +++ 5 files changed, 28 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/armnn/ILayerSupport.hpp b/include/armnn/ILayerSupport.hpp index fe440719b0..1b75810aca 100644 --- a/include/armnn/ILayerSupport.hpp +++ b/include/armnn/ILayerSupport.hpp @@ -171,6 +171,11 @@ public: const TensorInfo& output, Optional reasonIfUnsupported = EmptyOptional()) const = 0; + virtual bool IsMergeSupported(const TensorInfo& input0, + const TensorInfo& input1, + const TensorInfo& output, + Optional reasonIfUnsupported = EmptyOptional()) const = 0; + virtual bool IsMergerSupported(const std::vector inputs, const TensorInfo& output, const OriginsDescriptor& descriptor, diff --git a/include/armnn/ILayerVisitor.hpp b/include/armnn/ILayerVisitor.hpp index e23cf5e6dd..3a4c39b7c6 100644 --- a/include/armnn/ILayerVisitor.hpp +++ b/include/armnn/ILayerVisitor.hpp @@ -199,6 +199,12 @@ public: const MeanDescriptor& meanDescriptor, const char* name = nullptr) = 0; + /// Function that a merge 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. + virtual void VisitMergeLayer(const IConnectableLayer* layer, + const char* name = nullptr) = 0; + /// Function that a merger 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 mergerDescriptor - WindowsDescriptor to configure the merging process. Number of Views must be equal to @@ -337,4 +343,4 @@ public: }; -} // namespace armnn \ No newline at end of file +} // namespace armnn diff --git a/include/armnn/INetwork.hpp b/include/armnn/INetwork.hpp index 5a9d4f246e..8243b39c36 100644 --- a/include/armnn/INetwork.hpp +++ b/include/armnn/INetwork.hpp @@ -235,6 +235,11 @@ public: virtual IConnectableLayer* AddSplitterLayer(const ViewsDescriptor& splitterDescriptor , const char* name = nullptr) = 0; + /// Adds a merge layer to the network. + /// @param name - Optional name for the layer. + /// @return - Interface for configuring the layer. + virtual IConnectableLayer* AddMergeLayer(const char* name = nullptr) = 0; + /// Adds a merger layer to the network. /// @param mergerDescriptor - WindowsDescriptor to configure the merging process. Number of Views must be equal to /// the number of inputs, and their order must match - e.g. first view corresponds to diff --git a/include/armnn/LayerSupport.hpp b/include/armnn/LayerSupport.hpp index 7c6bc1372a..e23fdd0a75 100644 --- a/include/armnn/LayerSupport.hpp +++ b/include/armnn/LayerSupport.hpp @@ -203,6 +203,14 @@ bool IsMemCopySupported(const BackendId& backend, char* reasonIfUnsupported = nullptr, size_t reasonIfUnsupportedMaxLength = 1024); +/// Deprecated in favor of IBackend and ILayerSupport interfaces +bool IsMergeSupported(const BackendId& backend, + const TensorInfo& input0, + const TensorInfo& input1, + const TensorInfo& output, + char* reasonIfUnsupported = nullptr, + size_t reasonIfUnsupportedMaxLength = 1024); + /// Deprecated in favor of IBackend and ILayerSupport interfaces bool IsMergerSupported(const BackendId& backend, const std::vector inputs, diff --git a/include/armnn/LayerVisitorBase.hpp b/include/armnn/LayerVisitorBase.hpp index a5459e1a32..f4e0f438be 100644 --- a/include/armnn/LayerVisitorBase.hpp +++ b/include/armnn/LayerVisitorBase.hpp @@ -87,6 +87,9 @@ public: const ViewsDescriptor&, const char*) override { DefaultPolicy::Apply(); } + void VisitMergeLayer(const IConnectableLayer*, + const char*) override { DefaultPolicy::Apply(); } + void VisitMergerLayer(const IConnectableLayer*, const OriginsDescriptor&, const char*) override { DefaultPolicy::Apply(); } -- cgit v1.2.1