xref: /aosp_15_r20/external/armnn/src/armnn/layers/ActivationLayer.hpp (revision 89c4ff92f2867872bb9e2354d150bf0c8c502810)
1 //
2 // Copyright © 2017 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 #pragma once
6 
7 #include "LayerWithParameters.hpp"
8 
9 namespace armnn
10 {
11 /// This layer represents an activation operation with the specified activation function.
12 class ActivationLayer : public LayerWithParameters<ActivationDescriptor>
13 {
14 public:
15     /// Makes a workload for the Activation type.
16     /// @param [in] graph The graph where this layer can be found.
17     /// @param [in] factory The workload factory which will create the workload.
18     /// @return A pointer to the created workload, or nullptr if not created.
19     virtual std::unique_ptr<IWorkload> CreateWorkload(const IWorkloadFactory& factory) const override;
20 
21     /// Creates a dynamically-allocated copy of this layer.
22     /// @param [in] graph The graph into which this layer is being cloned.
23     ActivationLayer* Clone(Graph& graph) const override;
24 
25     /// Check if the input tensor shape(s) will lead to a valid configuration of @ref ActivationLayer.
26     /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validated.
27     void ValidateTensorShapesFromInputs() override;
28 
29     void ExecuteStrategy(IStrategy& strategy) const override;
30 
31 protected:
32     /// Constructor to create an ActivationLayer.
33     /// @param [in] param ActivationDescriptor to configure the activation operation.
34     /// @param [in] name Optional name for the layer.
35     ActivationLayer(const ActivationDescriptor &param, const char* name);
36 
37     /// Default destructor
38     ~ActivationLayer() = default;
39 };
40 
41 } // namespace
42