diff options
author | Mike Kelly <mike.kelly@arm.com> | 2023-03-08 13:47:17 +0000 |
---|---|---|
committer | Francis Murtagh <francis.murtagh@arm.com> | 2023-03-14 16:40:09 +0000 |
commit | 3ec3077b4eaedcc0c20ab5774bdbe365da541445 (patch) | |
tree | d601d2000897dec8691bf64cbddc9036f26b8034 /src/armnn/layers/ElementwiseBinaryLayer.hpp | |
parent | a088cd00b3cce672d26cdcb4965fc2a86b48f339 (diff) | |
download | armnn-3ec3077b4eaedcc0c20ab5774bdbe365da541445.tar.gz |
IVGCVSW-3808 Add ElementwiseBinaryLayer
!android-nn-driver:9329
* Added ElementwiseBinaryLayer that can represent all ElementwiseBinary
operations including Add, Div, Sub, Maximum, Mul and Minimum.
* Updated Delegate to use ElementwiseBinaryLayer instead of the Add,
Div, Sub, Maximum, Mul and Minimum layers.
* Updated Deserializer to use ElementwiseBinaryLayer instead of the Add,
Div, Sub, Maximum, Mul and Minimum layers.
* Updated OnnxParser to use ElementwiseBinaryLayer instead of the Add
layer.
* Updated TfLiteParser to use ElementwiseBinaryLayer instead of the Add,
Div, Sub, Maximum, Mul and Minimum layers.
* Updated CL and Neon tests to use ElementwiseBinaryLayer.
* Updated CL and Neon Backend Specific Optimizations to accept
ElementBinaryLayers as well as Add, Div, Mul, Sub, Maximum and Minimum
layers.
Signed-off-by: Teresa Charlin <teresa.charlinreyes@arm.com>
Signed-off-by: Mike Kelly <mike.kelly@arm.com>
Change-Id: I7cbb96b60eb01f0e2b57b0541016d48a08b86c75
Diffstat (limited to 'src/armnn/layers/ElementwiseBinaryLayer.hpp')
-rw-r--r-- | src/armnn/layers/ElementwiseBinaryLayer.hpp | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/armnn/layers/ElementwiseBinaryLayer.hpp b/src/armnn/layers/ElementwiseBinaryLayer.hpp new file mode 100644 index 0000000000..78e3f41f9e --- /dev/null +++ b/src/armnn/layers/ElementwiseBinaryLayer.hpp @@ -0,0 +1,48 @@ +// +// Copyright © 2023 Arm Ltd and Contributors. All rights reserved. +// SPDX-License-Identifier: MIT +// + +#pragma once + +#include "LayerWithParameters.hpp" + +namespace armnn +{ + +/// This layer represents a elementwiseBinary operation. +class ElementwiseBinaryLayer : public LayerWithParameters<ElementwiseBinaryDescriptor> +{ +public: + /// Makes a workload for the elementwiseBinary 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 + ElementwiseBinaryLayer* 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 ElementwiseBinaryLayer + void ValidateTensorShapesFromInputs() override; + + void ExecuteStrategy(IStrategy& strategy) const override; + +protected: + /// Constructor to create a ElementwiseBinaryLayer + /// @param [in] param ElementwiseBinaryDescriptor to configure the ElementwiseBinaryLayer + /// @param [in] name Optional name for the layer + ElementwiseBinaryLayer(const ElementwiseBinaryDescriptor& param, const char* name); + + /// Default destructor + ~ElementwiseBinaryLayer() = default; +}; + +} // namespace armnn |