blob: de8b8f7843834bd288ea42cc590a295b1757f430 [file] [log] [blame]
Michalis Spyroue9362622018-11-23 17:41:37 +00001/*
Michele Di Giorgiod9eaf612020-07-08 11:12:57 +01002 * Copyright (c) 2018-2020 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);
Manuel Bottini2b84be52020-04-08 10:15:51 +010043 /** Initialize the function
44 *
45 * @param[in] compile_context The compile context to be used.
46 * @param[in] input Input tensor. Data types supported: F16/F32.
47 * @param[out] output Output tensor. Data types supported: same as @p input.
48 */
49 void configure(const CLCompileContext &compile_context, const ICLTensor *input, ICLTensor *output);
Michalis Spyroue9362622018-11-23 17:41:37 +000050 /** Static function to check if given info will lead to a valid configuration of @ref CLRsqrtLayer
51 *
52 * @param[in] input First tensor input info. Data types supported: F16/F32.
53 * @param[in] output Output tensor info. Data types supported: Same as @p input.
54 *
55 * @return a status
56 */
57 static Status validate(const ITensorInfo *input, const ITensorInfo *output);
58};
59
60/** Basic function to perform exponential on an input tensor. */
61class CLExpLayer : public ICLSimpleFunction
62{
63public:
64 /** Initialize the function
65 *
66 * @param[in] input Input tensor. Data types supported: F16/F32.
67 * @param[out] output Output tensor. Data types supported: same as @p input.
68 */
69 void configure(const ICLTensor *input, ICLTensor *output);
Manuel Bottini2b84be52020-04-08 10:15:51 +010070 /** Initialize the function
71 *
72 * @param[in] compile_context The compile context to be used.
73 * @param[in] input Input tensor. Data types supported: F16/F32.
74 * @param[out] output Output tensor. Data types supported: same as @p input.
75 */
76 void configure(const CLCompileContext &compile_context, const ICLTensor *input, ICLTensor *output);
Michalis Spyroue9362622018-11-23 17:41:37 +000077 /** Static function to check if given info will lead to a valid configuration of @ref CLExpLayer
78 *
79 * @param[in] input First tensor input info. Data types supported: F16/F32.
80 * @param[in] output Output tensor info. Data types supported: Same as @p input.
81 *
82 * @return a status
83 */
84 static Status validate(const ITensorInfo *input, const ITensorInfo *output);
85};
Usama Arifeb312ef2019-05-13 17:45:54 +010086
87/** Basic function to negate an input tensor. */
88class CLNegLayer : public ICLSimpleFunction
89{
90public:
91 /** Initialize the function
92 *
93 * @param[in] input Input tensor. Data types supported: F16/F32.
94 * @param[out] output Output tensor. Data types supported: same as @p input.
95 */
96 void configure(const ICLTensor *input, ICLTensor *output);
Manuel Bottini2b84be52020-04-08 10:15:51 +010097 /** Initialize the function
98 *
99 * @param[in] compile_context The compile context to be used.
100 * @param[in] input Input tensor. Data types supported: F16/F32.
101 * @param[out] output Output tensor. Data types supported: same as @p input.
102 */
103 void configure(const CLCompileContext &compile_context, const ICLTensor *input, ICLTensor *output);
Usama Arifeb312ef2019-05-13 17:45:54 +0100104 /** Static function to check if given info will lead to a valid configuration of @ref CLNegLayer
105 *
106 * @param[in] input First tensor input info. Data types supported: F16/F32.
107 * @param[in] output Output tensor info. Data types supported: Same as @p input.
108 *
109 * @return a status
110 */
111 static Status validate(const ITensorInfo *input, const ITensorInfo *output);
112};
Michalis Spyrou0af44182019-05-17 14:04:47 +0100113
114/** Basic function to calculate sine of an input tensor. */
115class CLSinLayer : public ICLSimpleFunction
116{
117public:
118 /** Initialize the function
119 *
120 * @param[in] input Input tensor. Data types supported: F16/F32.
121 * @param[out] output Output tensor. Data types supported: same as @p input.
122 */
123 void configure(const ICLTensor *input, ICLTensor *output);
Manuel Bottini2b84be52020-04-08 10:15:51 +0100124 /** Initialize the function
125 *
126 * @param[in] compile_context The compile context to be used.
127 * @param[in] input Input tensor. Data types supported: F16/F32.
128 * @param[out] output Output tensor. Data types supported: same as @p input.
129 */
130 void configure(const CLCompileContext &compile_context, const ICLTensor *input, ICLTensor *output);
Michalis Spyrou0af44182019-05-17 14:04:47 +0100131 /** Static function to check if given info will lead to a valid configuration of @ref CLSinLayer
132 *
133 * @param[in] input First tensor input info. Data types supported: F16/F32.
134 * @param[in] output Output tensor info. Data types supported: Same as @p input.
135 *
136 * @return a status
137 */
138 static Status validate(const ITensorInfo *input, const ITensorInfo *output);
139};
giuros01f24411f2019-05-16 11:47:13 +0100140
Usama Arifac33d7e2019-05-20 14:21:40 +0100141/** Basic function to perform elementwise log on an input tensor. */
142class CLLogLayer : public ICLSimpleFunction
143{
144public:
145 /** Initialize the function
146 *
147 * @param[in] input Input tensor. Data types supported: F16/F32.
148 * @param[out] output Output tensor. Data types supported: same as @p input.
149 */
150 void configure(const ICLTensor *input, ICLTensor *output);
Manuel Bottini2b84be52020-04-08 10:15:51 +0100151 /** Initialize the function
152 *
153 * @param[in] compile_context The compile context to be used.
154 * @param[in] input Input tensor. Data types supported: F16/F32.
155 * @param[out] output Output tensor. Data types supported: same as @p input.
156 */
157 void configure(const CLCompileContext &compile_context, const ICLTensor *input, ICLTensor *output);
Usama Arifac33d7e2019-05-20 14:21:40 +0100158 /** Static function to check if given info will lead to a valid configuration of @ref CLLogLayer
159 *
160 * @param[in] input First tensor input info. Data types supported: F16/F32.
161 * @param[in] output Output tensor info. Data types supported: Same as @p input.
162 *
163 * @return a status
164 */
165 static Status validate(const ITensorInfo *input, const ITensorInfo *output);
166};
167
giuros01f24411f2019-05-16 11:47:13 +0100168/** Basic function to get the absolute value of an input tensor. */
169class CLAbsLayer : public ICLSimpleFunction
170{
171public:
172 /** Initialize the function
173 *
174 * @param[in] input Input tensor. Data types supported: F16/F32.
175 * @param[out] output Output tensor. Data types supported: same as @p input.
176 */
177 void configure(const ICLTensor *input, ICLTensor *output);
Manuel Bottini2b84be52020-04-08 10:15:51 +0100178 /** Initialize the function
179 *
180 * @param[in] compile_context The compile context to be used.
181 * @param[in] input Input tensor. Data types supported: F16/F32.
182 * @param[out] output Output tensor. Data types supported: same as @p input.
183 */
184 void configure(const CLCompileContext &compile_context, const ICLTensor *input, ICLTensor *output);
giuros01f24411f2019-05-16 11:47:13 +0100185 /** Static function to check if given info will lead to a valid configuration of @ref CLAbsLayer
186 *
187 * @param[in] input First tensor input info. Data types supported: F16/F32.
188 * @param[in] output Output tensor info. Data types supported: Same as @p input.
189 *
190 * @return a status
191 */
192 static Status validate(const ITensorInfo *input, const ITensorInfo *output);
193};
Usama Arif6a4d5422019-05-24 14:53:59 +0100194
195/** Basic function to get the round (to the nearest even) value of an input tensor. */
196class CLRoundLayer : public ICLSimpleFunction
197{
198public:
199 /** Initialize the function
200 *
201 * @param[in] input Input tensor. Data types supported: F16/F32.
202 * @param[out] output Output tensor. Data types supported: same as @p input.
203 */
204 void configure(const ICLTensor *input, ICLTensor *output);
Manuel Bottini2b84be52020-04-08 10:15:51 +0100205 /** Initialize the function
206 *
207 * @param[in] compile_context The compile context to be used.
208 * @param[in] input Input tensor. Data types supported: F16/F32.
209 * @param[out] output Output tensor. Data types supported: same as @p input.
210 */
211 void configure(const CLCompileContext &compile_context, const ICLTensor *input, ICLTensor *output);
Usama Arif6a4d5422019-05-24 14:53:59 +0100212 /** Static function to check if given info will lead to a valid configuration of @ref CLRoundLayer
213 *
214 * @param[in] input First tensor input info. Data types supported: F16/F32.
215 * @param[in] output Output tensor info. Data types supported: Same as @p input.
216 *
217 * @return a status
218 */
219 static Status validate(const ITensorInfo *input, const ITensorInfo *output);
220};
Michalis Spyroue9362622018-11-23 17:41:37 +0000221} // namespace arm_compute
Michalis Spyrouf4643372019-11-29 16:17:13 +0000222#endif /* ARM_COMPUTE_CLELEMENTWISEUNARYLAYER_H */