From 79a06a59bafadf736ca53c4240e87f9bbb657260 Mon Sep 17 00:00:00 2001 From: Teresa Charlin Date: Thu, 13 Jul 2023 17:16:45 +0100 Subject: IVGCVSW-7883 Front end and reference implementation for TILE Signed-off-by: Teresa Charlin Signed-off-by: Cian McGriskin Change-Id: I0afb2403fee11c5c1e58ea65e2525e99594d8f2d --- include/armnn/BackendHelper.hpp | 5 +++++ include/armnn/Descriptors.hpp | 19 +++++++++++++++++++ include/armnn/DescriptorsFwd.hpp | 1 + include/armnn/INetwork.hpp | 27 +++++++++++++++++---------- include/armnn/Types.hpp | 3 ++- include/armnn/backends/WorkloadData.hpp | 5 +++++ 6 files changed, 49 insertions(+), 11 deletions(-) (limited to 'include') diff --git a/include/armnn/BackendHelper.hpp b/include/armnn/BackendHelper.hpp index 6181ba5c40..b550f9f68e 100644 --- a/include/armnn/BackendHelper.hpp +++ b/include/armnn/BackendHelper.hpp @@ -422,6 +422,11 @@ public: const TensorInfo& output1, Optional reasonIfUnsupported = EmptyOptional()); + bool IsTileSupported(const TensorInfo& input, + const TensorInfo& output, + const TileDescriptor& descriptor, + Optional reasonIfUnsupported = EmptyOptional()); + bool IsTransposeConvolution2dSupported( const TensorInfo& input, const TensorInfo& output, diff --git a/include/armnn/Descriptors.hpp b/include/armnn/Descriptors.hpp index 9ff894f1b0..3a571a66e8 100644 --- a/include/armnn/Descriptors.hpp +++ b/include/armnn/Descriptors.hpp @@ -1620,4 +1620,23 @@ struct BatchMatMulDescriptor : BaseDescriptor const TensorShape& tensorShape); }; +struct TileDescriptor : BaseDescriptor +{ + TileDescriptor() + : m_Multiples() + {} + + explicit TileDescriptor(std::vector multiples) + : m_Multiples(std::move(multiples)) + {} + + bool operator ==(const TileDescriptor& rhs) const + { + return m_Multiples == rhs.m_Multiples; + } + + /// The vector to multiply the input shape by + std::vector m_Multiples; +}; + } // namespace armnn diff --git a/include/armnn/DescriptorsFwd.hpp b/include/armnn/DescriptorsFwd.hpp index 2c25a49f00..be1a3f6782 100644 --- a/include/armnn/DescriptorsFwd.hpp +++ b/include/armnn/DescriptorsFwd.hpp @@ -49,6 +49,7 @@ struct SpaceToDepthDescriptor; struct StackDescriptor; struct StandInDescriptor; struct StridedSliceDescriptor; +struct TileDescriptor; struct TransposeConvolution2dDescriptor; struct TransposeDescriptor; struct ViewsDescriptor; diff --git a/include/armnn/INetwork.hpp b/include/armnn/INetwork.hpp index e20dd1c348..830e0bac66 100644 --- a/include/armnn/INetwork.hpp +++ b/include/armnn/INetwork.hpp @@ -740,7 +740,7 @@ public: /// @param name - Optional name for the layer. /// @return - Interface for configuring the layer. IConnectableLayer* AddGatherLayer(const GatherDescriptor& descriptor, - const char* name = nullptr); + const char* name = nullptr); /// Add GatherNd layer to the network. /// @param name - Optional name for the layer. @@ -764,23 +764,23 @@ public: /// @param name - Optional name for the layer. /// @return - Interface for configuring the layer. IConnectableLayer* AddTransposeConvolution2dLayer(const TransposeConvolution2dDescriptor& descriptor, - const ConstTensor& weights, - const Optional& biases, - const char* name = nullptr); + const ConstTensor& weights, + const Optional& biases, + const char* name = nullptr); /// Adds a transpose layer to the network. /// @param transposeDescriptor - TransposeDescriptor to configure the transpose. /// @param name - Optional name for the layer. /// @return - Interface for configuring the layer. IConnectableLayer* AddTransposeLayer(const TransposeDescriptor& transposeDescriptor, - const char* name = nullptr); + const char* name = nullptr); /// Adds a stack layer to the network. /// @param descriptor - Description of the stack layer. /// @param name - Optional name for the layer. /// @return - Interface for configuring the layer. IConnectableLayer* AddStackLayer(const StackDescriptor& descriptor, - const char* name = nullptr); + const char* name = nullptr); /// 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. @@ -789,14 +789,14 @@ public: /// @descriptor - Descriptor for the StandIn layer. /// @return - Interface for configuring the layer. IConnectableLayer* AddStandInLayer(const StandInDescriptor& descriptor, - const char* name = nullptr); + const char* name = nullptr); /// 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 /// @return - Interface for configuring the layer. IConnectableLayer* AddQuantizedLstmLayer(const QuantizedLstmInputParams& params, - const char* name = nullptr); + const char* name = nullptr); /// Add a QLstm layer to the network /// @param descriptor - Parameters for the QLstm operation @@ -804,8 +804,8 @@ public: /// @param name - Optional name for the layer /// @return - Interface for configuring the layer. IConnectableLayer* AddQLstmLayer(const QLstmDescriptor& descriptor, - const LstmInputParams& params, - const char* name = nullptr); + const LstmInputParams& params, + const char* name = nullptr); /// Adds a Logical Binary layer to the network. /// @param descriptor - Description of the Logical Binary layer. @@ -842,6 +842,13 @@ public: /// @return - Interface for configuring the layer IConnectableLayer* AddReverseV2Layer(const char* name = nullptr); + /// Add a Tile layer to the network + /// @param descriptor - Parameters for the Tile operation + /// @param name - Optional name for the layer + /// @return - Interface for configuring the layer + IConnectableLayer* AddTileLayer(const TileDescriptor& descriptor, + const char* name = nullptr); + void ExecuteStrategy(IStrategy& strategy) const; protected: diff --git a/include/armnn/Types.hpp b/include/armnn/Types.hpp index f05f05b2a0..bf4458ee7f 100644 --- a/include/armnn/Types.hpp +++ b/include/armnn/Types.hpp @@ -474,6 +474,7 @@ using InferenceTimingPair = std::pair; X(BatchMatMul) \ X(ElementwiseBinary) \ X(ReverseV2) \ + X(Tile) \ // New layers should be added at last position to minimize instability. @@ -485,7 +486,7 @@ enum class LayerType LIST_OF_LAYER_TYPE #undef X FirstLayer = Activation, - LastLayer = ElementwiseBinary + LastLayer = Tile }; const char* GetLayerTypeAsCString(LayerType type); diff --git a/include/armnn/backends/WorkloadData.hpp b/include/armnn/backends/WorkloadData.hpp index e7d5e0e689..21a597df8a 100644 --- a/include/armnn/backends/WorkloadData.hpp +++ b/include/armnn/backends/WorkloadData.hpp @@ -755,4 +755,9 @@ struct ReverseV2QueueDescriptor : QueueDescriptor void Validate(const WorkloadInfo& workloadInfo) const; }; +struct TileQueueDescriptor : QueueDescriptorWithParameters +{ + void Validate(const WorkloadInfo& workloadInfo) const; +}; + } // namespace armnn -- cgit v1.2.1