blob: 04ffce6221ca1c3642867e989778a1c304807988 [file] [log] [blame]
Georgios Pinitas58bce682020-11-13 11:38:58 +00001/*
2 * Copyright (c) 2020 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, 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 *
51 * @param[in] input1 First tensor input. Data type supported: U8.
52 * @param[in] input2 Second tensor input. Data type supported: U8.
53 * @param[out] output Output tensor. Data type supported: U8.
54 */
55 void configure(const ITensor *input1, const ITensor *input2, ITensor *output);
56 /** Static function to check if given info will lead to a valid configuration of @ref NELogicalAnd
57 *
58 * @param[in] input1 First input tensor info. Data types supported: U8.
59 * @param[in] input2 Second input tensor info. Data types supported: U8.
60 * @param[in] output Output tensor info. Data type supported: U8
61 *
62 * @return a status
63 */
64 static Status validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output);
65
66 // Inherited methods overridden
67 void run() override;
68
69private:
70 struct Impl;
71 std::unique_ptr<Impl> _impl;
72};
73
74/** Basic function to perform logical OR */
75class NELogicalOr : public IFunction
76{
77public:
78 /** Constructor */
79 NELogicalOr();
80 /** Destructor */
81 ~NELogicalOr();
82 ARM_COMPUTE_DISALLOW_COPY_ALLOW_MOVE_INC(NELogicalOr)
83
84 /** Initialise the kernel's inputs and output
85 *
86 * @param[in] input1 First tensor input. Data type supported: U8.
87 * @param[in] input2 Second tensor input. Data type supported: U8.
88 * @param[out] output Output tensor. Data type supported: U8.
89 */
90 void configure(const ITensor *input1, const ITensor *input2, ITensor *output);
91 /** Static function to check if given info will lead to a valid configuration of @ref NELogicalOr
92 *
93 * @param[in] input1 First input tensor info. Data types supported: U8.
94 * @param[in] input2 Second input tensor info. Data types supported: U8.
95 * @param[in] output Output tensor info. Data type supported: U8
96 *
97 * @return a status
98 */
99 static Status validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output);
100
101 // Inherited methods overridden
102 void run() override;
103
104private:
105 struct Impl;
106 std::unique_ptr<Impl> _impl;
107};
108
109/** Basic function to perform logical NOT */
110class NELogicalNot : public IFunction
111{
112public:
113 /** Constructor */
114 NELogicalNot();
115 /** Destructor */
116 ~NELogicalNot();
117 ARM_COMPUTE_DISALLOW_COPY_ALLOW_MOVE_INC(NELogicalNot)
118
119 /** Initialise the kernel's inputs and output
120 *
121 * @param[in] input Input tensor. Data type supported: U8.
122 * @param[out] output Output tensor. Data type supported: U8.
123 */
124 void configure(const ITensor *input, ITensor *output);
125 /** Static function to check if given info will lead to a valid configuration of @ref NELogicalNot
126 *
127 * @param[in] input Input tensor info. Data types supported: U8.
128 * @param[in] output Output tensor info. Data type supported: U8
129 *
130 * @return a status
131 */
132 static Status validate(const ITensorInfo *input, const ITensorInfo *output);
133
134 // Inherited methods overridden
135 void run() override;
136
137private:
138 struct Impl;
139 std::unique_ptr<Impl> _impl;
140};
141} // namespace arm_compute
142#endif /* ARM_COMPUTE_NELOGICAL_H */