blob: 8b3301889a947afe9c7331612b7dc4c6c65aefa4 [file] [log] [blame]
George Wort5a97b282018-12-21 16:21:04 +00001/*
Michele Di Giorgiod9eaf612020-07-08 11:12:57 +01002 * Copyright (c) 2018-2020 Arm Limited.
George Wort5a97b282018-12-21 16:21:04 +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
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 Spyrouf4643372019-11-29 16:17:13 +000024#ifndef ARM_COMPUTE_NEELEMENTWISEUNARYLAYER_H
25#define ARM_COMPUTE_NEELEMENTWISEUNARYLAYER_H
George Wort5a97b282018-12-21 16:21:04 +000026
Manuel Bottini80feed52020-06-03 13:20:41 +010027#include "arm_compute/runtime/NEON/INESimpleFunctionNoBorder.h"
George Wort5a97b282018-12-21 16:21:04 +000028
29namespace arm_compute
30{
31class ITensor;
32
33/** Basic function to perform inverse square root on an input tensor. */
Manuel Bottini80feed52020-06-03 13:20:41 +010034class NERsqrtLayer : public INESimpleFunctionNoBorder
George Wort5a97b282018-12-21 16:21:04 +000035{
36public:
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 Bottini80feed52020-06-03 13:20:41 +010054class NEExpLayer : public INESimpleFunctionNoBorder
George Wort5a97b282018-12-21 16:21:04 +000055{
56public:
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 Ariff6e475c2019-05-10 12:06:28 +010072
73/** Basic function to negate an input tensor. */
Manuel Bottini80feed52020-06-03 13:20:41 +010074class NENegLayer : public INESimpleFunctionNoBorder
Usama Ariff6e475c2019-05-10 12:06:28 +010075{
76public:
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 Arifc255aa72019-05-13 16:26:29 +010092
93/** Basic function to compute the natural logarithm of an input tensor. */
Manuel Bottini80feed52020-06-03 13:20:41 +010094class NELogLayer : public INESimpleFunctionNoBorder
Usama Arifc255aa72019-05-13 16:26:29 +010095{
96public:
97 /** Initialize the function
98 *
Michele Di Giorgiof9b595a2020-07-03 13:34:52 +010099 * @param[in] input Input tensor. Data types supported: F16/F32.
Usama Arifc255aa72019-05-13 16:26:29 +0100100 * @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 Giorgiof9b595a2020-07-03 13:34:52 +0100105 * @param[in] input First tensor input info. Data types supported: F16/F32.
Usama Arifc255aa72019-05-13 16:26:29 +0100106 * @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 Bottini6ac59922019-05-15 14:06:02 +0100112
113/** Basic function to compute the absolute value of an input tensor. */
Manuel Bottini80feed52020-06-03 13:20:41 +0100114class NEAbsLayer : public INESimpleFunctionNoBorder
Manuel Bottini6ac59922019-05-15 14:06:02 +0100115{
116public:
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 Arif0a5a57a2019-05-23 14:20:33 +0100132
133/** Basic function to compute the round value elementwise of an input tensor. */
Manuel Bottini80feed52020-06-03 13:20:41 +0100134class NERoundLayer : public INESimpleFunctionNoBorder
Usama Arif0a5a57a2019-05-23 14:20:33 +0100135{
136public:
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 Bottinied753262019-05-15 15:30:47 +0100152
153/** Basic function to compute the sine of an input tensor. */
Manuel Bottini80feed52020-06-03 13:20:41 +0100154class NESinLayer : public INESimpleFunctionNoBorder
Manuel Bottinied753262019-05-15 15:30:47 +0100155{
156public:
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 Wort5a97b282018-12-21 16:21:04 +0000172} // namespace arm_compute
Michalis Spyrouf4643372019-11-29 16:17:13 +0000173#endif /* ARM_COMPUTE_NEELEMENTWISEUNARYLAYER_H */