blob: 0ad23200c63e84dc51e5c44bf5291c8d54fbaa01 [file] [log] [blame]
Georgios Pinitas58bce682020-11-13 11:38:58 +00001/*
Sheri Zhang6124ce62021-05-04 14:03:13 +01002 * Copyright (c) 2020-2021 Arm Limited.
Georgios Pinitas58bce682020-11-13 11:38:58 +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 */
24#ifndef ARM_COMPUTE_NELOGICAL_H
25#define ARM_COMPUTE_NELOGICAL_H
26
27#include "arm_compute/core/Error.h"
28#include "arm_compute/runtime/IFunction.h"
Georgios Pinitas58bce682020-11-13 11:38:58 +000029
30#include <memory>
31
32namespace arm_compute
33{
34// Forward declarations
35class ITensor;
36class ITensorInfo;
37
38/** Basic function to perform logical AND */
39class NELogicalAnd : public IFunction
40{
41public:
42 /** Constructor */
43 NELogicalAnd();
Michele Di Giorgio13c497a2021-05-13 12:54:31 +010044 /** Prevent instances of this class from being copied (As this class contains pointers) */
45 NELogicalAnd(const NELogicalAnd &) = delete;
46 /** Prevent instances of this class from being moved (As this class contains non movable objects) */
47 NELogicalAnd(NELogicalAnd &&) = delete;
48 /** Prevent instances of this class from being copied (As this class contains pointers) */
49 NELogicalAnd &operator=(const NELogicalAnd &) = delete;
50 /** Prevent instances of this class from being moved (As this class contains non movable objects) */
51 NELogicalAnd &operator=(NELogicalAnd &&) = delete;
Georgios Pinitas58bce682020-11-13 11:38:58 +000052 /** Destructor */
53 ~NELogicalAnd();
Georgios Pinitas58bce682020-11-13 11:38:58 +000054
55 /** Initialise the kernel's inputs and output
56 *
Sheri Zhang6124ce62021-05-04 14:03:13 +010057 * Valid data layouts:
58 * - All
59 *
60 * Valid data type configurations:
61 * |src0 |src1 |dst |
62 * |:--------------|:-------------|:------------|
63 * |U8 |U8 |U8 |
64 *
Georgios Pinitas58bce682020-11-13 11:38:58 +000065 * @param[in] input1 First tensor input. Data type supported: U8.
66 * @param[in] input2 Second tensor input. Data type supported: U8.
67 * @param[out] output Output tensor. Data type supported: U8.
68 */
69 void configure(const ITensor *input1, const ITensor *input2, ITensor *output);
70 /** Static function to check if given info will lead to a valid configuration of @ref NELogicalAnd
71 *
72 * @param[in] input1 First input tensor info. Data types supported: U8.
73 * @param[in] input2 Second input tensor info. Data types supported: U8.
74 * @param[in] output Output tensor info. Data type supported: U8
75 *
76 * @return a status
77 */
78 static Status validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output);
79
80 // Inherited methods overridden
81 void run() override;
82
83private:
84 struct Impl;
85 std::unique_ptr<Impl> _impl;
86};
87
88/** Basic function to perform logical OR */
89class NELogicalOr : public IFunction
90{
91public:
92 /** Constructor */
93 NELogicalOr();
Michele Di Giorgio13c497a2021-05-13 12:54:31 +010094 /** Prevent instances of this class from being copied (As this class contains pointers) */
95 NELogicalOr(const NELogicalOr &) = delete;
96 /** Prevent instances of this class from being moved (As this class contains non movable objects) */
97 NELogicalOr(NELogicalOr &&) = delete;
98 /** Prevent instances of this class from being copied (As this class contains pointers) */
99 NELogicalOr &operator=(const NELogicalOr &) = delete;
100 /** Prevent instances of this class from being moved (As this class contains non movable objects) */
101 NELogicalOr &operator=(NELogicalOr &&) = delete;
Georgios Pinitas58bce682020-11-13 11:38:58 +0000102 /** Destructor */
103 ~NELogicalOr();
Georgios Pinitas58bce682020-11-13 11:38:58 +0000104
105 /** Initialise the kernel's inputs and output
106 *
Sheri Zhang6124ce62021-05-04 14:03:13 +0100107 * Valid data layouts:
108 * - All
109 *
110 * Valid data type configurations:
111 * |src0 |src1 |dst |
112 * |:--------------|:-------------|:------------|
113 * |U8 |U8 |U8 |
114 *
Georgios Pinitas58bce682020-11-13 11:38:58 +0000115 * @param[in] input1 First tensor input. Data type supported: U8.
116 * @param[in] input2 Second tensor input. Data type supported: U8.
117 * @param[out] output Output tensor. Data type supported: U8.
118 */
119 void configure(const ITensor *input1, const ITensor *input2, ITensor *output);
120 /** Static function to check if given info will lead to a valid configuration of @ref NELogicalOr
121 *
122 * @param[in] input1 First input tensor info. Data types supported: U8.
123 * @param[in] input2 Second input tensor info. Data types supported: U8.
124 * @param[in] output Output tensor info. Data type supported: U8
125 *
126 * @return a status
127 */
128 static Status validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output);
129
130 // Inherited methods overridden
131 void run() override;
132
133private:
134 struct Impl;
135 std::unique_ptr<Impl> _impl;
136};
137
138/** Basic function to perform logical NOT */
139class NELogicalNot : public IFunction
140{
141public:
142 /** Constructor */
143 NELogicalNot();
Michele Di Giorgio13c497a2021-05-13 12:54:31 +0100144 /** Prevent instances of this class from being copied (As this class contains pointers) */
145 NELogicalNot(const NELogicalNot &) = delete;
146 /** Prevent instances of this class from being moved (As this class contains non movable objects) */
147 NELogicalNot(NELogicalNot &&) = delete;
148 /** Prevent instances of this class from being copied (As this class contains pointers) */
149 NELogicalNot &operator=(const NELogicalNot &) = delete;
150 /** Prevent instances of this class from being moved (As this class contains non movable objects) */
151 NELogicalNot &operator=(NELogicalNot &&) = delete;
Georgios Pinitas58bce682020-11-13 11:38:58 +0000152 /** Destructor */
153 ~NELogicalNot();
Georgios Pinitas58bce682020-11-13 11:38:58 +0000154
155 /** Initialise the kernel's inputs and output
156 *
Sheri Zhang6124ce62021-05-04 14:03:13 +0100157 * Valid data layouts:
158 * - All
159 *
160 * Valid data type configurations:
161 * |src |dst |
162 * |:--------------|:-------------|
163 * |U8 |U8 |
164 *
Georgios Pinitas58bce682020-11-13 11:38:58 +0000165 * @param[in] input Input tensor. Data type supported: U8.
166 * @param[out] output Output tensor. Data type supported: U8.
167 */
168 void configure(const ITensor *input, ITensor *output);
169 /** Static function to check if given info will lead to a valid configuration of @ref NELogicalNot
170 *
171 * @param[in] input Input tensor info. Data types supported: U8.
172 * @param[in] output Output tensor info. Data type supported: U8
173 *
174 * @return a status
175 */
176 static Status validate(const ITensorInfo *input, const ITensorInfo *output);
177
178 // Inherited methods overridden
179 void run() override;
180
181private:
182 struct Impl;
183 std::unique_ptr<Impl> _impl;
184};
185} // namespace arm_compute
186#endif /* ARM_COMPUTE_NELOGICAL_H */