blob: 5cbf1237e4457aed933de5274f5320a0aaf48a91 [file] [log] [blame]
giuros0192fd9432018-12-03 17:30:00 +00001/*
2 * Copyright (c) 2018 ARM Limited.
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, INNEUDING 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 NEAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARI SING 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_NEELEMENTWISEOPERATIONS_H__
25#define __ARM_COMPUTE_NEELEMENTWISEOPERATIONS_H__
26
27#include "arm_compute/core/Types.h"
28#include "arm_compute/runtime/NEON/INESimpleFunction.h"
29
30namespace arm_compute
31{
32class ITensor;
33
34/** Basic function to run @ref NEArithmeticOperationKernel for max
35 *
36 * @note The tensor data type for the inputs must be S16/F16/S32/F32.
37 * @note The function performs a max operation between two tensors.
38 */
39class NEElementwiseMax : public INESimpleFunction
40{
41public:
42 /** Initialise the kernel's inputs, output and conversion policy.
43 *
44 * @param[in, out] input1 First tensor input. Data types supported: QASYMM8/S16/F16/S32/F32.
45 * @param[in, out] input2 Second tensor input. Data types supported: Same as @p input1.
46 * @param[out] output Output tensor. Data types supported: Same as @p input1.
47 */
48 void configure(ITensor *input1, ITensor *input2, ITensor *output);
49 /** Static function to check if given info will lead to a valid configuration of @ref NEArithmeticOperationKernel for max
50 *
51 * @param[in] input1 First tensor input info. Data types supported: QASYMM8/S16/F16/S32/F32.
52 * @param[in] input2 Second tensor input info. Data types supported: Same as @p input1.
53 * @param[in] output Output tensor info. Data types supported: Same as @p input1.
54 *
55 * @return a status
56 */
57 static Status validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output);
58};
59
60/** Basic function to run @ref NEArithmeticOperationKernel for min
61 *
62 * @note The tensor data type for the inputs must be S16/F16/S32/F32.
63 * @note The function performs a max operation between two tensors.
64 */
65class NEElementwiseMin : public INESimpleFunction
66{
67public:
68 /** Initialise the kernel's inputs, output and conversion policy.
69 *
70 * @param[in, out] input1 First tensor input. Data types supported: QASYMM8/S16/F16/S32/F32.
71 * @param[in, out] input2 Second tensor input. Data types supported: Same as @p input1.
72 * @param[out] output Output tensor. Data types supported: Same as @p input1.
73 */
74 void configure(ITensor *input1, ITensor *input2, ITensor *output);
75 /** Static function to check if given info will lead to a valid configuration of @ref NEArithmeticOperationKernel for min
76 *
77 * @param[in] input1 First tensor input info. Data types supported: QASYMM8/S16/F16/S32/F32.
78 * @param[in] input2 Second tensor input info. Data types supported: Same as @p input1.
79 * @param[in] output Output tensor info. Data types supported: Same as @p input1.
80 *
81 * @return a status
82 */
83 static Status validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output);
84};
85
86/** Basic function to run @ref NEArithmeticOperationKernel for squared difference
87 *
88 * @note The tensor data type for the inputs must be S16/F16/S32/F32.
89 * @note The function performs a squared different operation between two tensors (i.e., out[i] = (in1[i] - in2[i])^2
90 */
91class NEElementwiseSquaredDiff : public INESimpleFunction
92{
93public:
94 /** Initialise the kernel's inputs, output and conversion policy.
95 *
96 * @param[in, out] input1 First tensor input. Data types supported: QASYMM8/S16/F16/S32/F32.
97 * @param[in, out] input2 Second tensor input. Data types supported: Same as @p input1.
98 * @param[out] output Output tensor. Data types supported: Same as @p input1.
99 */
100 void configure(ITensor *input1, ITensor *input2, ITensor *output);
101 /** Static function to check if given info will lead to a valid configuration of @ref NEArithmeticOperationKernel for squared difference
102 *
103 * @param[in] input1 First tensor input info. Data types supported: QASYMM8/S16/F16/S32/F32.
104 * @param[in] input2 Second tensor input info. Data types supported: Same as @p input1.
105 * @param[in] output Output tensor info. Data types supported: Same as @p input1.
106 *
107 * @return a status
108 */
109 static Status validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output);
110};
111} // namespace arm_compute
112#endif /* __ARM_COMPUTE_NEELEMENTWISEOPERATIONS_H__ */