diff options
author | josh minor <josh.minor@arm.com> | 2020-01-06 16:40:46 -0600 |
---|---|---|
committer | Derek Lamberti <derek.lamberti@arm.com> | 2020-01-23 14:29:14 +0000 |
commit | 4a3c61091037e7e86e8b03bb060d8c1ab82731a9 (patch) | |
tree | 928644023400ad5ac0c26b33dfff2f975567d6e8 /src/armnn/layers/ElementwiseUnaryLayer.hpp | |
parent | 190a39a4a9598e42b636ae4ab843761884148160 (diff) | |
download | armnn-4a3c61091037e7e86e8b03bb060d8c1ab82731a9.tar.gz |
IVGCVSW-4259 Add frontend and reference workload for UnaryOperationLayer
* Added new layer named ElementwiseUnary
* Deprecated existing Abs/Rsqrt layer functions
* Updated existing Abs/Rsqrt test infrastructure to use new layer
* Added boilerplate for new Exp,Neg,Sqrt elemwise op layers
* AbsQuantize test removed pending future commit
* Serialization support added
!android-nn-driver:2550
Change-Id: Ic595c645925e17b45db568187fd05646daf2e87f
Signed-off-by: josh minor <josh.minor@arm.com>
Diffstat (limited to 'src/armnn/layers/ElementwiseUnaryLayer.hpp')
-rw-r--r-- | src/armnn/layers/ElementwiseUnaryLayer.hpp | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/armnn/layers/ElementwiseUnaryLayer.hpp b/src/armnn/layers/ElementwiseUnaryLayer.hpp new file mode 100644 index 0000000000..850a814b6e --- /dev/null +++ b/src/armnn/layers/ElementwiseUnaryLayer.hpp @@ -0,0 +1,48 @@ +// +// Copyright © 2019 Arm Ltd. All rights reserved. +// SPDX-License-Identifier: MIT +// + +#pragma once + +#include "LayerWithParameters.hpp" + +namespace armnn +{ + +/// This layer represents a elementwiseUnary operation. +class ElementwiseUnaryLayer : public LayerWithParameters<ElementwiseUnaryDescriptor> +{ +public: + /// Makes a workload for the elementwiseUnary type + /// @param [in] graph The graph where this layer can be found + /// @param [in] factory The workload factory which will create the workload + /// @return A pointer to the created workload, or nullptr if not created + virtual std::unique_ptr<IWorkload> CreateWorkload(const IWorkloadFactory& factory) const override; + + /// Creates a dynamically-allocated copy of this layer + /// @param [in] graph The graph into which this layer is being cloned + ElementwiseUnaryLayer* Clone(Graph& graph) const override; + + /// Returns inputShapes by default. + /// @param [in] inputShapes The input shapes layer has. + /// @return A vector to the inferred output shape. + std::vector<TensorShape> InferOutputShapes(const std::vector<TensorShape>& inputShapes) const override; + + /// Check if the input tensor shape(s) will lead to a valid configuration + /// of @ref ElementwiseUnaryLayer + void ValidateTensorShapesFromInputs() override; + + void Accept(ILayerVisitor& visitor) const override; + +protected: + /// Constructor to create a ElementwiseUnaryLayer + /// @param [in] param ElementwiseUnaryDescriptor to configure the ElementwiseUnaryLayer + /// @param [in] name Optional name for the layer + ElementwiseUnaryLayer(const ElementwiseUnaryDescriptor& param, const char* name); + + /// Default destructor + ~ElementwiseUnaryLayer() = default; +}; + +} // namespace armnn |