Michalis Spyrou | e936262 | 2018-11-23 17:41:37 +0000 | [diff] [blame] | 1 | /* |
Usama Arif | eb312ef | 2019-05-13 17:45:54 +0100 | [diff] [blame] | 2 | * Copyright (c) 2018-2019 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 | */ |
| 24 | #ifndef __ARM_COMPUTE_CLELEMENTWISEUNARYLAYER_H__ |
| 25 | #define __ARM_COMPUTE_CLELEMENTWISEUNARYLAYER_H__ |
| 26 | |
| 27 | #include "arm_compute/runtime/CL/ICLSimpleFunction.h" |
| 28 | |
| 29 | namespace arm_compute |
| 30 | { |
| 31 | class ICLTensor; |
| 32 | |
| 33 | /** Basic function to perform inverse square root on an input tensor. */ |
| 34 | class CLRsqrtLayer : public ICLSimpleFunction |
| 35 | { |
| 36 | public: |
| 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. */ |
| 54 | class CLExpLayer : public ICLSimpleFunction |
| 55 | { |
| 56 | public: |
| 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 Arif | eb312ef | 2019-05-13 17:45:54 +0100 | [diff] [blame] | 72 | |
| 73 | /** Basic function to negate an input tensor. */ |
| 74 | class CLNegLayer : public ICLSimpleFunction |
| 75 | { |
| 76 | public: |
| 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 Spyrou | 0af4418 | 2019-05-17 14:04:47 +0100 | [diff] [blame] | 92 | |
| 93 | /** Basic function to calculate sine of an input tensor. */ |
| 94 | class CLSinLayer : public ICLSimpleFunction |
| 95 | { |
| 96 | public: |
| 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 | }; |
giuros01 | f24411f | 2019-05-16 11:47:13 +0100 | [diff] [blame] | 112 | |
Usama Arif | ac33d7e | 2019-05-20 14:21:40 +0100 | [diff] [blame] | 113 | /** Basic function to perform elementwise log on an input tensor. */ |
| 114 | class CLLogLayer : public ICLSimpleFunction |
| 115 | { |
| 116 | public: |
| 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 | |
giuros01 | f24411f | 2019-05-16 11:47:13 +0100 | [diff] [blame] | 133 | /** Basic function to get the absolute value of an input tensor. */ |
| 134 | class CLAbsLayer : public ICLSimpleFunction |
| 135 | { |
| 136 | public: |
| 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 Arif | 6a4d542 | 2019-05-24 14:53:59 +0100 | [diff] [blame^] | 152 | |
| 153 | /** Basic function to get the round (to the nearest even) value of an input tensor. */ |
| 154 | class CLRoundLayer : public ICLSimpleFunction |
| 155 | { |
| 156 | public: |
| 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 Spyrou | e936262 | 2018-11-23 17:41:37 +0000 | [diff] [blame] | 172 | } // namespace arm_compute |
| 173 | #endif /* __ARM_COMPUTE_CLELEMENTWISEUNARYLAYER_H__ */ |