blob: e2503f7bdfd9b2002c6a8aecb051148a2f7663f1 [file] [log] [blame]
Michalis Spyroue9362622018-11-23 17:41:37 +00001/*
Usama Arifeb312ef2019-05-13 17:45:54 +01002 * Copyright (c) 2018-2019 ARM Limited.
Michalis Spyroue9362622018-11-23 17:41:37 +00003 *
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_CLELEMENTWISEUNARYLAYER_H
25#define ARM_COMPUTE_CLELEMENTWISEUNARYLAYER_H
Michalis Spyroue9362622018-11-23 17:41:37 +000026
27#include "arm_compute/runtime/CL/ICLSimpleFunction.h"
28
29namespace arm_compute
30{
31class ICLTensor;
32
33/** Basic function to perform inverse square root on an input tensor. */
34class CLRsqrtLayer : public ICLSimpleFunction
35{
36public:
37 /** Initialize the function
38 *
39 * @param[in] input Input tensor. Data types supported: F16/F32.
40 * @param[out] output Output tensor. Data types supported: same as @p input.
41 */
42 void configure(const ICLTensor *input, ICLTensor *output);
43 /** Static function to check if given info will lead to a valid configuration of @ref CLRsqrtLayer
44 *
45 * @param[in] input First tensor input info. Data types supported: F16/F32.
46 * @param[in] output Output tensor info. Data types supported: Same as @p input.
47 *
48 * @return a status
49 */
50 static Status validate(const ITensorInfo *input, const ITensorInfo *output);
51};
52
53/** Basic function to perform exponential on an input tensor. */
54class CLExpLayer : public ICLSimpleFunction
55{
56public:
57 /** Initialize the function
58 *
59 * @param[in] input Input tensor. Data types supported: F16/F32.
60 * @param[out] output Output tensor. Data types supported: same as @p input.
61 */
62 void configure(const ICLTensor *input, ICLTensor *output);
63 /** Static function to check if given info will lead to a valid configuration of @ref CLExpLayer
64 *
65 * @param[in] input First tensor input info. Data types supported: F16/F32.
66 * @param[in] output Output tensor info. Data types supported: Same as @p input.
67 *
68 * @return a status
69 */
70 static Status validate(const ITensorInfo *input, const ITensorInfo *output);
71};
Usama Arifeb312ef2019-05-13 17:45:54 +010072
73/** Basic function to negate an input tensor. */
74class CLNegLayer : public ICLSimpleFunction
75{
76public:
77 /** Initialize the function
78 *
79 * @param[in] input Input tensor. Data types supported: F16/F32.
80 * @param[out] output Output tensor. Data types supported: same as @p input.
81 */
82 void configure(const ICLTensor *input, ICLTensor *output);
83 /** Static function to check if given info will lead to a valid configuration of @ref CLNegLayer
84 *
85 * @param[in] input First tensor input info. Data types supported: F16/F32.
86 * @param[in] output Output tensor info. Data types supported: Same as @p input.
87 *
88 * @return a status
89 */
90 static Status validate(const ITensorInfo *input, const ITensorInfo *output);
91};
Michalis Spyrou0af44182019-05-17 14:04:47 +010092
93/** Basic function to calculate sine of an input tensor. */
94class CLSinLayer : public ICLSimpleFunction
95{
96public:
97 /** Initialize the function
98 *
99 * @param[in] input Input tensor. Data types supported: F16/F32.
100 * @param[out] output Output tensor. Data types supported: same as @p input.
101 */
102 void configure(const ICLTensor *input, ICLTensor *output);
103 /** Static function to check if given info will lead to a valid configuration of @ref CLSinLayer
104 *
105 * @param[in] input First tensor input info. Data types supported: F16/F32.
106 * @param[in] output Output tensor info. Data types supported: Same as @p input.
107 *
108 * @return a status
109 */
110 static Status validate(const ITensorInfo *input, const ITensorInfo *output);
111};
giuros01f24411f2019-05-16 11:47:13 +0100112
Usama Arifac33d7e2019-05-20 14:21:40 +0100113/** Basic function to perform elementwise log on an input tensor. */
114class CLLogLayer : public ICLSimpleFunction
115{
116public:
117 /** Initialize the function
118 *
119 * @param[in] input Input tensor. Data types supported: F16/F32.
120 * @param[out] output Output tensor. Data types supported: same as @p input.
121 */
122 void configure(const ICLTensor *input, ICLTensor *output);
123 /** Static function to check if given info will lead to a valid configuration of @ref CLLogLayer
124 *
125 * @param[in] input First tensor input info. Data types supported: F16/F32.
126 * @param[in] output Output tensor info. Data types supported: Same as @p input.
127 *
128 * @return a status
129 */
130 static Status validate(const ITensorInfo *input, const ITensorInfo *output);
131};
132
giuros01f24411f2019-05-16 11:47:13 +0100133/** Basic function to get the absolute value of an input tensor. */
134class CLAbsLayer : public ICLSimpleFunction
135{
136public:
137 /** Initialize the function
138 *
139 * @param[in] input Input tensor. Data types supported: F16/F32.
140 * @param[out] output Output tensor. Data types supported: same as @p input.
141 */
142 void configure(const ICLTensor *input, ICLTensor *output);
143 /** Static function to check if given info will lead to a valid configuration of @ref CLAbsLayer
144 *
145 * @param[in] input First tensor input info. Data types supported: F16/F32.
146 * @param[in] output Output tensor info. Data types supported: Same as @p input.
147 *
148 * @return a status
149 */
150 static Status validate(const ITensorInfo *input, const ITensorInfo *output);
151};
Usama Arif6a4d5422019-05-24 14:53:59 +0100152
153/** Basic function to get the round (to the nearest even) value of an input tensor. */
154class CLRoundLayer : public ICLSimpleFunction
155{
156public:
157 /** Initialize the function
158 *
159 * @param[in] input Input tensor. Data types supported: F16/F32.
160 * @param[out] output Output tensor. Data types supported: same as @p input.
161 */
162 void configure(const ICLTensor *input, ICLTensor *output);
163 /** Static function to check if given info will lead to a valid configuration of @ref CLRoundLayer
164 *
165 * @param[in] input First tensor input info. Data types supported: F16/F32.
166 * @param[in] output Output tensor info. Data types supported: Same as @p input.
167 *
168 * @return a status
169 */
170 static Status validate(const ITensorInfo *input, const ITensorInfo *output);
171};
Michalis Spyroue9362622018-11-23 17:41:37 +0000172} // namespace arm_compute
Michalis Spyrouf4643372019-11-29 16:17:13 +0000173#endif /* ARM_COMPUTE_CLELEMENTWISEUNARYLAYER_H */