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