From 013c390c2d9829fede2d8b1d59c3f2a497730462 Mon Sep 17 00:00:00 2001 From: Derek Lamberti Date: Mon, 21 Oct 2019 10:46:16 +0100 Subject: IVGCVSW-4009 StandInLayer frontend API Change-Id: I058c57b554769799c6775813215070ef47790e3d Signed-off-by: Derek Lamberti --- include/armnn/Descriptors.hpp | 16 ++++++++++++++++ include/armnn/DescriptorsFwd.hpp | 1 + include/armnn/ILayerSupport.hpp | 6 ++++++ include/armnn/ILayerVisitor.hpp | 8 ++++++++ include/armnn/INetwork.hpp | 10 ++++++++++ include/armnn/LayerVisitorBase.hpp | 4 ++++ 6 files changed, 45 insertions(+) (limited to 'include/armnn') diff --git a/include/armnn/Descriptors.hpp b/include/armnn/Descriptors.hpp index 10d8ab7a08..425c5261df 100644 --- a/include/armnn/Descriptors.hpp +++ b/include/armnn/Descriptors.hpp @@ -952,6 +952,22 @@ struct StackDescriptor TensorShape m_InputShape; }; +/// A StandInDescriptor for the StandIn layer +struct StandInDescriptor +{ + StandInDescriptor() {}; + + StandInDescriptor(uint32_t numInputs, uint32_t numOutputs) + : m_NumInputs(numInputs) + , m_NumOutputs(numOutputs) + {} + + /// Number of input tensors + uint32_t m_NumInputs = 0; + /// Number of output tensors + uint32_t m_NumOutputs = 0; +}; + /// A StridedSliceDescriptor for the StridedSliceLayer. struct StridedSliceDescriptor { diff --git a/include/armnn/DescriptorsFwd.hpp b/include/armnn/DescriptorsFwd.hpp index a978f7739a..cfdef8a030 100644 --- a/include/armnn/DescriptorsFwd.hpp +++ b/include/armnn/DescriptorsFwd.hpp @@ -36,6 +36,7 @@ struct SpaceToBatchNdDescriptor; struct SpaceToDepthDescriptor; struct SliceDescriptor; struct StackDescriptor; +struct StandInDescriptor; struct StridedSliceDescriptor; struct TransposeConvolution2dDescriptor; struct ViewsDescriptor; diff --git a/include/armnn/ILayerSupport.hpp b/include/armnn/ILayerSupport.hpp index 87197eed5a..54f4a2883b 100644 --- a/include/armnn/ILayerSupport.hpp +++ b/include/armnn/ILayerSupport.hpp @@ -328,6 +328,12 @@ public: const StackDescriptor& descriptor, Optional reasonIfUnsupported = EmptyOptional()) const = 0; + virtual bool IsStandInSupported(const std::vector& inputs, + const std::vector& outputs, + const StandInDescriptor& descriptor, + Optional reasonIfUnsupported = EmptyOptional()) const = 0; + + virtual bool IsStridedSliceSupported(const TensorInfo& input, const TensorInfo& output, const StridedSliceDescriptor& descriptor, diff --git a/include/armnn/ILayerVisitor.hpp b/include/armnn/ILayerVisitor.hpp index 80931ebcc0..9669b3a7cb 100644 --- a/include/armnn/ILayerVisitor.hpp +++ b/include/armnn/ILayerVisitor.hpp @@ -443,6 +443,14 @@ public: const StackDescriptor& stackDescriptor, const char* name = nullptr) = 0; + /// Function a StandInLayer should call back to when its Accept(ILaterVisitor&) function is invoked + /// @param layer - pointer to the layer which is calling back to this visit function. + /// @param standInDescriptor - Parameters for the stand-in layer. + /// @param name - Optional name for the layer. + virtual void VisitStandInLayer(const IConnectableLayer* layer, + const StandInDescriptor& standInDescriptor, + const char* name = nullptr) = 0; + /// Function a strided slice 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 stridedSliceDescriptor - Parameters for the strided slice operation. diff --git a/include/armnn/INetwork.hpp b/include/armnn/INetwork.hpp index b3fab82cb4..10414923e8 100644 --- a/include/armnn/INetwork.hpp +++ b/include/armnn/INetwork.hpp @@ -507,6 +507,16 @@ public: virtual IConnectableLayer* AddStackLayer(const StackDescriptor& descriptor, const char* name = nullptr) = 0; + + /// Add a stand-in layer for a type unknown to the Arm NN framework. + /// Note: Due to the nature of this layer, no validation can be performed by the framework. + /// Furthermore, Any model containing this layer cannot make use of dynamic tensors since the + /// tensor sizes cannot be inferred. + /// @descriptor - Descriptor for the StandIn layer. + /// @return - Interface for configuring the layer. + virtual IConnectableLayer* AddStandInLayer(const StandInDescriptor& descriptor, + const char* name = nullptr) = 0; + /// Add a QuantizedLstm layer to the network /// @param params - The weights and biases for the Quantized LSTM cell /// @param name - Optional name for the layer diff --git a/include/armnn/LayerVisitorBase.hpp b/include/armnn/LayerVisitorBase.hpp index 5226fa2f66..388fc6f922 100644 --- a/include/armnn/LayerVisitorBase.hpp +++ b/include/armnn/LayerVisitorBase.hpp @@ -222,6 +222,10 @@ public: const StackDescriptor&, const char*) override { DefaultPolicy::Apply(__func__); } + void VisitStandInLayer(const IConnectableLayer*, + const StandInDescriptor&, + const char*) override { DefaultPolicy::Apply(__func__); } + void VisitStridedSliceLayer(const IConnectableLayer*, const StridedSliceDescriptor&, const char*) override { DefaultPolicy::Apply(__func__); } -- cgit v1.2.1