blob: 44b70bbe850dd9fad7b8ac7ee0e80aaad09c571d [file] [log] [blame]
giuros0192fd9432018-12-03 17:30:00 +00001/*
Sang-Hoon Park63001ac2021-01-18 14:20:27 +00002 * Copyright (c) 2018-2021 Arm Limited.
giuros0192fd9432018-12-03 17:30:00 +00003 *
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 Wortd88590f2018-12-12 17:39:58 +000017 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
giuros0192fd9432018-12-03 17:30:00 +000018 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
George Wortd88590f2018-12-12 17:39:58 +000019 * 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,
giuros0192fd9432018-12-03 17:30:00 +000021 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 */
Michalis Spyrouf4643372019-11-29 16:17:13 +000024#ifndef ARM_COMPUTE_NEELEMENTWISEOPERATIONS_H
25#define ARM_COMPUTE_NEELEMENTWISEOPERATIONS_H
giuros0192fd9432018-12-03 17:30:00 +000026
27#include "arm_compute/core/Types.h"
Michalis Spyrouce0c6752020-06-18 10:14:57 +010028#include "arm_compute/runtime/IFunction.h"
29#include "arm_compute/runtime/NEON/INEOperator.h"
giuros0192fd9432018-12-03 17:30:00 +000030
31namespace arm_compute
32{
33class ITensor;
34
Sang-Hoon Park63001ac2021-01-18 14:20:27 +000035/** Basic function to run @ref cpu::kernels::CpuArithmeticKernel for max
giuros0192fd9432018-12-03 17:30:00 +000036 *
morgolock6427c822020-01-13 11:53:20 +000037 * @note The tensor data type for the inputs must be QASYMM8/QASYMM8_SIGNED/S16/F16/S32/F32.
giuros0192fd9432018-12-03 17:30:00 +000038 * @note The function performs a max operation between two tensors.
39 */
Michalis Spyrouce0c6752020-06-18 10:14:57 +010040class NEElementwiseMax : public IFunction
giuros0192fd9432018-12-03 17:30:00 +000041{
42public:
Michalis Spyrouce0c6752020-06-18 10:14:57 +010043 /** 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 &&);
giuros0192fd9432018-12-03 17:30:00 +000055 /** Initialise the kernel's inputs, output and conversion policy.
56 *
Giorgio Arena8b2a7d32020-02-11 17:21:31 +000057 * @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.
giuros0192fd9432018-12-03 17:30:00 +000061 */
Giorgio Arena8b2a7d32020-02-11 17:21:31 +000062 void configure(ITensor *input1, ITensor *input2, ITensor *output, const ActivationLayerInfo &act_info = ActivationLayerInfo());
Sang-Hoon Park63001ac2021-01-18 14:20:27 +000063 /** Static function to check if given info will lead to a valid configuration of @ref cpu::kernels::CpuArithmeticKernel for max
giuros0192fd9432018-12-03 17:30:00 +000064 *
Giorgio Arena8b2a7d32020-02-11 17:21:31 +000065 * @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.
giuros0192fd9432018-12-03 17:30:00 +000069 *
70 * @return a status
71 */
Giorgio Arena8b2a7d32020-02-11 17:21:31 +000072 static Status validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output, const ActivationLayerInfo &act_info = ActivationLayerInfo());
Michalis Spyrouce0c6752020-06-18 10:14:57 +010073
74 // Inherited methods overridden:
75 void run() override;
76
77private:
78 struct Impl;
79 std::unique_ptr<Impl> _impl;
giuros0192fd9432018-12-03 17:30:00 +000080};
81
Sang-Hoon Park63001ac2021-01-18 14:20:27 +000082/** Basic function to run @ref cpu::kernels::CpuArithmeticKernel for min
giuros0192fd9432018-12-03 17:30:00 +000083 *
morgolock6427c822020-01-13 11:53:20 +000084 * @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.
giuros0192fd9432018-12-03 17:30:00 +000086 */
Michalis Spyrouce0c6752020-06-18 10:14:57 +010087class NEElementwiseMin : public IFunction
giuros0192fd9432018-12-03 17:30:00 +000088{
89public:
Michalis Spyrouce0c6752020-06-18 10:14:57 +010090 /** 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 &&);
giuros0192fd9432018-12-03 17:30:00 +0000102 /** Initialise the kernel's inputs, output and conversion policy.
103 *
Giorgio Arena8b2a7d32020-02-11 17:21:31 +0000104 * @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.
giuros0192fd9432018-12-03 17:30:00 +0000108 */
Giorgio Arena8b2a7d32020-02-11 17:21:31 +0000109 void configure(ITensor *input1, ITensor *input2, ITensor *output, const ActivationLayerInfo &act_info = ActivationLayerInfo());
Sang-Hoon Park63001ac2021-01-18 14:20:27 +0000110 /** Static function to check if given info will lead to a valid configuration of @ref cpu::kernels::CpuArithmeticKernel for min
giuros0192fd9432018-12-03 17:30:00 +0000111 *
Giorgio Arena8b2a7d32020-02-11 17:21:31 +0000112 * @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.
giuros0192fd9432018-12-03 17:30:00 +0000116 *
117 * @return a status
118 */
Giorgio Arena8b2a7d32020-02-11 17:21:31 +0000119 static Status validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output, const ActivationLayerInfo &act_info = ActivationLayerInfo());
Michalis Spyrouce0c6752020-06-18 10:14:57 +0100120
121 // Inherited methods overridden:
122 void run() override;
123
124private:
125 struct Impl;
126 std::unique_ptr<Impl> _impl;
giuros0192fd9432018-12-03 17:30:00 +0000127};
128
Sang-Hoon Park63001ac2021-01-18 14:20:27 +0000129/** Basic function to run @ref cpu::kernels::CpuArithmeticKernel for squared difference
giuros0192fd9432018-12-03 17:30:00 +0000130 *
morgolock6427c822020-01-13 11:53:20 +0000131 * @note The tensor data type for the inputs must be QASYMM8/QASYMM8_SIGNED/S16/F16/S32/F32.
giuros0192fd9432018-12-03 17:30:00 +0000132 * @note The function performs a squared different operation between two tensors (i.e., out[i] = (in1[i] - in2[i])^2
133 */
Michalis Spyrouce0c6752020-06-18 10:14:57 +0100134class NEElementwiseSquaredDiff : public IFunction
giuros0192fd9432018-12-03 17:30:00 +0000135{
136public:
Michalis Spyrouce0c6752020-06-18 10:14:57 +0100137 /** 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 &&);
giuros0192fd9432018-12-03 17:30:00 +0000149 /** Initialise the kernel's inputs, output and conversion policy.
150 *
Giorgio Arena8b2a7d32020-02-11 17:21:31 +0000151 * @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.
giuros0192fd9432018-12-03 17:30:00 +0000155 */
Giorgio Arena8b2a7d32020-02-11 17:21:31 +0000156 void configure(ITensor *input1, ITensor *input2, ITensor *output, const ActivationLayerInfo &act_info = ActivationLayerInfo());
Sang-Hoon Park63001ac2021-01-18 14:20:27 +0000157 /** Static function to check if given info will lead to a valid configuration of @ref cpu::kernels::CpuArithmeticKernel for squared difference
giuros0192fd9432018-12-03 17:30:00 +0000158 *
Giorgio Arena8b2a7d32020-02-11 17:21:31 +0000159 * @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.
giuros0192fd9432018-12-03 17:30:00 +0000163 *
164 * @return a status
165 */
Giorgio Arena8b2a7d32020-02-11 17:21:31 +0000166 static Status validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output, const ActivationLayerInfo &act_info = ActivationLayerInfo());
Michalis Spyrouce0c6752020-06-18 10:14:57 +0100167
168 // Inherited methods overridden:
169 void run() override;
170
171private:
172 struct Impl;
173 std::unique_ptr<Impl> _impl;
giuros0192fd9432018-12-03 17:30:00 +0000174};
George Wortd88590f2018-12-12 17:39:58 +0000175
Sang-Hoon Park63001ac2021-01-18 14:20:27 +0000176/** Basic function to run @ref cpu::kernels::CpuArithmeticKernel for division
George Worta1e7e282019-01-15 11:00:29 +0000177 *
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 Spyrouce0c6752020-06-18 10:14:57 +0100181class NEElementwiseDivision : public IFunction
George Worta1e7e282019-01-15 11:00:29 +0000182{
183public:
Michalis Spyrouce0c6752020-06-18 10:14:57 +0100184 /** 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 Worta1e7e282019-01-15 11:00:29 +0000196 /** Initialise the kernel's inputs, output and conversion policy.
197 *
Giorgio Arena8b2a7d32020-02-11 17:21:31 +0000198 * @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 Worta1e7e282019-01-15 11:00:29 +0000202 */
Giorgio Arena8b2a7d32020-02-11 17:21:31 +0000203 void configure(ITensor *input1, ITensor *input2, ITensor *output, const ActivationLayerInfo &act_info = ActivationLayerInfo());
Sang-Hoon Park63001ac2021-01-18 14:20:27 +0000204 /** Static function to check if given info will lead to a valid configuration of @ref cpu::kernels::CpuArithmeticKernel for division
George Worta1e7e282019-01-15 11:00:29 +0000205 *
Giorgio Arena8b2a7d32020-02-11 17:21:31 +0000206 * @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 Worta1e7e282019-01-15 11:00:29 +0000210 *
211 * @return a status
212 */
Giorgio Arena8b2a7d32020-02-11 17:21:31 +0000213 static Status validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output, const ActivationLayerInfo &act_info = ActivationLayerInfo());
Michalis Spyrouce0c6752020-06-18 10:14:57 +0100214
215 // Inherited methods overridden:
216 void run() override;
217
218private:
219 struct Impl;
220 std::unique_ptr<Impl> _impl;
George Worta1e7e282019-01-15 11:00:29 +0000221};
222
Sang-Hoon Park63001ac2021-01-18 14:20:27 +0000223/** Basic function to run @ref cpu::kernels::CpuArithmeticKernel for power
Usama Arif81e671e2019-05-13 13:33:14 +0100224 *
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 Spyrouce0c6752020-06-18 10:14:57 +0100229class NEElementwisePower : public IFunction
Usama Arif81e671e2019-05-13 13:33:14 +0100230{
231public:
Michalis Spyrouce0c6752020-06-18 10:14:57 +0100232 /** 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 Arif81e671e2019-05-13 13:33:14 +0100244 /** Initialise the kernel's inputs, output and conversion policy.
245 *
Giorgio Arena8b2a7d32020-02-11 17:21:31 +0000246 * @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 Arif81e671e2019-05-13 13:33:14 +0100250 */
Giorgio Arena8b2a7d32020-02-11 17:21:31 +0000251 void configure(ITensor *input1, ITensor *input2, ITensor *output, const ActivationLayerInfo &act_info = ActivationLayerInfo());
Sang-Hoon Park63001ac2021-01-18 14:20:27 +0000252 /** Static function to check if given info will lead to a valid configuration of @ref cpu::kernels::CpuArithmeticKernel for power
Usama Arif81e671e2019-05-13 13:33:14 +0100253 *
Giorgio Arena8b2a7d32020-02-11 17:21:31 +0000254 * @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 Arif81e671e2019-05-13 13:33:14 +0100258 *
259 * @return a status
260 */
Giorgio Arena8b2a7d32020-02-11 17:21:31 +0000261 static Status validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output, const ActivationLayerInfo &act_info = ActivationLayerInfo());
Michalis Spyrouce0c6752020-06-18 10:14:57 +0100262
263 // Inherited methods overridden:
264 void run() override;
265
266private:
267 struct Impl;
268 std::unique_ptr<Impl> _impl;
Usama Arif81e671e2019-05-13 13:33:14 +0100269};
270
Sang-Hoon Park63001ac2021-01-18 14:20:27 +0000271/** Basic function to run @ref cpu::kernels::CpuComparisonKernel.
George Wortd88590f2018-12-12 17:39:58 +0000272 *
Michele Di Giorgio1c76c1d2020-08-28 13:25:31 +0100273 * @note The tensor data type for the inputs must be U8/QASYMM8/QASYMM8_SIGNED/S16/F16/S32/F32.
George Wortd88590f2018-12-12 17:39:58 +0000274 * @note The function performs a comparison operation between two tensors.
275 */
Michalis Spyrouce0c6752020-06-18 10:14:57 +0100276class NEElementwiseComparison : public IFunction
George Wortd88590f2018-12-12 17:39:58 +0000277{
278public:
Michalis Spyrouce0c6752020-06-18 10:14:57 +0100279 /** 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 Wortd88590f2018-12-12 17:39:58 +0000291 /** Initialise the kernel's inputs, output and conversion policy.
292 *
Michele Di Giorgio1c76c1d2020-08-28 13:25:31 +0100293 * @param[in, out] input1 First tensor input. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/F16/S32/F32.
George Wortd88590f2018-12-12 17:39:58 +0000294 * @param[in, out] input2 Second tensor input. Data types supported: Same as @p input1.
Michele Di Giorgiof9b595a2020-07-03 13:34:52 +0100295 * @param[out] output Output tensor. Data types supported: U8.
George Wortd88590f2018-12-12 17:39:58 +0000296 * @param[in] op Comparison Operation to be performed.
297 */
298 void configure(ITensor *input1, ITensor *input2, ITensor *output, ComparisonOperation op);
Sang-Hoon Park63001ac2021-01-18 14:20:27 +0000299 /** Static function to check if given info will lead to a valid configuration of @ref cpu::kernels::CpuComparisonKernel
George Wortd88590f2018-12-12 17:39:58 +0000300 *
Michele Di Giorgio1c76c1d2020-08-28 13:25:31 +0100301 * @param[in] input1 First tensor input info. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/F16/S32/F32.
George Wortd88590f2018-12-12 17:39:58 +0000302 * @param[in] input2 Second tensor input info. Data types supported: Same as @p input1.
Michele Di Giorgiof9b595a2020-07-03 13:34:52 +0100303 * @param[in] output Output tensor info. Data types supported: U8.
George Wortd88590f2018-12-12 17:39:58 +0000304 * @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 Spyrouce0c6752020-06-18 10:14:57 +0100309
310 // Inherited methods overridden:
311 void run() override;
312
313private:
314 struct Impl;
315 std::unique_ptr<Impl> _impl;
George Wortd88590f2018-12-12 17:39:58 +0000316};
317
Sang-Hoon Park63001ac2021-01-18 14:20:27 +0000318/** Basic function to run @ref cpu::kernels::CpuComparisonKernel
George Wortd88590f2018-12-12 17:39:58 +0000319 *
Michele Di Giorgio1c76c1d2020-08-28 13:25:31 +0100320 * @note The tensor data type for the inputs must be U8/QASYMM8/QASYMM8_SIGNED/S16/F16/S32/F32.
George Wortd88590f2018-12-12 17:39:58 +0000321 * @note The function performs a comparison operation between two tensors.
322 */
323template <ComparisonOperation op>
Michalis Spyrouce0c6752020-06-18 10:14:57 +0100324class NEElementwiseComparisonStatic : public IFunction
George Wortd88590f2018-12-12 17:39:58 +0000325{
326public:
Michalis Spyrouce0c6752020-06-18 10:14:57 +0100327 /** 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 Wortd88590f2018-12-12 17:39:58 +0000339 /** Initialise the kernel's inputs, output and conversion policy.
340 *
Michele Di Giorgio1c76c1d2020-08-28 13:25:31 +0100341 * @param[in, out] input1 First tensor input. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/F16/S32/F32.
George Wortd88590f2018-12-12 17:39:58 +0000342 * @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);
Sang-Hoon Park63001ac2021-01-18 14:20:27 +0000346 /** Static function to check if given info will lead to a valid configuration of @ref cpu::kernels::CpuComparisonKernel
George Wortd88590f2018-12-12 17:39:58 +0000347 *
Michele Di Giorgio1c76c1d2020-08-28 13:25:31 +0100348 * @param[in] input1 First tensor input info. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/F16/S32/F32.
George Wortd88590f2018-12-12 17:39:58 +0000349 * @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 Spyrouce0c6752020-06-18 10:14:57 +0100355
356 // Inherited methods overridden:
357 void run() override;
358
359private:
360 struct Impl;
361 std::unique_ptr<Impl> _impl;
George Wortd88590f2018-12-12 17:39:58 +0000362};
363
364/** Basic function to run equal comparison. */
365using NEEqual = NEElementwiseComparisonStatic<ComparisonOperation::Equal>;
366/** Basic function to run not equal comparison. */
367using NENotEqual = NEElementwiseComparisonStatic<ComparisonOperation::NotEqual>;
368/** Basic function to run greater comparison. */
369using NEGreater = NEElementwiseComparisonStatic<ComparisonOperation::Greater>;
370/** Basic function to run greater-equal comparison. */
371using NEGreaterEqual = NEElementwiseComparisonStatic<ComparisonOperation::GreaterEqual>;
372/** Basic function to run less comparison. */
373using NELess = NEElementwiseComparisonStatic<ComparisonOperation::Less>;
374/** Basic function to run less-equal comparison. */
375using NELessEqual = NEElementwiseComparisonStatic<ComparisonOperation::LessEqual>;
Michalis Spyrouce0c6752020-06-18 10:14:57 +0100376
giuros0192fd9432018-12-03 17:30:00 +0000377} // namespace arm_compute
Michalis Spyrouf4643372019-11-29 16:17:13 +0000378#endif /* ARM_COMPUTE_NEELEMENTWISEOPERATIONS_H */