Compute Library
 21.02
NELogical.h
Go to the documentation of this file.
1 /*
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"
30 
31 #include <memory>
32 
33 namespace arm_compute
34 {
35 // Forward declarations
36 class ITensor;
37 class ITensorInfo;
38 
39 /** Basic function to perform logical AND */
40 class NELogicalAnd : public IFunction
41 {
42 public:
43  /** Constructor */
44  NELogicalAnd();
45  /** Destructor */
46  ~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 
69 private:
70  struct Impl;
71  std::unique_ptr<Impl> _impl;
72 };
73 
74 /** Basic function to perform logical OR */
75 class NELogicalOr : public IFunction
76 {
77 public:
78  /** Constructor */
79  NELogicalOr();
80  /** Destructor */
81  ~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 
104 private:
105  struct Impl;
106  std::unique_ptr<Impl> _impl;
107 };
108 
109 /** Basic function to perform logical NOT */
110 class NELogicalNot : public IFunction
111 {
112 public:
113  /** Constructor */
114  NELogicalNot();
115  /** Destructor */
116  ~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 
137 private:
138  struct Impl;
139  std::unique_ptr<Impl> _impl;
140 };
141 } // namespace arm_compute
142 #endif /* ARM_COMPUTE_NELOGICAL_H */
Base class for all functions.
Definition: IFunction.h:30
~NELogicalAnd()
Destructor.
Basic function to perform logical NOT.
Definition: NELogical.h:110
Basic function to perform logical OR.
Definition: NELogical.h:75
Store the tensor&#39;s metadata.
Definition: ITensorInfo.h:40
Status class.
Definition: Error.h:52
Interface for Neon tensor.
Definition: ITensor.h:36
Copyright (c) 2017-2021 Arm Limited.
void configure(const ITensor *input1, const ITensor *input2, ITensor *output)
Initialise the kernel&#39;s inputs and output.
Definition: NELogical.cpp:48
Basic function to perform logical AND.
Definition: NELogical.h:40
void run() override
Run the kernels contained in the function.
Definition: NELogical.cpp:66
static Status validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output)
Static function to check if given info will lead to a valid configuration of NELogicalAnd.
Definition: NELogical.cpp:61
NELogicalAnd()
Constructor.
Definition: NELogical.cpp:41
#define ARM_COMPUTE_DISALLOW_COPY_ALLOW_MOVE_INC(TypeName)
Definition: Macros.h:27