giuros01 | 92fd943 | 2018-12-03 17:30:00 +0000 | [diff] [blame] | 1 | /* |
Michele Di Giorgio | d9eaf61 | 2020-07-08 11:12:57 +0100 | [diff] [blame] | 2 | * Copyright (c) 2018-2020 Arm Limited. |
giuros01 | 92fd943 | 2018-12-03 17:30:00 +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 |
George Wort | d88590f | 2018-12-12 17:39:58 +0000 | [diff] [blame] | 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
giuros01 | 92fd943 | 2018-12-03 17:30:00 +0000 | [diff] [blame] | 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
George Wort | d88590f | 2018-12-12 17:39:58 +0000 | [diff] [blame] | 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, |
giuros01 | 92fd943 | 2018-12-03 17:30:00 +0000 | [diff] [blame] | 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_NEELEMENTWISEOPERATIONS_H |
| 25 | #define ARM_COMPUTE_NEELEMENTWISEOPERATIONS_H |
giuros01 | 92fd943 | 2018-12-03 17:30:00 +0000 | [diff] [blame] | 26 | |
| 27 | #include "arm_compute/core/Types.h" |
Michalis Spyrou | ce0c675 | 2020-06-18 10:14:57 +0100 | [diff] [blame] | 28 | #include "arm_compute/runtime/IFunction.h" |
| 29 | #include "arm_compute/runtime/NEON/INEOperator.h" |
giuros01 | 92fd943 | 2018-12-03 17:30:00 +0000 | [diff] [blame] | 30 | |
| 31 | namespace arm_compute |
| 32 | { |
| 33 | class ITensor; |
| 34 | |
| 35 | /** Basic function to run @ref NEArithmeticOperationKernel for max |
| 36 | * |
morgolock | 6427c82 | 2020-01-13 11:53:20 +0000 | [diff] [blame] | 37 | * @note The tensor data type for the inputs must be QASYMM8/QASYMM8_SIGNED/S16/F16/S32/F32. |
giuros01 | 92fd943 | 2018-12-03 17:30:00 +0000 | [diff] [blame] | 38 | * @note The function performs a max operation between two tensors. |
| 39 | */ |
Michalis Spyrou | ce0c675 | 2020-06-18 10:14:57 +0100 | [diff] [blame] | 40 | class NEElementwiseMax : public IFunction |
giuros01 | 92fd943 | 2018-12-03 17:30:00 +0000 | [diff] [blame] | 41 | { |
| 42 | public: |
Michalis Spyrou | ce0c675 | 2020-06-18 10:14:57 +0100 | [diff] [blame] | 43 | /** Default Constructor */ |
| 44 | NEElementwiseMax(); |
| 45 | /** Default Destructor */ |
| 46 | ~NEElementwiseMax(); |
| 47 | /** Prevent instances of this class from being copied (As this class contains pointers) */ |
| 48 | NEElementwiseMax(const NEElementwiseMax &) = delete; |
| 49 | /** Default move constructor */ |
| 50 | NEElementwiseMax(NEElementwiseMax &&); |
| 51 | /** Prevent instances of this class from being copied (As this class contains pointers) */ |
| 52 | NEElementwiseMax &operator=(const NEElementwiseMax &) = delete; |
| 53 | /** Default move assignment operator */ |
| 54 | NEElementwiseMax &operator=(NEElementwiseMax &&); |
giuros01 | 92fd943 | 2018-12-03 17:30:00 +0000 | [diff] [blame] | 55 | /** Initialise the kernel's inputs, output and conversion policy. |
| 56 | * |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 57 | * @param[in, out] input1 First tensor input. Data types supported: QASYMM8/QASYMM8_SIGNED/S16/F16/S32/F32. |
| 58 | * @param[in, out] input2 Second tensor input. Data types supported: Same as @p input1. |
| 59 | * @param[out] output Output tensor. Data types supported: Same as @p input1. |
| 60 | * @param[in] act_info (Optional) Activation layer information in case of a fused activation. Currently not supported. |
giuros01 | 92fd943 | 2018-12-03 17:30:00 +0000 | [diff] [blame] | 61 | */ |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 62 | void configure(ITensor *input1, ITensor *input2, ITensor *output, const ActivationLayerInfo &act_info = ActivationLayerInfo()); |
giuros01 | 92fd943 | 2018-12-03 17:30:00 +0000 | [diff] [blame] | 63 | /** Static function to check if given info will lead to a valid configuration of @ref NEArithmeticOperationKernel for max |
| 64 | * |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 65 | * @param[in] input1 First tensor input info. Data types supported: QASYMM8/QASYMM8_SIGNED/S16/F16/S32/F32. |
| 66 | * @param[in] input2 Second tensor input info. Data types supported: Same as @p input1. |
| 67 | * @param[in] output Output tensor info. Data types supported: Same as @p input1. |
| 68 | * @param[in] act_info (Optional) Activation layer information in case of a fused activation. Currently not supported. |
giuros01 | 92fd943 | 2018-12-03 17:30:00 +0000 | [diff] [blame] | 69 | * |
| 70 | * @return a status |
| 71 | */ |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 72 | static Status validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output, const ActivationLayerInfo &act_info = ActivationLayerInfo()); |
Michalis Spyrou | ce0c675 | 2020-06-18 10:14:57 +0100 | [diff] [blame] | 73 | |
| 74 | // Inherited methods overridden: |
| 75 | void run() override; |
| 76 | |
| 77 | private: |
| 78 | struct Impl; |
| 79 | std::unique_ptr<Impl> _impl; |
giuros01 | 92fd943 | 2018-12-03 17:30:00 +0000 | [diff] [blame] | 80 | }; |
| 81 | |
| 82 | /** Basic function to run @ref NEArithmeticOperationKernel for min |
| 83 | * |
morgolock | 6427c82 | 2020-01-13 11:53:20 +0000 | [diff] [blame] | 84 | * @note The tensor data type for the inputs must be QASYMM8/QASYMM8_SIGNED/S16/F16/S32/F32. |
| 85 | * @note The function performs a min operation between two tensors. |
giuros01 | 92fd943 | 2018-12-03 17:30:00 +0000 | [diff] [blame] | 86 | */ |
Michalis Spyrou | ce0c675 | 2020-06-18 10:14:57 +0100 | [diff] [blame] | 87 | class NEElementwiseMin : public IFunction |
giuros01 | 92fd943 | 2018-12-03 17:30:00 +0000 | [diff] [blame] | 88 | { |
| 89 | public: |
Michalis Spyrou | ce0c675 | 2020-06-18 10:14:57 +0100 | [diff] [blame] | 90 | /** Default Constructor */ |
| 91 | NEElementwiseMin(); |
| 92 | /** Default Destructor */ |
| 93 | ~NEElementwiseMin(); |
| 94 | /** Prevent instances of this class from being copied (As this class contains pointers) */ |
| 95 | NEElementwiseMin(const NEElementwiseMin &) = delete; |
| 96 | /** Default move constructor */ |
| 97 | NEElementwiseMin(NEElementwiseMin &&); |
| 98 | /** Prevent instances of this class from being copied (As this class contains pointers) */ |
| 99 | NEElementwiseMin &operator=(const NEElementwiseMin &) = delete; |
| 100 | /** Default move assignment operator */ |
| 101 | NEElementwiseMin &operator=(NEElementwiseMin &&); |
giuros01 | 92fd943 | 2018-12-03 17:30:00 +0000 | [diff] [blame] | 102 | /** Initialise the kernel's inputs, output and conversion policy. |
| 103 | * |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 104 | * @param[in, out] input1 First tensor input. Data types supported: QASYMM8/QASYMM8_SIGNED/S16/F16/S32/F32. |
| 105 | * @param[in, out] input2 Second tensor input. Data types supported: Same as @p input1. |
| 106 | * @param[out] output Output tensor. Data types supported: Same as @p input1. |
| 107 | * @param[in] act_info (Optional) Activation layer information in case of a fused activation. Currently not supported. |
giuros01 | 92fd943 | 2018-12-03 17:30:00 +0000 | [diff] [blame] | 108 | */ |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 109 | void configure(ITensor *input1, ITensor *input2, ITensor *output, const ActivationLayerInfo &act_info = ActivationLayerInfo()); |
giuros01 | 92fd943 | 2018-12-03 17:30:00 +0000 | [diff] [blame] | 110 | /** Static function to check if given info will lead to a valid configuration of @ref NEArithmeticOperationKernel for min |
| 111 | * |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 112 | * @param[in] input1 First tensor input info. Data types supported: QASYMM8/QASYMM8_SIGNED/S16/F16/S32/F32. |
| 113 | * @param[in] input2 Second tensor input info. Data types supported: Same as @p input1. |
| 114 | * @param[in] output Output tensor info. Data types supported: Same as @p input1. |
| 115 | * @param[in] act_info (Optional) Activation layer information in case of a fused activation. Currently not supported. |
giuros01 | 92fd943 | 2018-12-03 17:30:00 +0000 | [diff] [blame] | 116 | * |
| 117 | * @return a status |
| 118 | */ |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 119 | static Status validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output, const ActivationLayerInfo &act_info = ActivationLayerInfo()); |
Michalis Spyrou | ce0c675 | 2020-06-18 10:14:57 +0100 | [diff] [blame] | 120 | |
| 121 | // Inherited methods overridden: |
| 122 | void run() override; |
| 123 | |
| 124 | private: |
| 125 | struct Impl; |
| 126 | std::unique_ptr<Impl> _impl; |
giuros01 | 92fd943 | 2018-12-03 17:30:00 +0000 | [diff] [blame] | 127 | }; |
| 128 | |
| 129 | /** Basic function to run @ref NEArithmeticOperationKernel for squared difference |
| 130 | * |
morgolock | 6427c82 | 2020-01-13 11:53:20 +0000 | [diff] [blame] | 131 | * @note The tensor data type for the inputs must be QASYMM8/QASYMM8_SIGNED/S16/F16/S32/F32. |
giuros01 | 92fd943 | 2018-12-03 17:30:00 +0000 | [diff] [blame] | 132 | * @note The function performs a squared different operation between two tensors (i.e., out[i] = (in1[i] - in2[i])^2 |
| 133 | */ |
Michalis Spyrou | ce0c675 | 2020-06-18 10:14:57 +0100 | [diff] [blame] | 134 | class NEElementwiseSquaredDiff : public IFunction |
giuros01 | 92fd943 | 2018-12-03 17:30:00 +0000 | [diff] [blame] | 135 | { |
| 136 | public: |
Michalis Spyrou | ce0c675 | 2020-06-18 10:14:57 +0100 | [diff] [blame] | 137 | /** Default Constructor */ |
| 138 | NEElementwiseSquaredDiff(); |
| 139 | /** Default Destructor */ |
| 140 | ~NEElementwiseSquaredDiff(); |
| 141 | /** Prevent instances of this class from being copied (As this class contains pointers) */ |
| 142 | NEElementwiseSquaredDiff(const NEElementwiseSquaredDiff &) = delete; |
| 143 | /** Default move constructor */ |
| 144 | NEElementwiseSquaredDiff(NEElementwiseSquaredDiff &&); |
| 145 | /** Prevent instances of this class from being copied (As this class contains pointers) */ |
| 146 | NEElementwiseSquaredDiff &operator=(const NEElementwiseSquaredDiff &) = delete; |
| 147 | /** Default move assignment operator */ |
| 148 | NEElementwiseSquaredDiff &operator=(NEElementwiseSquaredDiff &&); |
giuros01 | 92fd943 | 2018-12-03 17:30:00 +0000 | [diff] [blame] | 149 | /** Initialise the kernel's inputs, output and conversion policy. |
| 150 | * |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 151 | * @param[in, out] input1 First tensor input. Data types supported: QASYMM8/QASYMM8_SIGNED/S16/F16/S32/F32. |
| 152 | * @param[in, out] input2 Second tensor input. Data types supported: Same as @p input1. |
| 153 | * @param[out] output Output tensor. Data types supported: Same as @p input1. |
| 154 | * @param[in] act_info (Optional) Activation layer information in case of a fused activation. Currently not supported. |
giuros01 | 92fd943 | 2018-12-03 17:30:00 +0000 | [diff] [blame] | 155 | */ |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 156 | void configure(ITensor *input1, ITensor *input2, ITensor *output, const ActivationLayerInfo &act_info = ActivationLayerInfo()); |
giuros01 | 92fd943 | 2018-12-03 17:30:00 +0000 | [diff] [blame] | 157 | /** Static function to check if given info will lead to a valid configuration of @ref NEArithmeticOperationKernel for squared difference |
| 158 | * |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 159 | * @param[in] input1 First tensor input info. Data types supported: QASYMM8/QASYMM8_SIGNED/S16/F16/S32/F32. |
| 160 | * @param[in] input2 Second tensor input info. Data types supported: Same as @p input1. |
| 161 | * @param[in] output Output tensor info. Data types supported: Same as @p input1. |
| 162 | * @param[in] act_info (Optional) Activation layer information in case of a fused activation. Currently not supported. |
giuros01 | 92fd943 | 2018-12-03 17:30:00 +0000 | [diff] [blame] | 163 | * |
| 164 | * @return a status |
| 165 | */ |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 166 | static Status validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output, const ActivationLayerInfo &act_info = ActivationLayerInfo()); |
Michalis Spyrou | ce0c675 | 2020-06-18 10:14:57 +0100 | [diff] [blame] | 167 | |
| 168 | // Inherited methods overridden: |
| 169 | void run() override; |
| 170 | |
| 171 | private: |
| 172 | struct Impl; |
| 173 | std::unique_ptr<Impl> _impl; |
giuros01 | 92fd943 | 2018-12-03 17:30:00 +0000 | [diff] [blame] | 174 | }; |
George Wort | d88590f | 2018-12-12 17:39:58 +0000 | [diff] [blame] | 175 | |
George Wort | a1e7e28 | 2019-01-15 11:00:29 +0000 | [diff] [blame] | 176 | /** Basic function to run @ref NEArithmeticOperationKernel for division |
| 177 | * |
| 178 | * @note The tensor data type for the inputs must be F16/F32. |
| 179 | * @note The function performs a squared different operation between two tensors (i.e., out[i] = in1[i] / in2[i]) |
| 180 | */ |
Michalis Spyrou | ce0c675 | 2020-06-18 10:14:57 +0100 | [diff] [blame] | 181 | class NEElementwiseDivision : public IFunction |
George Wort | a1e7e28 | 2019-01-15 11:00:29 +0000 | [diff] [blame] | 182 | { |
| 183 | public: |
Michalis Spyrou | ce0c675 | 2020-06-18 10:14:57 +0100 | [diff] [blame] | 184 | /** Default Constructor */ |
| 185 | NEElementwiseDivision(); |
| 186 | /** Default Destructor */ |
| 187 | ~NEElementwiseDivision(); |
| 188 | /** Prevent instances of this class from being copied (As this class contains pointers) */ |
| 189 | NEElementwiseDivision(const NEElementwiseDivision &) = delete; |
| 190 | /** Default move constructor */ |
| 191 | NEElementwiseDivision(NEElementwiseDivision &&); |
| 192 | /** Prevent instances of this class from being copied (As this class contains pointers) */ |
| 193 | NEElementwiseDivision &operator=(const NEElementwiseDivision &) = delete; |
| 194 | /** Default move assignment operator */ |
| 195 | NEElementwiseDivision &operator=(NEElementwiseDivision &&); |
George Wort | a1e7e28 | 2019-01-15 11:00:29 +0000 | [diff] [blame] | 196 | /** Initialise the kernel's inputs, output and conversion policy. |
| 197 | * |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 198 | * @param[in, out] input1 First tensor input. Data types supported: F16/F32. |
| 199 | * @param[in, out] input2 Second tensor input. Data types supported: Same as @p input1. |
| 200 | * @param[out] output Output tensor. Data types supported: Same as @p input1. |
| 201 | * @param[in] act_info (Optional) Activation layer information in case of a fused activation. Currently not supported. |
George Wort | a1e7e28 | 2019-01-15 11:00:29 +0000 | [diff] [blame] | 202 | */ |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 203 | void configure(ITensor *input1, ITensor *input2, ITensor *output, const ActivationLayerInfo &act_info = ActivationLayerInfo()); |
George Wort | a1e7e28 | 2019-01-15 11:00:29 +0000 | [diff] [blame] | 204 | /** Static function to check if given info will lead to a valid configuration of @ref NEArithmeticOperationKernel for division |
| 205 | * |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 206 | * @param[in] input1 First tensor input info. Data types supported: F16/F32. |
| 207 | * @param[in] input2 Second tensor input info. Data types supported: Same as @p input1. |
| 208 | * @param[in] output Output tensor info. Data types supported: Same as @p input1. |
| 209 | * @param[in] act_info (Optional) Activation layer information in case of a fused activation. Currently not supported. |
George Wort | a1e7e28 | 2019-01-15 11:00:29 +0000 | [diff] [blame] | 210 | * |
| 211 | * @return a status |
| 212 | */ |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 213 | static Status validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output, const ActivationLayerInfo &act_info = ActivationLayerInfo()); |
Michalis Spyrou | ce0c675 | 2020-06-18 10:14:57 +0100 | [diff] [blame] | 214 | |
| 215 | // Inherited methods overridden: |
| 216 | void run() override; |
| 217 | |
| 218 | private: |
| 219 | struct Impl; |
| 220 | std::unique_ptr<Impl> _impl; |
George Wort | a1e7e28 | 2019-01-15 11:00:29 +0000 | [diff] [blame] | 221 | }; |
| 222 | |
Usama Arif | 81e671e | 2019-05-13 13:33:14 +0100 | [diff] [blame] | 223 | /** Basic function to run @ref NEArithmeticOperationKernel for power |
| 224 | * |
| 225 | * @note The tensor data type for the inputs must be F16/F32. |
| 226 | * @note The function performs a elementwise power of in1 to in2 (i.e., out[i] = in1[i] ^ in2[i]) |
| 227 | * @note For an exponent that is a float, this function will only work with a positive base. |
| 228 | */ |
Michalis Spyrou | ce0c675 | 2020-06-18 10:14:57 +0100 | [diff] [blame] | 229 | class NEElementwisePower : public IFunction |
Usama Arif | 81e671e | 2019-05-13 13:33:14 +0100 | [diff] [blame] | 230 | { |
| 231 | public: |
Michalis Spyrou | ce0c675 | 2020-06-18 10:14:57 +0100 | [diff] [blame] | 232 | /** Default Constructor */ |
| 233 | NEElementwisePower(); |
| 234 | /** Default Destructor */ |
| 235 | ~NEElementwisePower(); |
| 236 | /** Prevent instances of this class from being copied (As this class contains pointers) */ |
| 237 | NEElementwisePower(const NEElementwisePower &) = delete; |
| 238 | /** Default move constructor */ |
| 239 | NEElementwisePower(NEElementwisePower &&); |
| 240 | /** Prevent instances of this class from being copied (As this class contains pointers) */ |
| 241 | NEElementwisePower &operator=(const NEElementwisePower &) = delete; |
| 242 | /** Default move assignment operator */ |
| 243 | NEElementwisePower &operator=(NEElementwisePower &&); |
Usama Arif | 81e671e | 2019-05-13 13:33:14 +0100 | [diff] [blame] | 244 | /** Initialise the kernel's inputs, output and conversion policy. |
| 245 | * |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 246 | * @param[in, out] input1 First tensor input. Data types supported: F16/F32. |
| 247 | * @param[in, out] input2 Second tensor input. Data types supported: Same as @p input1. |
| 248 | * @param[out] output Output tensor. Data types supported: Same as @p input1. |
| 249 | * @param[in] act_info (Optional) Activation layer information in case of a fused activation. Currently not supported. |
Usama Arif | 81e671e | 2019-05-13 13:33:14 +0100 | [diff] [blame] | 250 | */ |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 251 | void configure(ITensor *input1, ITensor *input2, ITensor *output, const ActivationLayerInfo &act_info = ActivationLayerInfo()); |
Usama Arif | 81e671e | 2019-05-13 13:33:14 +0100 | [diff] [blame] | 252 | /** Static function to check if given info will lead to a valid configuration of @ref NEArithmeticOperationKernel for power |
| 253 | * |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 254 | * @param[in] input1 First tensor input info. Data types supported: F16/F32. |
| 255 | * @param[in] input2 Second tensor input info. Data types supported: Same as @p input1. |
| 256 | * @param[in] output Output tensor info. Data types supported: Same as @p input1. |
| 257 | * @param[in] act_info (Optional) Activation layer information in case of a fused activation. Currently not supported. |
Usama Arif | 81e671e | 2019-05-13 13:33:14 +0100 | [diff] [blame] | 258 | * |
| 259 | * @return a status |
| 260 | */ |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 261 | static Status validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output, const ActivationLayerInfo &act_info = ActivationLayerInfo()); |
Michalis Spyrou | ce0c675 | 2020-06-18 10:14:57 +0100 | [diff] [blame] | 262 | |
| 263 | // Inherited methods overridden: |
| 264 | void run() override; |
| 265 | |
| 266 | private: |
| 267 | struct Impl; |
| 268 | std::unique_ptr<Impl> _impl; |
Usama Arif | 81e671e | 2019-05-13 13:33:14 +0100 | [diff] [blame] | 269 | }; |
| 270 | |
George Wort | a1e7e28 | 2019-01-15 11:00:29 +0000 | [diff] [blame] | 271 | /** Basic function to run @ref NEComparisonOperationKernel. |
George Wort | d88590f | 2018-12-12 17:39:58 +0000 | [diff] [blame] | 272 | * |
Michele Di Giorgio | 1c76c1d | 2020-08-28 13:25:31 +0100 | [diff] [blame] | 273 | * @note The tensor data type for the inputs must be U8/QASYMM8/QASYMM8_SIGNED/S16/F16/S32/F32. |
George Wort | d88590f | 2018-12-12 17:39:58 +0000 | [diff] [blame] | 274 | * @note The function performs a comparison operation between two tensors. |
| 275 | */ |
Michalis Spyrou | ce0c675 | 2020-06-18 10:14:57 +0100 | [diff] [blame] | 276 | class NEElementwiseComparison : public IFunction |
George Wort | d88590f | 2018-12-12 17:39:58 +0000 | [diff] [blame] | 277 | { |
| 278 | public: |
Michalis Spyrou | ce0c675 | 2020-06-18 10:14:57 +0100 | [diff] [blame] | 279 | /** Default Constructor */ |
| 280 | NEElementwiseComparison(); |
| 281 | /** Default Destructor */ |
| 282 | ~NEElementwiseComparison(); |
| 283 | /** Prevent instances of this class from being copied (As this class contains pointers) */ |
| 284 | NEElementwiseComparison(const NEElementwiseComparison &) = delete; |
| 285 | /** Default move constructor */ |
| 286 | NEElementwiseComparison(NEElementwiseComparison &&); |
| 287 | /** Prevent instances of this class from being copied (As this class contains pointers) */ |
| 288 | NEElementwiseComparison &operator=(const NEElementwiseComparison &) = delete; |
| 289 | /** Default move assignment operator */ |
| 290 | NEElementwiseComparison &operator=(NEElementwiseComparison &&); |
George Wort | d88590f | 2018-12-12 17:39:58 +0000 | [diff] [blame] | 291 | /** Initialise the kernel's inputs, output and conversion policy. |
| 292 | * |
Michele Di Giorgio | 1c76c1d | 2020-08-28 13:25:31 +0100 | [diff] [blame] | 293 | * @param[in, out] input1 First tensor input. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/F16/S32/F32. |
George Wort | d88590f | 2018-12-12 17:39:58 +0000 | [diff] [blame] | 294 | * @param[in, out] input2 Second tensor input. Data types supported: Same as @p input1. |
Michele Di Giorgio | f9b595a | 2020-07-03 13:34:52 +0100 | [diff] [blame] | 295 | * @param[out] output Output tensor. Data types supported: U8. |
George Wort | d88590f | 2018-12-12 17:39:58 +0000 | [diff] [blame] | 296 | * @param[in] op Comparison Operation to be performed. |
| 297 | */ |
| 298 | void configure(ITensor *input1, ITensor *input2, ITensor *output, ComparisonOperation op); |
| 299 | /** Static function to check if given info will lead to a valid configuration of @ref NEComparisonOperationKernel |
| 300 | * |
Michele Di Giorgio | 1c76c1d | 2020-08-28 13:25:31 +0100 | [diff] [blame] | 301 | * @param[in] input1 First tensor input info. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/F16/S32/F32. |
George Wort | d88590f | 2018-12-12 17:39:58 +0000 | [diff] [blame] | 302 | * @param[in] input2 Second tensor input info. Data types supported: Same as @p input1. |
Michele Di Giorgio | f9b595a | 2020-07-03 13:34:52 +0100 | [diff] [blame] | 303 | * @param[in] output Output tensor info. Data types supported: U8. |
George Wort | d88590f | 2018-12-12 17:39:58 +0000 | [diff] [blame] | 304 | * @param[in] op Comparison Operation to be performed. |
| 305 | * |
| 306 | * @return a status |
| 307 | */ |
| 308 | static Status validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output, ComparisonOperation op); |
Michalis Spyrou | ce0c675 | 2020-06-18 10:14:57 +0100 | [diff] [blame] | 309 | |
| 310 | // Inherited methods overridden: |
| 311 | void run() override; |
| 312 | |
| 313 | private: |
| 314 | struct Impl; |
| 315 | std::unique_ptr<Impl> _impl; |
George Wort | d88590f | 2018-12-12 17:39:58 +0000 | [diff] [blame] | 316 | }; |
| 317 | |
| 318 | /** Basic function to run @ref NEComparisonOperationKernel |
| 319 | * |
Michele Di Giorgio | 1c76c1d | 2020-08-28 13:25:31 +0100 | [diff] [blame] | 320 | * @note The tensor data type for the inputs must be U8/QASYMM8/QASYMM8_SIGNED/S16/F16/S32/F32. |
George Wort | d88590f | 2018-12-12 17:39:58 +0000 | [diff] [blame] | 321 | * @note The function performs a comparison operation between two tensors. |
| 322 | */ |
| 323 | template <ComparisonOperation op> |
Michalis Spyrou | ce0c675 | 2020-06-18 10:14:57 +0100 | [diff] [blame] | 324 | class NEElementwiseComparisonStatic : public IFunction |
George Wort | d88590f | 2018-12-12 17:39:58 +0000 | [diff] [blame] | 325 | { |
| 326 | public: |
Michalis Spyrou | ce0c675 | 2020-06-18 10:14:57 +0100 | [diff] [blame] | 327 | /** Default Constructor */ |
| 328 | NEElementwiseComparisonStatic(); |
| 329 | /** Default Destructor */ |
| 330 | ~NEElementwiseComparisonStatic(); |
| 331 | /** Prevent instances of this class from being copied (As this class contains pointers) */ |
| 332 | NEElementwiseComparisonStatic(const NEElementwiseComparisonStatic &) = delete; |
| 333 | /** Default move constructor */ |
| 334 | NEElementwiseComparisonStatic(NEElementwiseComparisonStatic &&); |
| 335 | /** Prevent instances of this class from being copied (As this class contains pointers) */ |
| 336 | NEElementwiseComparisonStatic &operator=(const NEElementwiseComparisonStatic &) = delete; |
| 337 | /** Default move assignment operator */ |
| 338 | NEElementwiseComparisonStatic &operator=(NEElementwiseComparisonStatic &&); |
George Wort | d88590f | 2018-12-12 17:39:58 +0000 | [diff] [blame] | 339 | /** Initialise the kernel's inputs, output and conversion policy. |
| 340 | * |
Michele Di Giorgio | 1c76c1d | 2020-08-28 13:25:31 +0100 | [diff] [blame] | 341 | * @param[in, out] input1 First tensor input. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/F16/S32/F32. |
George Wort | d88590f | 2018-12-12 17:39:58 +0000 | [diff] [blame] | 342 | * @param[in, out] input2 Second tensor input. Data types supported: Same as @p input1. |
| 343 | * @param[out] output Output tensor. Data types supported: U16/U32. |
| 344 | */ |
| 345 | void configure(ITensor *input1, ITensor *input2, ITensor *output); |
| 346 | /** Static function to check if given info will lead to a valid configuration of @ref NEComparisonOperationKernel |
| 347 | * |
Michele Di Giorgio | 1c76c1d | 2020-08-28 13:25:31 +0100 | [diff] [blame] | 348 | * @param[in] input1 First tensor input info. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/F16/S32/F32. |
George Wort | d88590f | 2018-12-12 17:39:58 +0000 | [diff] [blame] | 349 | * @param[in] input2 Second tensor input info. Data types supported: Same as @p input1. |
| 350 | * @param[in] output Output tensor info. Data types supported: U16/U32. |
| 351 | * |
| 352 | * @return a status |
| 353 | */ |
| 354 | static Status validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output); |
Michalis Spyrou | ce0c675 | 2020-06-18 10:14:57 +0100 | [diff] [blame] | 355 | |
| 356 | // Inherited methods overridden: |
| 357 | void run() override; |
| 358 | |
| 359 | private: |
| 360 | struct Impl; |
| 361 | std::unique_ptr<Impl> _impl; |
George Wort | d88590f | 2018-12-12 17:39:58 +0000 | [diff] [blame] | 362 | }; |
| 363 | |
| 364 | /** Basic function to run equal comparison. */ |
| 365 | using NEEqual = NEElementwiseComparisonStatic<ComparisonOperation::Equal>; |
| 366 | /** Basic function to run not equal comparison. */ |
| 367 | using NENotEqual = NEElementwiseComparisonStatic<ComparisonOperation::NotEqual>; |
| 368 | /** Basic function to run greater comparison. */ |
| 369 | using NEGreater = NEElementwiseComparisonStatic<ComparisonOperation::Greater>; |
| 370 | /** Basic function to run greater-equal comparison. */ |
| 371 | using NEGreaterEqual = NEElementwiseComparisonStatic<ComparisonOperation::GreaterEqual>; |
| 372 | /** Basic function to run less comparison. */ |
| 373 | using NELess = NEElementwiseComparisonStatic<ComparisonOperation::Less>; |
| 374 | /** Basic function to run less-equal comparison. */ |
| 375 | using NELessEqual = NEElementwiseComparisonStatic<ComparisonOperation::LessEqual>; |
Michalis Spyrou | ce0c675 | 2020-06-18 10:14:57 +0100 | [diff] [blame] | 376 | |
| 377 | namespace experimental |
| 378 | { |
| 379 | /** Basic function to run @ref NEArithmeticOperationKernel for max |
| 380 | * |
| 381 | * @note The tensor data type for the inputs must be QASYMM8/QASYMM8_SIGNED/S16/F16/S32/F32. |
| 382 | * @note The function performs a max operation between two tensors. |
| 383 | */ |
| 384 | class NEElementwiseMax : public INEOperator |
| 385 | { |
| 386 | public: |
| 387 | /** Initialise the kernel's inputs, output and conversion policy. |
| 388 | * |
Georgios Pinitas | 09cad72 | 2020-07-22 12:11:20 +0100 | [diff] [blame] | 389 | * @param[in, out] input1 First tensor input info. Data types supported: QASYMM8/QASYMM8_SIGNED/S16/F16/S32/F32. |
| 390 | * @param[in, out] input2 Second tensor input info. Data types supported: Same as @p input1. |
| 391 | * @param[out] output Output tensor info. Data types supported: Same as @p input1. |
Michalis Spyrou | ce0c675 | 2020-06-18 10:14:57 +0100 | [diff] [blame] | 392 | */ |
Georgios Pinitas | 09cad72 | 2020-07-22 12:11:20 +0100 | [diff] [blame] | 393 | void configure(const ITensorInfo *input1, const ITensorInfo *input2, ITensorInfo *output); |
Michalis Spyrou | ce0c675 | 2020-06-18 10:14:57 +0100 | [diff] [blame] | 394 | /** Static function to check if given info will lead to a valid configuration of @ref NEArithmeticOperationKernel for max |
| 395 | * |
Georgios Pinitas | 09cad72 | 2020-07-22 12:11:20 +0100 | [diff] [blame] | 396 | * @param[in] input1 First tensor input info. Data types supported: QASYMM8/QASYMM8_SIGNED/S16/F16/S32/F32. |
| 397 | * @param[in] input2 Second tensor input info. Data types supported: Same as @p input1. |
| 398 | * @param[in] output Output tensor info. Data types supported: Same as @p input1. |
Michalis Spyrou | ce0c675 | 2020-06-18 10:14:57 +0100 | [diff] [blame] | 399 | * |
| 400 | * @return a status |
| 401 | */ |
Georgios Pinitas | 09cad72 | 2020-07-22 12:11:20 +0100 | [diff] [blame] | 402 | static Status validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output); |
Michalis Spyrou | ce0c675 | 2020-06-18 10:14:57 +0100 | [diff] [blame] | 403 | }; |
| 404 | |
| 405 | /** Basic function to run @ref NEArithmeticOperationKernel for min |
| 406 | * |
| 407 | * @note The tensor data type for the inputs must be QASYMM8/QASYMM8_SIGNED/S16/F16/S32/F32. |
| 408 | * @note The function performs a min operation between two tensors. |
| 409 | */ |
| 410 | class NEElementwiseMin : public INEOperator |
| 411 | { |
| 412 | public: |
| 413 | /** Initialise the kernel's inputs, output and conversion policy. |
| 414 | * |
Georgios Pinitas | 09cad72 | 2020-07-22 12:11:20 +0100 | [diff] [blame] | 415 | * @param[in, out] input1 First tensor input info. Data types supported: QASYMM8/QASYMM8_SIGNED/S16/F16/S32/F32. |
| 416 | * @param[in, out] input2 Second tensor input info. Data types supported: Same as @p input1. |
| 417 | * @param[out] output Output tensor info. Data types supported: Same as @p input1. |
Michalis Spyrou | ce0c675 | 2020-06-18 10:14:57 +0100 | [diff] [blame] | 418 | */ |
Georgios Pinitas | 09cad72 | 2020-07-22 12:11:20 +0100 | [diff] [blame] | 419 | void configure(const ITensorInfo *input1, const ITensorInfo *input2, ITensorInfo *output); |
Michalis Spyrou | ce0c675 | 2020-06-18 10:14:57 +0100 | [diff] [blame] | 420 | /** Static function to check if given info will lead to a valid configuration of @ref NEArithmeticOperationKernel for min |
| 421 | * |
Georgios Pinitas | 09cad72 | 2020-07-22 12:11:20 +0100 | [diff] [blame] | 422 | * @param[in] input1 First tensor input info. Data types supported: QASYMM8/QASYMM8_SIGNED/S16/F16/S32/F32. |
| 423 | * @param[in] input2 Second tensor input info. Data types supported: Same as @p input1. |
| 424 | * @param[in] output Output tensor info. Data types supported: Same as @p input1. |
Michalis Spyrou | ce0c675 | 2020-06-18 10:14:57 +0100 | [diff] [blame] | 425 | * |
| 426 | * @return a status |
| 427 | */ |
Georgios Pinitas | 09cad72 | 2020-07-22 12:11:20 +0100 | [diff] [blame] | 428 | static Status validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output); |
Michalis Spyrou | ce0c675 | 2020-06-18 10:14:57 +0100 | [diff] [blame] | 429 | }; |
| 430 | |
| 431 | /** Basic function to run @ref NEArithmeticOperationKernel for squared difference |
| 432 | * |
| 433 | * @note The tensor data type for the inputs must be QASYMM8/QASYMM8_SIGNED/S16/F16/S32/F32. |
| 434 | * @note The function performs a squared different operation between two tensors (i.e., out[i] = (in1[i] - in2[i])^2 |
| 435 | */ |
| 436 | class NEElementwiseSquaredDiff : public INEOperator |
| 437 | { |
| 438 | public: |
| 439 | /** Initialise the kernel's inputs, output and conversion policy. |
| 440 | * |
Georgios Pinitas | 09cad72 | 2020-07-22 12:11:20 +0100 | [diff] [blame] | 441 | * @param[in, out] input1 First tensor input info. Data types supported: QASYMM8/QASYMM8_SIGNED/S16/F16/S32/F32. |
| 442 | * @param[in, out] input2 Second tensor input info. Data types supported: Same as @p input1. |
| 443 | * @param[out] output Output tensor info. Data types supported: Same as @p input1. |
Michalis Spyrou | ce0c675 | 2020-06-18 10:14:57 +0100 | [diff] [blame] | 444 | */ |
Georgios Pinitas | 09cad72 | 2020-07-22 12:11:20 +0100 | [diff] [blame] | 445 | void configure(const ITensorInfo *input1, const ITensorInfo *input2, ITensorInfo *output); |
Michalis Spyrou | ce0c675 | 2020-06-18 10:14:57 +0100 | [diff] [blame] | 446 | /** Static function to check if given info will lead to a valid configuration of @ref NEArithmeticOperationKernel for squared difference |
| 447 | * |
Georgios Pinitas | 09cad72 | 2020-07-22 12:11:20 +0100 | [diff] [blame] | 448 | * @param[in] input1 First tensor input info. Data types supported: QASYMM8/QASYMM8_SIGNED/S16/F16/S32/F32. |
| 449 | * @param[in] input2 Second tensor input info. Data types supported: Same as @p input1. |
| 450 | * @param[in] output Output tensor info. Data types supported: Same as @p input1. |
Michalis Spyrou | ce0c675 | 2020-06-18 10:14:57 +0100 | [diff] [blame] | 451 | * |
| 452 | * @return a status |
| 453 | */ |
Georgios Pinitas | 09cad72 | 2020-07-22 12:11:20 +0100 | [diff] [blame] | 454 | static Status validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output); |
Michalis Spyrou | ce0c675 | 2020-06-18 10:14:57 +0100 | [diff] [blame] | 455 | }; |
| 456 | |
| 457 | /** Basic function to run @ref NEArithmeticOperationKernel for division |
| 458 | * |
Georgios Pinitas | 1813422 | 2020-09-03 21:00:23 +0100 | [diff] [blame] | 459 | * @note The tensor data type for the inputs must be S32/F16/F32. |
| 460 | * @note The function performs a division operation between two tensors (i.e., out[i] = in1[i] / in2[i]) |
Michalis Spyrou | ce0c675 | 2020-06-18 10:14:57 +0100 | [diff] [blame] | 461 | */ |
| 462 | class NEElementwiseDivision : public INEOperator |
| 463 | { |
| 464 | public: |
| 465 | /** Initialise the kernel's inputs, output and conversion policy. |
| 466 | * |
Georgios Pinitas | 1813422 | 2020-09-03 21:00:23 +0100 | [diff] [blame] | 467 | * @param[in, out] input1 First tensor input info. Data types supported: S32/F16/F32. |
Georgios Pinitas | 09cad72 | 2020-07-22 12:11:20 +0100 | [diff] [blame] | 468 | * @param[in, out] input2 Second tensor input info. Data types supported: Same as @p input1. |
| 469 | * @param[out] output Output tensor info. Data types supported: Same as @p input1. |
Michalis Spyrou | ce0c675 | 2020-06-18 10:14:57 +0100 | [diff] [blame] | 470 | */ |
Georgios Pinitas | 09cad72 | 2020-07-22 12:11:20 +0100 | [diff] [blame] | 471 | void configure(const ITensorInfo *input1, const ITensorInfo *input2, ITensorInfo *output); |
Michalis Spyrou | ce0c675 | 2020-06-18 10:14:57 +0100 | [diff] [blame] | 472 | /** Static function to check if given info will lead to a valid configuration of @ref NEArithmeticOperationKernel for division |
| 473 | * |
Georgios Pinitas | 1813422 | 2020-09-03 21:00:23 +0100 | [diff] [blame] | 474 | * @param[in] input1 First tensor input info. Data types supported: S32/F16/F32. |
Georgios Pinitas | 09cad72 | 2020-07-22 12:11:20 +0100 | [diff] [blame] | 475 | * @param[in] input2 Second tensor input info. Data types supported: Same as @p input1. |
| 476 | * @param[in] output Output tensor info. Data types supported: Same as @p input1. |
Michalis Spyrou | ce0c675 | 2020-06-18 10:14:57 +0100 | [diff] [blame] | 477 | * |
| 478 | * @return a status |
| 479 | */ |
Georgios Pinitas | 09cad72 | 2020-07-22 12:11:20 +0100 | [diff] [blame] | 480 | static Status validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output); |
Michalis Spyrou | ce0c675 | 2020-06-18 10:14:57 +0100 | [diff] [blame] | 481 | }; |
| 482 | |
| 483 | /** Basic function to run @ref NEArithmeticOperationKernel for power |
| 484 | * |
| 485 | * @note The tensor data type for the inputs must be F16/F32. |
| 486 | * @note The function performs a elementwise power of in1 to in2 (i.e., out[i] = in1[i] ^ in2[i]) |
| 487 | * @note For an exponent that is a float, this function will only work with a positive base. |
| 488 | */ |
| 489 | class NEElementwisePower : public INEOperator |
| 490 | { |
| 491 | public: |
| 492 | /** Initialise the kernel's inputs, output and conversion policy. |
| 493 | * |
Georgios Pinitas | 09cad72 | 2020-07-22 12:11:20 +0100 | [diff] [blame] | 494 | * @param[in, out] input1 First tensor input info. Data types supported: F16/F32. |
| 495 | * @param[in, out] input2 Second tensor input info. Data types supported: Same as @p input1. |
| 496 | * @param[out] output Output tensor info. Data types supported: Same as @p input1. |
Michalis Spyrou | ce0c675 | 2020-06-18 10:14:57 +0100 | [diff] [blame] | 497 | */ |
Georgios Pinitas | 09cad72 | 2020-07-22 12:11:20 +0100 | [diff] [blame] | 498 | void configure(const ITensorInfo *input1, const ITensorInfo *input2, ITensorInfo *output); |
Michalis Spyrou | ce0c675 | 2020-06-18 10:14:57 +0100 | [diff] [blame] | 499 | /** Static function to check if given info will lead to a valid configuration of @ref NEArithmeticOperationKernel for power |
| 500 | * |
Georgios Pinitas | 09cad72 | 2020-07-22 12:11:20 +0100 | [diff] [blame] | 501 | * @param[in] input1 First tensor input info. Data types supported: F16/F32. |
| 502 | * @param[in] input2 Second tensor input info. Data types supported: Same as @p input1. |
| 503 | * @param[in] output Output tensor info. Data types supported: Same as @p input1. |
Michalis Spyrou | ce0c675 | 2020-06-18 10:14:57 +0100 | [diff] [blame] | 504 | * |
| 505 | * @return a status |
| 506 | */ |
Georgios Pinitas | 09cad72 | 2020-07-22 12:11:20 +0100 | [diff] [blame] | 507 | static Status validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output); |
Michalis Spyrou | ce0c675 | 2020-06-18 10:14:57 +0100 | [diff] [blame] | 508 | }; |
| 509 | |
| 510 | /** Basic function to run @ref NEComparisonOperationKernel. |
| 511 | * |
| 512 | * @note The tensor data type for the inputs must be QASYMM8/QASYMM8_SIGNED/S16/F16/S32/F32. |
| 513 | * @note The function performs a comparison operation between two tensors. |
| 514 | */ |
| 515 | class NEElementwiseComparison : public INEOperator |
| 516 | { |
| 517 | public: |
| 518 | /** Initialise the kernel's inputs, output and conversion policy. |
| 519 | * |
| 520 | * @param[in, out] input1 First tensor input info. Data types supported: QASYMM8/QASYMM8_SIGNED/S16/F16/S32/F32. |
| 521 | * @param[in, out] input2 Second tensor input info. Data types supported: Same as @p input1. |
| 522 | * @param[out] output Output tensor info. Data types supported: U16/U32. |
| 523 | * @param[in] op Comparison Operation to be performed. |
| 524 | */ |
| 525 | void configure(const ITensorInfo *input1, const ITensorInfo *input2, ITensorInfo *output, ComparisonOperation op); |
| 526 | /** Static function to check if given info will lead to a valid configuration of @ref NEComparisonOperationKernel |
| 527 | * |
| 528 | * @param[in] input1 First tensor input info. Data types supported: QASYMM8/QASYMM8_SIGNED/S16/F16/S32/F32. |
| 529 | * @param[in] input2 Second tensor input info. Data types supported: Same as @p input1. |
| 530 | * @param[in] output Output tensor info. Data types supported: U16/U32. |
| 531 | * @param[in] op Comparison Operation to be performed. |
| 532 | * |
| 533 | * @return a status |
| 534 | */ |
| 535 | static Status validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output, ComparisonOperation op); |
Michalis Spyrou | ce0c675 | 2020-06-18 10:14:57 +0100 | [diff] [blame] | 536 | }; |
| 537 | |
| 538 | /** Basic function to run @ref NEComparisonOperationKernel |
| 539 | * |
| 540 | * @note The tensor data type for the inputs must be QASYMM8/QASYMM8_SIGNED/S16/F16/S32/F32. |
| 541 | * @note The function performs a comparison operation between two tensors. |
| 542 | */ |
| 543 | template <ComparisonOperation op> |
| 544 | class NEElementwiseComparisonStatic : public INEOperator |
| 545 | { |
| 546 | public: |
| 547 | /** Initialise the kernel's inputs, output and conversion policy. |
| 548 | * |
| 549 | * @param[in, out] input1 First tensor input info. Data types supported: QASYMM8/QASYMM8_SIGNED/S16/F16/S32/F32. |
| 550 | * @param[in, out] input2 Second tensor input info. Data types supported: Same as @p input1. |
| 551 | * @param[out] output Output tensor info. Data types supported: U16/U32. |
| 552 | */ |
| 553 | void configure(const ITensorInfo *input1, const ITensorInfo *input2, ITensorInfo *output); |
| 554 | /** Static function to check if given info will lead to a valid configuration of @ref NEComparisonOperationKernel |
| 555 | * |
| 556 | * @param[in] input1 First tensor input info. Data types supported: QASYMM8/QASYMM8_SIGNED/S16/F16/S32/F32. |
| 557 | * @param[in] input2 Second tensor input info. Data types supported: Same as @p input1. |
| 558 | * @param[in] output Output tensor info. Data types supported: U16/U32. |
| 559 | * |
| 560 | * @return a status |
| 561 | */ |
| 562 | static Status validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output); |
Michalis Spyrou | ce0c675 | 2020-06-18 10:14:57 +0100 | [diff] [blame] | 563 | }; |
| 564 | |
| 565 | /** Basic function to run equal comparison. */ |
| 566 | using NEEqual = NEElementwiseComparisonStatic<ComparisonOperation::Equal>; |
| 567 | /** Basic function to run not equal comparison. */ |
| 568 | using NENotEqual = NEElementwiseComparisonStatic<ComparisonOperation::NotEqual>; |
| 569 | /** Basic function to run greater comparison. */ |
| 570 | using NEGreater = NEElementwiseComparisonStatic<ComparisonOperation::Greater>; |
| 571 | /** Basic function to run greater-equal comparison. */ |
| 572 | using NEGreaterEqual = NEElementwiseComparisonStatic<ComparisonOperation::GreaterEqual>; |
| 573 | /** Basic function to run less comparison. */ |
| 574 | using NELess = NEElementwiseComparisonStatic<ComparisonOperation::Less>; |
| 575 | /** Basic function to run less-equal comparison. */ |
| 576 | using NELessEqual = NEElementwiseComparisonStatic<ComparisonOperation::LessEqual>; |
| 577 | } // namespace experimental |
giuros01 | 92fd943 | 2018-12-03 17:30:00 +0000 | [diff] [blame] | 578 | } // namespace arm_compute |
Michalis Spyrou | f464337 | 2019-11-29 16:17:13 +0000 | [diff] [blame] | 579 | #endif /* ARM_COMPUTE_NEELEMENTWISEOPERATIONS_H */ |