blob: 5cf5336f4fbe7be9347a0a589a60294441db0acb [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"
29#include "arm_compute/runtime/Macros.h"
30
31#include <memory>
32
33namespace arm_compute
34{
35// Forward declarations
36class ITensor;
37class ITensorInfo;
38
39/** Basic function to perform logical AND */
40class NELogicalAnd : public IFunction
41{
42public:
43 /** Constructor */
44 NELogicalAnd();
45 /** Destructor */
46 ~NELogicalAnd();
47 ARM_COMPUTE_DISALLOW_COPY_ALLOW_MOVE_INC(NELogicalAnd)
48
49 /** Initialise the kernel's inputs and output
50 *
Sheri Zhang6124ce62021-05-04 14:03:13 +010051 * Valid data layouts:
52 * - All
53 *
54 * Valid data type configurations:
55 * |src0 |src1 |dst |
56 * |:--------------|:-------------|:------------|
57 * |U8 |U8 |U8 |
58 *
Georgios Pinitas58bce682020-11-13 11:38:58 +000059 * @param[in] input1 First tensor input. Data type supported: U8.
60 * @param[in] input2 Second tensor input. Data type supported: U8.
61 * @param[out] output Output tensor. Data type supported: U8.
62 */
63 void configure(const ITensor *input1, const ITensor *input2, ITensor *output);
64 /** Static function to check if given info will lead to a valid configuration of @ref NELogicalAnd
65 *
66 * @param[in] input1 First input tensor info. Data types supported: U8.
67 * @param[in] input2 Second input tensor info. Data types supported: U8.
68 * @param[in] output Output tensor info. Data type supported: U8
69 *
70 * @return a status
71 */
72 static Status validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output);
73
74 // Inherited methods overridden
75 void run() override;
76
77private:
78 struct Impl;
79 std::unique_ptr<Impl> _impl;
80};
81
82/** Basic function to perform logical OR */
83class NELogicalOr : public IFunction
84{
85public:
86 /** Constructor */
87 NELogicalOr();
88 /** Destructor */
89 ~NELogicalOr();
90 ARM_COMPUTE_DISALLOW_COPY_ALLOW_MOVE_INC(NELogicalOr)
91
92 /** Initialise the kernel's inputs and output
93 *
Sheri Zhang6124ce62021-05-04 14:03:13 +010094 * Valid data layouts:
95 * - All
96 *
97 * Valid data type configurations:
98 * |src0 |src1 |dst |
99 * |:--------------|:-------------|:------------|
100 * |U8 |U8 |U8 |
101 *
Georgios Pinitas58bce682020-11-13 11:38:58 +0000102 * @param[in] input1 First tensor input. Data type supported: U8.
103 * @param[in] input2 Second tensor input. Data type supported: U8.
104 * @param[out] output Output tensor. Data type supported: U8.
105 */
106 void configure(const ITensor *input1, const ITensor *input2, ITensor *output);
107 /** Static function to check if given info will lead to a valid configuration of @ref NELogicalOr
108 *
109 * @param[in] input1 First input tensor info. Data types supported: U8.
110 * @param[in] input2 Second input tensor info. Data types supported: U8.
111 * @param[in] output Output tensor info. Data type supported: U8
112 *
113 * @return a status
114 */
115 static Status validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output);
116
117 // Inherited methods overridden
118 void run() override;
119
120private:
121 struct Impl;
122 std::unique_ptr<Impl> _impl;
123};
124
125/** Basic function to perform logical NOT */
126class NELogicalNot : public IFunction
127{
128public:
129 /** Constructor */
130 NELogicalNot();
131 /** Destructor */
132 ~NELogicalNot();
133 ARM_COMPUTE_DISALLOW_COPY_ALLOW_MOVE_INC(NELogicalNot)
134
135 /** Initialise the kernel's inputs and output
136 *
Sheri Zhang6124ce62021-05-04 14:03:13 +0100137 * Valid data layouts:
138 * - All
139 *
140 * Valid data type configurations:
141 * |src |dst |
142 * |:--------------|:-------------|
143 * |U8 |U8 |
144 *
Georgios Pinitas58bce682020-11-13 11:38:58 +0000145 * @param[in] input Input tensor. Data type supported: U8.
146 * @param[out] output Output tensor. Data type supported: U8.
147 */
148 void configure(const ITensor *input, ITensor *output);
149 /** Static function to check if given info will lead to a valid configuration of @ref NELogicalNot
150 *
151 * @param[in] input Input tensor info. Data types supported: U8.
152 * @param[in] output Output tensor info. Data type supported: U8
153 *
154 * @return a status
155 */
156 static Status validate(const ITensorInfo *input, const ITensorInfo *output);
157
158 // Inherited methods overridden
159 void run() override;
160
161private:
162 struct Impl;
163 std::unique_ptr<Impl> _impl;
164};
165} // namespace arm_compute
166#endif /* ARM_COMPUTE_NELOGICAL_H */