Michalis Spyrou | e936262 | 2018-11-23 17:41:37 +0000 | [diff] [blame] | 1 | /* |
Michele Di Giorgio | c9c8905 | 2021-01-26 10:20:17 +0000 | [diff] [blame] | 2 | * Copyright (c) 2018-2021 Arm Limited. |
Michalis Spyrou | e936262 | 2018-11-23 17:41:37 +0000 | [diff] [blame] | 3 | * |
| 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 Spyrou | f464337 | 2019-11-29 16:17:13 +0000 | [diff] [blame] | 24 | #ifndef ARM_COMPUTE_CLELEMENTWISEUNARYLAYER_H |
| 25 | #define ARM_COMPUTE_CLELEMENTWISEUNARYLAYER_H |
Michalis Spyrou | e936262 | 2018-11-23 17:41:37 +0000 | [diff] [blame] | 26 | |
Michele Di Giorgio | c9c8905 | 2021-01-26 10:20:17 +0000 | [diff] [blame] | 27 | #include "arm_compute/core/Types.h" |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame] | 28 | #include "arm_compute/runtime/IFunction.h" |
Michele Di Giorgio | c9c8905 | 2021-01-26 10:20:17 +0000 | [diff] [blame] | 29 | |
| 30 | #include <memory> |
Michalis Spyrou | e936262 | 2018-11-23 17:41:37 +0000 | [diff] [blame] | 31 | |
| 32 | namespace arm_compute |
| 33 | { |
Sang-Hoon Park | bef7fa2 | 2020-10-21 15:58:54 +0100 | [diff] [blame] | 34 | class CLCompileContext; |
Michalis Spyrou | e936262 | 2018-11-23 17:41:37 +0000 | [diff] [blame] | 35 | class ICLTensor; |
Sang-Hoon Park | bef7fa2 | 2020-10-21 15:58:54 +0100 | [diff] [blame] | 36 | class ITensorInfo; |
Michalis Spyrou | e936262 | 2018-11-23 17:41:37 +0000 | [diff] [blame] | 37 | |
| 38 | /** Basic function to perform inverse square root on an input tensor. */ |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 39 | class CLRsqrtLayer : public IFunction |
Michalis Spyrou | e936262 | 2018-11-23 17:41:37 +0000 | [diff] [blame] | 40 | { |
| 41 | public: |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 42 | /** Default Constructor */ |
| 43 | CLRsqrtLayer(); |
| 44 | /** Default Destructor */ |
| 45 | ~CLRsqrtLayer(); |
| 46 | /** Prevent instances of this class from being copied (As this class contains pointers) */ |
| 47 | CLRsqrtLayer(const CLRsqrtLayer &) = delete; |
| 48 | /** Default move constructor */ |
| 49 | CLRsqrtLayer(CLRsqrtLayer &&); |
| 50 | /** Prevent instances of this class from being copied (As this class contains pointers) */ |
| 51 | CLRsqrtLayer &operator=(const CLRsqrtLayer &) = delete; |
| 52 | /** Default move assignment operator */ |
| 53 | CLRsqrtLayer &operator=(CLRsqrtLayer &&); |
Michalis Spyrou | e936262 | 2018-11-23 17:41:37 +0000 | [diff] [blame] | 54 | /** Initialize the function |
| 55 | * |
Sheri Zhang | 6124ce6 | 2021-05-04 14:03:13 +0100 | [diff] [blame] | 56 | * Valid data layouts: |
| 57 | * - All |
| 58 | * |
| 59 | * Valid data type configurations: |
| 60 | * |src |dst | |
| 61 | * |:--------------|:--------------| |
| 62 | * |F16 |F16 | |
| 63 | * |F32 |F32 | |
| 64 | * |
Michalis Spyrou | e936262 | 2018-11-23 17:41:37 +0000 | [diff] [blame] | 65 | * @param[in] input Input tensor. Data types supported: F16/F32. |
| 66 | * @param[out] output Output tensor. Data types supported: same as @p input. |
| 67 | */ |
| 68 | void configure(const ICLTensor *input, ICLTensor *output); |
Manuel Bottini | 2b84be5 | 2020-04-08 10:15:51 +0100 | [diff] [blame] | 69 | /** Initialize the function |
| 70 | * |
| 71 | * @param[in] compile_context The compile context to be used. |
| 72 | * @param[in] input Input tensor. Data types supported: F16/F32. |
| 73 | * @param[out] output Output tensor. Data types supported: same as @p input. |
| 74 | */ |
| 75 | void configure(const CLCompileContext &compile_context, const ICLTensor *input, ICLTensor *output); |
Michalis Spyrou | e936262 | 2018-11-23 17:41:37 +0000 | [diff] [blame] | 76 | /** Static function to check if given info will lead to a valid configuration of @ref CLRsqrtLayer |
| 77 | * |
| 78 | * @param[in] input First tensor input info. Data types supported: F16/F32. |
| 79 | * @param[in] output Output tensor info. Data types supported: Same as @p input. |
| 80 | * |
| 81 | * @return a status |
| 82 | */ |
| 83 | static Status validate(const ITensorInfo *input, const ITensorInfo *output); |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 84 | |
| 85 | // Inherited methods overridden: |
| 86 | void run() override; |
| 87 | |
| 88 | private: |
| 89 | struct Impl; |
| 90 | std::unique_ptr<Impl> _impl; |
Michalis Spyrou | e936262 | 2018-11-23 17:41:37 +0000 | [diff] [blame] | 91 | }; |
| 92 | |
| 93 | /** Basic function to perform exponential on an input tensor. */ |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 94 | class CLExpLayer : public IFunction |
Michalis Spyrou | e936262 | 2018-11-23 17:41:37 +0000 | [diff] [blame] | 95 | { |
| 96 | public: |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 97 | /** Default Constructor */ |
| 98 | CLExpLayer(); |
| 99 | /** Default Destructor */ |
| 100 | ~CLExpLayer(); |
| 101 | /** Prevent instances of this class from being copied (As this class contains pointers) */ |
| 102 | CLExpLayer(const CLExpLayer &) = delete; |
| 103 | /** Default move constructor */ |
| 104 | CLExpLayer(CLExpLayer &&); |
| 105 | /** Prevent instances of this class from being copied (As this class contains pointers) */ |
| 106 | CLExpLayer &operator=(const CLExpLayer &) = delete; |
| 107 | /** Default move assignment operator */ |
| 108 | CLExpLayer &operator=(CLExpLayer &&); |
Michalis Spyrou | e936262 | 2018-11-23 17:41:37 +0000 | [diff] [blame] | 109 | /** Initialize the function |
| 110 | * |
Sheri Zhang | 6124ce6 | 2021-05-04 14:03:13 +0100 | [diff] [blame] | 111 | * Valid data layouts: |
| 112 | * - All |
| 113 | * |
| 114 | * Valid data type configurations: |
| 115 | * |src |dst | |
| 116 | * |:--------------|:--------------| |
| 117 | * |F16 |F16 | |
| 118 | * |F32 |F32 | |
| 119 | * |
Michalis Spyrou | e936262 | 2018-11-23 17:41:37 +0000 | [diff] [blame] | 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 Bottini | 2b84be5 | 2020-04-08 10:15:51 +0100 | [diff] [blame] | 124 | /** 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 Spyrou | e936262 | 2018-11-23 17:41:37 +0000 | [diff] [blame] | 131 | /** Static function to check if given info will lead to a valid configuration of @ref CLExpLayer |
| 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); |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 139 | |
| 140 | // Inherited methods overridden: |
| 141 | void run() override; |
| 142 | |
| 143 | private: |
| 144 | struct Impl; |
| 145 | std::unique_ptr<Impl> _impl; |
Michalis Spyrou | e936262 | 2018-11-23 17:41:37 +0000 | [diff] [blame] | 146 | }; |
Usama Arif | eb312ef | 2019-05-13 17:45:54 +0100 | [diff] [blame] | 147 | |
| 148 | /** Basic function to negate an input tensor. */ |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 149 | class CLNegLayer : public IFunction |
Usama Arif | eb312ef | 2019-05-13 17:45:54 +0100 | [diff] [blame] | 150 | { |
| 151 | public: |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 152 | /** Default Constructor */ |
| 153 | CLNegLayer(); |
| 154 | /** Default Destructor */ |
| 155 | ~CLNegLayer(); |
| 156 | /** Prevent instances of this class from being copied (As this class contains pointers) */ |
| 157 | CLNegLayer(const CLNegLayer &) = delete; |
| 158 | /** Default move constructor */ |
| 159 | CLNegLayer(CLNegLayer &&); |
| 160 | /** Prevent instances of this class from being copied (As this class contains pointers) */ |
| 161 | CLNegLayer &operator=(const CLNegLayer &) = delete; |
| 162 | /** Default move assignment operator */ |
| 163 | CLNegLayer &operator=(CLNegLayer &&); |
Usama Arif | eb312ef | 2019-05-13 17:45:54 +0100 | [diff] [blame] | 164 | /** Initialize the function |
| 165 | * |
Sheri Zhang | 6124ce6 | 2021-05-04 14:03:13 +0100 | [diff] [blame] | 166 | * Valid data layouts: |
| 167 | * - All |
| 168 | * |
| 169 | * Valid data type configurations: |
| 170 | * |src |dst | |
| 171 | * |:--------------|:--------------| |
| 172 | * |F16 |F16 | |
| 173 | * |F32 |F32 | |
Suhail Munshi | ee22030 | 2021-05-06 12:43:07 +0100 | [diff] [blame] | 174 | * |S32 |S32 | |
Sheri Zhang | 6124ce6 | 2021-05-04 14:03:13 +0100 | [diff] [blame] | 175 | * |
Suhail Munshi | ee22030 | 2021-05-06 12:43:07 +0100 | [diff] [blame] | 176 | * @param[in] input Input tensor. Data types supported: F16/F32/S32 |
Usama Arif | eb312ef | 2019-05-13 17:45:54 +0100 | [diff] [blame] | 177 | * @param[out] output Output tensor. Data types supported: same as @p input. |
| 178 | */ |
| 179 | void configure(const ICLTensor *input, ICLTensor *output); |
Manuel Bottini | 2b84be5 | 2020-04-08 10:15:51 +0100 | [diff] [blame] | 180 | /** Initialize the function |
| 181 | * |
| 182 | * @param[in] compile_context The compile context to be used. |
Suhail Munshi | ee22030 | 2021-05-06 12:43:07 +0100 | [diff] [blame] | 183 | * @param[in] input Input tensor. Data types supported: F16/F32/S32 |
Manuel Bottini | 2b84be5 | 2020-04-08 10:15:51 +0100 | [diff] [blame] | 184 | * @param[out] output Output tensor. Data types supported: same as @p input. |
| 185 | */ |
| 186 | void configure(const CLCompileContext &compile_context, const ICLTensor *input, ICLTensor *output); |
Usama Arif | eb312ef | 2019-05-13 17:45:54 +0100 | [diff] [blame] | 187 | /** Static function to check if given info will lead to a valid configuration of @ref CLNegLayer |
| 188 | * |
Suhail Munshi | ee22030 | 2021-05-06 12:43:07 +0100 | [diff] [blame] | 189 | * @param[in] input First tensor input info. Data types supported: F16/F32/S32 |
Usama Arif | eb312ef | 2019-05-13 17:45:54 +0100 | [diff] [blame] | 190 | * @param[in] output Output tensor info. Data types supported: Same as @p input. |
| 191 | * |
| 192 | * @return a status |
| 193 | */ |
| 194 | static Status validate(const ITensorInfo *input, const ITensorInfo *output); |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 195 | |
| 196 | // Inherited methods overridden: |
| 197 | void run() override; |
| 198 | |
| 199 | private: |
| 200 | struct Impl; |
| 201 | std::unique_ptr<Impl> _impl; |
Usama Arif | eb312ef | 2019-05-13 17:45:54 +0100 | [diff] [blame] | 202 | }; |
Michalis Spyrou | 0af4418 | 2019-05-17 14:04:47 +0100 | [diff] [blame] | 203 | |
| 204 | /** Basic function to calculate sine of an input tensor. */ |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 205 | class CLSinLayer : public IFunction |
Michalis Spyrou | 0af4418 | 2019-05-17 14:04:47 +0100 | [diff] [blame] | 206 | { |
| 207 | public: |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 208 | /** Default Constructor */ |
| 209 | CLSinLayer(); |
| 210 | /** Default Destructor */ |
| 211 | ~CLSinLayer(); |
| 212 | /** Prevent instances of this class from being copied (As this class contains pointers) */ |
| 213 | CLSinLayer(const CLSinLayer &) = delete; |
| 214 | /** Default move constructor */ |
| 215 | CLSinLayer(CLSinLayer &&); |
| 216 | /** Prevent instances of this class from being copied (As this class contains pointers) */ |
| 217 | CLSinLayer &operator=(const CLSinLayer &) = delete; |
| 218 | /** Default move assignment operator */ |
| 219 | CLSinLayer &operator=(CLSinLayer &&); |
Michalis Spyrou | 0af4418 | 2019-05-17 14:04:47 +0100 | [diff] [blame] | 220 | /** Initialize the function |
| 221 | * |
Sheri Zhang | 6124ce6 | 2021-05-04 14:03:13 +0100 | [diff] [blame] | 222 | * Valid data layouts: |
| 223 | * - All |
| 224 | * |
| 225 | * Valid data type configurations: |
| 226 | * |src |dst | |
| 227 | * |:--------------|:--------------| |
| 228 | * |F16 |F16 | |
| 229 | * |F32 |F32 | |
| 230 | * |
Michalis Spyrou | 0af4418 | 2019-05-17 14:04:47 +0100 | [diff] [blame] | 231 | * @param[in] input Input tensor. Data types supported: F16/F32. |
| 232 | * @param[out] output Output tensor. Data types supported: same as @p input. |
| 233 | */ |
| 234 | void configure(const ICLTensor *input, ICLTensor *output); |
Manuel Bottini | 2b84be5 | 2020-04-08 10:15:51 +0100 | [diff] [blame] | 235 | /** Initialize the function |
| 236 | * |
| 237 | * @param[in] compile_context The compile context to be used. |
| 238 | * @param[in] input Input tensor. Data types supported: F16/F32. |
| 239 | * @param[out] output Output tensor. Data types supported: same as @p input. |
| 240 | */ |
| 241 | void configure(const CLCompileContext &compile_context, const ICLTensor *input, ICLTensor *output); |
Michalis Spyrou | 0af4418 | 2019-05-17 14:04:47 +0100 | [diff] [blame] | 242 | /** Static function to check if given info will lead to a valid configuration of @ref CLSinLayer |
| 243 | * |
| 244 | * @param[in] input First tensor input info. Data types supported: F16/F32. |
| 245 | * @param[in] output Output tensor info. Data types supported: Same as @p input. |
| 246 | * |
| 247 | * @return a status |
| 248 | */ |
| 249 | static Status validate(const ITensorInfo *input, const ITensorInfo *output); |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 250 | |
| 251 | // Inherited methods overridden: |
| 252 | void run() override; |
| 253 | |
| 254 | private: |
| 255 | struct Impl; |
| 256 | std::unique_ptr<Impl> _impl; |
Michalis Spyrou | 0af4418 | 2019-05-17 14:04:47 +0100 | [diff] [blame] | 257 | }; |
giuros01 | f24411f | 2019-05-16 11:47:13 +0100 | [diff] [blame] | 258 | |
Usama Arif | ac33d7e | 2019-05-20 14:21:40 +0100 | [diff] [blame] | 259 | /** Basic function to perform elementwise log on an input tensor. */ |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 260 | class CLLogLayer : public IFunction |
Usama Arif | ac33d7e | 2019-05-20 14:21:40 +0100 | [diff] [blame] | 261 | { |
| 262 | public: |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 263 | /** Default Constructor */ |
| 264 | CLLogLayer(); |
| 265 | /** Default Destructor */ |
| 266 | ~CLLogLayer(); |
| 267 | /** Prevent instances of this class from being copied (As this class contains pointers) */ |
| 268 | CLLogLayer(const CLLogLayer &) = delete; |
| 269 | /** Default move constructor */ |
| 270 | CLLogLayer(CLLogLayer &&); |
| 271 | /** Prevent instances of this class from being copied (As this class contains pointers) */ |
| 272 | CLLogLayer &operator=(const CLLogLayer &) = delete; |
| 273 | /** Default move assignment operator */ |
| 274 | CLLogLayer &operator=(CLLogLayer &&); |
Usama Arif | ac33d7e | 2019-05-20 14:21:40 +0100 | [diff] [blame] | 275 | /** Initialize the function |
| 276 | * |
Sheri Zhang | 6124ce6 | 2021-05-04 14:03:13 +0100 | [diff] [blame] | 277 | * Valid data layouts: |
| 278 | * - All |
| 279 | * |
| 280 | * Valid data type configurations: |
| 281 | * |src |dst | |
| 282 | * |:--------------|:--------------| |
| 283 | * |F16 |F16 | |
| 284 | * |F32 |F32 | |
| 285 | * |
Usama Arif | ac33d7e | 2019-05-20 14:21:40 +0100 | [diff] [blame] | 286 | * @param[in] input Input tensor. Data types supported: F16/F32. |
| 287 | * @param[out] output Output tensor. Data types supported: same as @p input. |
| 288 | */ |
| 289 | void configure(const ICLTensor *input, ICLTensor *output); |
Manuel Bottini | 2b84be5 | 2020-04-08 10:15:51 +0100 | [diff] [blame] | 290 | /** Initialize the function |
| 291 | * |
| 292 | * @param[in] compile_context The compile context to be used. |
| 293 | * @param[in] input Input tensor. Data types supported: F16/F32. |
| 294 | * @param[out] output Output tensor. Data types supported: same as @p input. |
| 295 | */ |
| 296 | void configure(const CLCompileContext &compile_context, const ICLTensor *input, ICLTensor *output); |
Usama Arif | ac33d7e | 2019-05-20 14:21:40 +0100 | [diff] [blame] | 297 | /** Static function to check if given info will lead to a valid configuration of @ref CLLogLayer |
| 298 | * |
| 299 | * @param[in] input First tensor input info. Data types supported: F16/F32. |
| 300 | * @param[in] output Output tensor info. Data types supported: Same as @p input. |
| 301 | * |
| 302 | * @return a status |
| 303 | */ |
| 304 | static Status validate(const ITensorInfo *input, const ITensorInfo *output); |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 305 | |
| 306 | // Inherited methods overridden: |
| 307 | void run() override; |
| 308 | |
| 309 | private: |
| 310 | struct Impl; |
| 311 | std::unique_ptr<Impl> _impl; |
Usama Arif | ac33d7e | 2019-05-20 14:21:40 +0100 | [diff] [blame] | 312 | }; |
| 313 | |
giuros01 | f24411f | 2019-05-16 11:47:13 +0100 | [diff] [blame] | 314 | /** Basic function to get the absolute value of an input tensor. */ |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 315 | class CLAbsLayer : public IFunction |
giuros01 | f24411f | 2019-05-16 11:47:13 +0100 | [diff] [blame] | 316 | { |
| 317 | public: |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 318 | /** Default Constructor */ |
| 319 | CLAbsLayer(); |
| 320 | /** Default Destructor */ |
| 321 | ~CLAbsLayer(); |
| 322 | /** Prevent instances of this class from being copied (As this class contains pointers) */ |
| 323 | CLAbsLayer(const CLAbsLayer &) = delete; |
| 324 | /** Default move constructor */ |
| 325 | CLAbsLayer(CLAbsLayer &&); |
| 326 | /** Prevent instances of this class from being copied (As this class contains pointers) */ |
| 327 | CLAbsLayer &operator=(const CLAbsLayer &) = delete; |
| 328 | /** Default move assignment operator */ |
| 329 | CLAbsLayer &operator=(CLAbsLayer &&); |
giuros01 | f24411f | 2019-05-16 11:47:13 +0100 | [diff] [blame] | 330 | /** Initialize the function |
| 331 | * |
Sheri Zhang | 6124ce6 | 2021-05-04 14:03:13 +0100 | [diff] [blame] | 332 | * Valid data layouts: |
| 333 | * - All |
| 334 | * |
| 335 | * Valid data type configurations: |
| 336 | * |src |dst | |
| 337 | * |:--------------|:--------------| |
| 338 | * |F16 |F16 | |
| 339 | * |F32 |F32 | |
| 340 | * |
giuros01 | f24411f | 2019-05-16 11:47:13 +0100 | [diff] [blame] | 341 | * @param[in] input Input tensor. Data types supported: F16/F32. |
| 342 | * @param[out] output Output tensor. Data types supported: same as @p input. |
| 343 | */ |
| 344 | void configure(const ICLTensor *input, ICLTensor *output); |
Manuel Bottini | 2b84be5 | 2020-04-08 10:15:51 +0100 | [diff] [blame] | 345 | /** Initialize the function |
| 346 | * |
| 347 | * @param[in] compile_context The compile context to be used. |
| 348 | * @param[in] input Input tensor. Data types supported: F16/F32. |
| 349 | * @param[out] output Output tensor. Data types supported: same as @p input. |
| 350 | */ |
| 351 | void configure(const CLCompileContext &compile_context, const ICLTensor *input, ICLTensor *output); |
giuros01 | f24411f | 2019-05-16 11:47:13 +0100 | [diff] [blame] | 352 | /** Static function to check if given info will lead to a valid configuration of @ref CLAbsLayer |
| 353 | * |
| 354 | * @param[in] input First tensor input info. Data types supported: F16/F32. |
| 355 | * @param[in] output Output tensor info. Data types supported: Same as @p input. |
| 356 | * |
| 357 | * @return a status |
| 358 | */ |
| 359 | static Status validate(const ITensorInfo *input, const ITensorInfo *output); |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 360 | |
| 361 | // Inherited methods overridden: |
| 362 | void run() override; |
| 363 | |
| 364 | private: |
| 365 | struct Impl; |
| 366 | std::unique_ptr<Impl> _impl; |
giuros01 | f24411f | 2019-05-16 11:47:13 +0100 | [diff] [blame] | 367 | }; |
Usama Arif | 6a4d542 | 2019-05-24 14:53:59 +0100 | [diff] [blame] | 368 | |
| 369 | /** Basic function to get the round (to the nearest even) value of an input tensor. */ |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 370 | class CLRoundLayer : public IFunction |
Usama Arif | 6a4d542 | 2019-05-24 14:53:59 +0100 | [diff] [blame] | 371 | { |
| 372 | public: |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 373 | /** Default Constructor */ |
| 374 | CLRoundLayer(); |
| 375 | /** Default Destructor */ |
| 376 | ~CLRoundLayer(); |
| 377 | /** Prevent instances of this class from being copied (As this class contains pointers) */ |
| 378 | CLRoundLayer(const CLRoundLayer &) = delete; |
| 379 | /** Default move constructor */ |
| 380 | CLRoundLayer(CLRoundLayer &&); |
| 381 | /** Prevent instances of this class from being copied (As this class contains pointers) */ |
| 382 | CLRoundLayer &operator=(const CLRoundLayer &) = delete; |
| 383 | /** Default move assignment operator */ |
| 384 | CLRoundLayer &operator=(CLRoundLayer &&); |
Usama Arif | 6a4d542 | 2019-05-24 14:53:59 +0100 | [diff] [blame] | 385 | /** Initialize the function |
| 386 | * |
Sheri Zhang | 6124ce6 | 2021-05-04 14:03:13 +0100 | [diff] [blame] | 387 | * Valid data layouts: |
| 388 | * - All |
| 389 | * |
| 390 | * Valid data type configurations: |
| 391 | * |src |dst | |
| 392 | * |:--------------|:--------------| |
| 393 | * |F16 |F16 | |
| 394 | * |F32 |F32 | |
| 395 | * |
Usama Arif | 6a4d542 | 2019-05-24 14:53:59 +0100 | [diff] [blame] | 396 | * @param[in] input Input tensor. Data types supported: F16/F32. |
| 397 | * @param[out] output Output tensor. Data types supported: same as @p input. |
| 398 | */ |
| 399 | void configure(const ICLTensor *input, ICLTensor *output); |
Manuel Bottini | 2b84be5 | 2020-04-08 10:15:51 +0100 | [diff] [blame] | 400 | /** Initialize the function |
| 401 | * |
| 402 | * @param[in] compile_context The compile context to be used. |
| 403 | * @param[in] input Input tensor. Data types supported: F16/F32. |
| 404 | * @param[out] output Output tensor. Data types supported: same as @p input. |
| 405 | */ |
| 406 | void configure(const CLCompileContext &compile_context, const ICLTensor *input, ICLTensor *output); |
Usama Arif | 6a4d542 | 2019-05-24 14:53:59 +0100 | [diff] [blame] | 407 | /** Static function to check if given info will lead to a valid configuration of @ref CLRoundLayer |
| 408 | * |
| 409 | * @param[in] input First tensor input info. Data types supported: F16/F32. |
| 410 | * @param[in] output Output tensor info. Data types supported: Same as @p input. |
| 411 | * |
| 412 | * @return a status |
| 413 | */ |
| 414 | static Status validate(const ITensorInfo *input, const ITensorInfo *output); |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 415 | |
| 416 | // Inherited methods overridden: |
| 417 | void run() override; |
| 418 | |
| 419 | private: |
| 420 | struct Impl; |
| 421 | std::unique_ptr<Impl> _impl; |
Usama Arif | 6a4d542 | 2019-05-24 14:53:59 +0100 | [diff] [blame] | 422 | }; |
Michalis Spyrou | e936262 | 2018-11-23 17:41:37 +0000 | [diff] [blame] | 423 | } // namespace arm_compute |
Michalis Spyrou | f464337 | 2019-11-29 16:17:13 +0000 | [diff] [blame] | 424 | #endif /* ARM_COMPUTE_CLELEMENTWISEUNARYLAYER_H */ |