From 3ae3f978cf9ce3174609b7152af87acb410b0fe0 Mon Sep 17 00:00:00 2001 From: Keith Davis Date: Fri, 21 May 2021 16:33:48 +0100 Subject: MLCE-510 Add CpuRef Shape Operator to ArmNN * Add front end * Add reference workload * Serialization/Deserialization * Add unit tests * Update ArmNN Versioning Signed-off-by: Keith Davis Change-Id: I6fcb1fa341d6f08dea4003b13544e6e9f53fefd3 --- include/armnn/BackendHelper.hpp | 4 ++++ include/armnn/DescriptorsFwd.hpp | 2 +- include/armnn/INetwork.hpp | 5 +++++ include/armnn/Types.hpp | 8 +++++--- include/armnn/Version.hpp | 2 +- include/armnn/backends/ILayerSupport.hpp | 4 ++++ 6 files changed, 20 insertions(+), 5 deletions(-) (limited to 'include/armnn') diff --git a/include/armnn/BackendHelper.hpp b/include/armnn/BackendHelper.hpp index 527d865694..093f822040 100644 --- a/include/armnn/BackendHelper.hpp +++ b/include/armnn/BackendHelper.hpp @@ -359,6 +359,10 @@ public: const TensorInfo& output, Optional reasonIfUnsupported = EmptyOptional()); + bool IsShapeSupported(const TensorInfo& input, + const TensorInfo& output, + Optional reasonIfUnsupported = EmptyOptional()); + bool IsSliceSupported(const TensorInfo& input, const TensorInfo& output, const SliceDescriptor& descriptor, diff --git a/include/armnn/DescriptorsFwd.hpp b/include/armnn/DescriptorsFwd.hpp index 4e7082e88f..9b22644c7b 100644 --- a/include/armnn/DescriptorsFwd.hpp +++ b/include/armnn/DescriptorsFwd.hpp @@ -38,10 +38,10 @@ struct ReshapeDescriptor; struct ResizeBilinearDescriptor; struct ResizeDescriptor; struct ReduceDescriptor; +struct SliceDescriptor; struct SoftmaxDescriptor; struct SpaceToBatchNdDescriptor; struct SpaceToDepthDescriptor; -struct SliceDescriptor; struct StackDescriptor; struct StandInDescriptor; struct StridedSliceDescriptor; diff --git a/include/armnn/INetwork.hpp b/include/armnn/INetwork.hpp index 8d94ed77f6..3c45262f1d 100644 --- a/include/armnn/INetwork.hpp +++ b/include/armnn/INetwork.hpp @@ -506,6 +506,11 @@ public: IConnectableLayer* AddReshapeLayer(const ReshapeDescriptor& reshapeDescriptor, const char* name = nullptr); + /// Adds a shape layer to the network. + /// @param name - Optional name for the layer. + /// @return - Interface for configuring the layer. + IConnectableLayer* AddShapeLayer(const char* name = nullptr); + /// Adds a space to batch layer to the network. /// @param spaceToBatchNdDescriptor - Parameters for the space to batch operation. /// @param name - Optional name for the layer. diff --git a/include/armnn/Types.hpp b/include/armnn/Types.hpp index ac4dd31999..e7c17608ca 100644 --- a/include/armnn/Types.hpp +++ b/include/armnn/Types.hpp @@ -332,7 +332,8 @@ using InferenceTimingPair = std::pair; X(Addition) \ X(ArgMinMax) \ X(BatchNormalization) \ - X(BatchToSpaceNd) \ + X(BatchToSpaceNd) \ + X(Cast) \ X(Comparison) \ X(Concat) \ X(Constant) \ @@ -381,6 +382,7 @@ using InferenceTimingPair = std::pair; X(Rank) \ X(Resize) \ X(Reduce) \ + X(Shape) \ X(Slice) \ X(Softmax) \ X(SpaceToBatchNd) \ @@ -394,7 +396,7 @@ using InferenceTimingPair = std::pair; X(Transpose) \ X(TransposeConvolution2d) \ X(Unmap) \ - X(Cast) + /// When adding a new layer, adapt also the LastLayer enum value in the /// enum class LayerType below enum class LayerType @@ -403,7 +405,7 @@ enum class LayerType LIST_OF_LAYER_TYPE #undef X FirstLayer = Activation, - LastLayer = Cast + LastLayer = Unmap }; const char* GetLayerTypeAsCString(LayerType type); diff --git a/include/armnn/Version.hpp b/include/armnn/Version.hpp index 2139637b5b..5347097982 100644 --- a/include/armnn/Version.hpp +++ b/include/armnn/Version.hpp @@ -10,7 +10,7 @@ #define STRINGIFY_MACRO(s) #s // ArmNN version components -#define ARMNN_MAJOR_VERSION 25 +#define ARMNN_MAJOR_VERSION 26 #define ARMNN_MINOR_VERSION 0 #define ARMNN_PATCH_VERSION 0 diff --git a/include/armnn/backends/ILayerSupport.hpp b/include/armnn/backends/ILayerSupport.hpp index 52b6df7117..462668d738 100644 --- a/include/armnn/backends/ILayerSupport.hpp +++ b/include/armnn/backends/ILayerSupport.hpp @@ -351,6 +351,10 @@ public: const TensorInfo& output, Optional reasonIfUnsupported = EmptyOptional()) const = 0; + virtual bool IsShapeSupported(const TensorInfo& input, + const TensorInfo& output, + Optional reasonIfUnsupported = EmptyOptional()) const = 0; + virtual bool IsSliceSupported(const TensorInfo& input, const TensorInfo& output, const SliceDescriptor& descriptor, -- cgit v1.2.1