George Wort | 5a97b28 | 2018-12-21 16:21:04 +0000 | [diff] [blame] | 1 | /* |
Michele Di Giorgio | d9eaf61 | 2020-07-08 11:12:57 +0100 | [diff] [blame] | 2 | * Copyright (c) 2018-2020 Arm Limited. |
George Wort | 5a97b28 | 2018-12-21 16:21:04 +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_NEELEMENTWISEUNARYLAYER_H |
| 25 | #define ARM_COMPUTE_NEELEMENTWISEUNARYLAYER_H |
George Wort | 5a97b28 | 2018-12-21 16:21:04 +0000 | [diff] [blame] | 26 | |
Manuel Bottini | 80feed5 | 2020-06-03 13:20:41 +0100 | [diff] [blame] | 27 | #include "arm_compute/runtime/NEON/INESimpleFunctionNoBorder.h" |
George Wort | 5a97b28 | 2018-12-21 16:21:04 +0000 | [diff] [blame] | 28 | |
| 29 | namespace arm_compute |
| 30 | { |
| 31 | class ITensor; |
| 32 | |
| 33 | /** Basic function to perform inverse square root on an input tensor. */ |
Manuel Bottini | 80feed5 | 2020-06-03 13:20:41 +0100 | [diff] [blame] | 34 | class NERsqrtLayer : public INESimpleFunctionNoBorder |
George Wort | 5a97b28 | 2018-12-21 16:21:04 +0000 | [diff] [blame] | 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 ITensor *input, ITensor *output); |
| 43 | /** Static function to check if given info will lead to a valid configuration of @ref NERsqrtLayer |
| 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. */ |
Manuel Bottini | 80feed5 | 2020-06-03 13:20:41 +0100 | [diff] [blame] | 54 | class NEExpLayer : public INESimpleFunctionNoBorder |
George Wort | 5a97b28 | 2018-12-21 16:21:04 +0000 | [diff] [blame] | 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 ITensor *input, ITensor *output); |
| 63 | /** Static function to check if given info will lead to a valid configuration of @ref NEExpLayer |
| 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 | f6e475c | 2019-05-10 12:06:28 +0100 | [diff] [blame] | 72 | |
| 73 | /** Basic function to negate an input tensor. */ |
Manuel Bottini | 80feed5 | 2020-06-03 13:20:41 +0100 | [diff] [blame] | 74 | class NENegLayer : public INESimpleFunctionNoBorder |
Usama Arif | f6e475c | 2019-05-10 12:06:28 +0100 | [diff] [blame] | 75 | { |
| 76 | public: |
| 77 | /** Initialize the function |
| 78 | * |
| 79 | * @param[in] input Input tensor. Data types supported: F16/F32/S32. |
| 80 | * @param[out] output Output tensor. Data types supported: same as @p input. |
| 81 | */ |
| 82 | void configure(const ITensor *input, ITensor *output); |
| 83 | /** Static function to check if given info will lead to a valid configuration of @ref NENegLayer |
| 84 | * |
| 85 | * @param[in] input First tensor input info. Data types supported: F16/F32/S32. |
| 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 | }; |
Usama Arif | c255aa7 | 2019-05-13 16:26:29 +0100 | [diff] [blame] | 92 | |
| 93 | /** Basic function to compute the natural logarithm of an input tensor. */ |
Manuel Bottini | 80feed5 | 2020-06-03 13:20:41 +0100 | [diff] [blame] | 94 | class NELogLayer : public INESimpleFunctionNoBorder |
Usama Arif | c255aa7 | 2019-05-13 16:26:29 +0100 | [diff] [blame] | 95 | { |
| 96 | public: |
| 97 | /** Initialize the function |
| 98 | * |
Michele Di Giorgio | f9b595a | 2020-07-03 13:34:52 +0100 | [diff] [blame] | 99 | * @param[in] input Input tensor. Data types supported: F16/F32. |
Usama Arif | c255aa7 | 2019-05-13 16:26:29 +0100 | [diff] [blame] | 100 | * @param[out] output Output tensor. Data types supported: same as @p input. |
| 101 | */ |
| 102 | void configure(const ITensor *input, ITensor *output); |
| 103 | /** Static function to check if given info will lead to a valid configuration of @ref NELogLayer |
| 104 | * |
Michele Di Giorgio | f9b595a | 2020-07-03 13:34:52 +0100 | [diff] [blame] | 105 | * @param[in] input First tensor input info. Data types supported: F16/F32. |
Usama Arif | c255aa7 | 2019-05-13 16:26:29 +0100 | [diff] [blame] | 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 | }; |
Manuel Bottini | 6ac5992 | 2019-05-15 14:06:02 +0100 | [diff] [blame] | 112 | |
| 113 | /** Basic function to compute the absolute value of an input tensor. */ |
Manuel Bottini | 80feed5 | 2020-06-03 13:20:41 +0100 | [diff] [blame] | 114 | class NEAbsLayer : public INESimpleFunctionNoBorder |
Manuel Bottini | 6ac5992 | 2019-05-15 14:06:02 +0100 | [diff] [blame] | 115 | { |
| 116 | public: |
| 117 | /** Initialize the function |
| 118 | * |
| 119 | * @param[in] input Input tensor. Data types supported: F16/F32/S32. |
| 120 | * @param[out] output Output tensor. Data types supported: same as @p input. |
| 121 | */ |
| 122 | void configure(const ITensor *input, ITensor *output); |
| 123 | /** Static function to check if given info will lead to a valid configuration of @ref NEAbsLayer |
| 124 | * |
| 125 | * @param[in] input First tensor input info. Data types supported: F16/F32/S32. |
| 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 | }; |
Usama Arif | 0a5a57a | 2019-05-23 14:20:33 +0100 | [diff] [blame] | 132 | |
| 133 | /** Basic function to compute the round value elementwise of an input tensor. */ |
Manuel Bottini | 80feed5 | 2020-06-03 13:20:41 +0100 | [diff] [blame] | 134 | class NERoundLayer : public INESimpleFunctionNoBorder |
Usama Arif | 0a5a57a | 2019-05-23 14:20:33 +0100 | [diff] [blame] | 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 ITensor *input, ITensor *output); |
| 143 | /** Static function to check if given info will lead to a valid configuration of @ref NERoundLayer |
| 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 | }; |
Manuel Bottini | ed75326 | 2019-05-15 15:30:47 +0100 | [diff] [blame] | 152 | |
| 153 | /** Basic function to compute the sine of an input tensor. */ |
Manuel Bottini | 80feed5 | 2020-06-03 13:20:41 +0100 | [diff] [blame] | 154 | class NESinLayer : public INESimpleFunctionNoBorder |
Manuel Bottini | ed75326 | 2019-05-15 15:30:47 +0100 | [diff] [blame] | 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 ITensor *input, ITensor *output); |
| 163 | /** Static function to check if given info will lead to a valid configuration of @ref NESinLayer |
| 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 | }; |
George Wort | 5a97b28 | 2018-12-21 16:21:04 +0000 | [diff] [blame] | 172 | } // namespace arm_compute |
Michalis Spyrou | f464337 | 2019-11-29 16:17:13 +0000 | [diff] [blame] | 173 | #endif /* ARM_COMPUTE_NEELEMENTWISEUNARYLAYER_H */ |