blob: 65e018a50a2ac9e1e06c2d7fde98fbda7f1700de [file] [log] [blame]
Anthony Barbier7068f992017-10-26 15:23:08 +01001/*
Georgios Pinitas7ae80a92019-10-25 18:25:17 +01002 * Copyright (c) 2017-2019 ARM Limited.
Anthony Barbier7068f992017-10-26 15:23:08 +01003 *
4 * SPDX-License-Identifier: MIT
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in all
14 * copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 */
Michalis Spyrouf4643372019-11-29 16:17:13 +000024#ifndef ARM_COMPUTE_GCACTIVATIONLAYERKERNEL_H
25#define ARM_COMPUTE_GCACTIVATIONLAYERKERNEL_H
Anthony Barbier7068f992017-10-26 15:23:08 +010026
27#include "arm_compute/core/GLES_COMPUTE/IGCKernel.h"
28
29namespace arm_compute
30{
Georgios Pinitas7ae80a92019-10-25 18:25:17 +010031// Forward declarations
Anthony Barbier7068f992017-10-26 15:23:08 +010032class IGCTensor;
Georgios Pinitas7ae80a92019-10-25 18:25:17 +010033class GCCoreRuntimeContext;
Anthony Barbier7068f992017-10-26 15:23:08 +010034
35/** Interface for the activation layer kernel. */
36class GCActivationLayerKernel : public IGCKernel
37{
38public:
Georgios Pinitas7ae80a92019-10-25 18:25:17 +010039 /** Default constructor
40 *
41 * @param[in, out] ctx Core context to use
42 */
43 explicit GCActivationLayerKernel(GCCoreRuntimeContext *ctx = nullptr);
Anthony Barbier7068f992017-10-26 15:23:08 +010044 /** Prevent instances of this class from being copied (As this class contains pointers) */
45 GCActivationLayerKernel(const GCActivationLayerKernel &) = delete;
46 /** Prevent instances of this class from being copied (As this class contains pointers) */
47 GCActivationLayerKernel &operator=(const GCActivationLayerKernel &) = delete;
48 /** Allow instances of this class to be moved */
49 GCActivationLayerKernel(GCActivationLayerKernel &&) = default;
50 /** Allow instances of this class to be moved */
51 GCActivationLayerKernel &operator=(GCActivationLayerKernel &&) = default;
52 /** Default destructor */
53 ~GCActivationLayerKernel() = default;
54 /** Set the input and output tensor.
55 *
56 * @note If the output tensor is a nullptr, the activation function will be performed in-place
57 *
58 * @param[in, out] input Source tensor. In case of @p output tensor = nullptr, this tensor will store the result
59 * of the activation function. Data types supported: F16/F32.
60 * @param[out] output Destination tensor. Data type should match the input data type.
61 * @param[in] act_info Activation layer information.
62 */
63 void configure(IGCTensor *input, IGCTensor *output, ActivationLayerInfo act_info);
64
65 // Inherited methods overridden:
66 void run(const Window &window) override;
67
68private:
Georgios Pinitas7ae80a92019-10-25 18:25:17 +010069 IGCTensor *_input;
70 IGCTensor *_output;
71 GCCoreRuntimeContext *_ctx;
Anthony Barbier7068f992017-10-26 15:23:08 +010072};
Georgios Pinitas7ae80a92019-10-25 18:25:17 +010073} // namespace arm_compute
Michalis Spyrouf4643372019-11-29 16:17:13 +000074#endif /*ARM_COMPUTE_GCACTIVATIONLAYERKERNEL_H */