Georgios Pinitas | 58bce68 | 2020-11-13 11:38:58 +0000 | [diff] [blame] | 1 | /* |
Sheri Zhang | 6124ce6 | 2021-05-04 14:03:13 +0100 | [diff] [blame] | 2 | * Copyright (c) 2020-2021 Arm Limited. |
Georgios Pinitas | 58bce68 | 2020-11-13 11:38:58 +0000 | [diff] [blame] | 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" |
Georgios Pinitas | 58bce68 | 2020-11-13 11:38:58 +0000 | [diff] [blame] | 29 | |
| 30 | #include <memory> |
| 31 | |
| 32 | namespace arm_compute |
| 33 | { |
| 34 | // Forward declarations |
| 35 | class ITensor; |
| 36 | class ITensorInfo; |
| 37 | |
| 38 | /** Basic function to perform logical AND */ |
| 39 | class NELogicalAnd : public IFunction |
| 40 | { |
| 41 | public: |
| 42 | /** Constructor */ |
| 43 | NELogicalAnd(); |
Michele Di Giorgio | 13c497a | 2021-05-13 12:54:31 +0100 | [diff] [blame] | 44 | /** 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 Pinitas | 58bce68 | 2020-11-13 11:38:58 +0000 | [diff] [blame] | 52 | /** Destructor */ |
| 53 | ~NELogicalAnd(); |
Georgios Pinitas | 58bce68 | 2020-11-13 11:38:58 +0000 | [diff] [blame] | 54 | |
| 55 | /** Initialise the kernel's inputs and output |
| 56 | * |
Sheri Zhang | 6124ce6 | 2021-05-04 14:03:13 +0100 | [diff] [blame] | 57 | * Valid data layouts: |
| 58 | * - All |
| 59 | * |
| 60 | * Valid data type configurations: |
| 61 | * |src0 |src1 |dst | |
| 62 | * |:--------------|:-------------|:------------| |
| 63 | * |U8 |U8 |U8 | |
| 64 | * |
Georgios Pinitas | 58bce68 | 2020-11-13 11:38:58 +0000 | [diff] [blame] | 65 | * @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 | |
| 83 | private: |
| 84 | struct Impl; |
| 85 | std::unique_ptr<Impl> _impl; |
| 86 | }; |
| 87 | |
| 88 | /** Basic function to perform logical OR */ |
| 89 | class NELogicalOr : public IFunction |
| 90 | { |
| 91 | public: |
| 92 | /** Constructor */ |
| 93 | NELogicalOr(); |
Michele Di Giorgio | 13c497a | 2021-05-13 12:54:31 +0100 | [diff] [blame] | 94 | /** 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 Pinitas | 58bce68 | 2020-11-13 11:38:58 +0000 | [diff] [blame] | 102 | /** Destructor */ |
| 103 | ~NELogicalOr(); |
Georgios Pinitas | 58bce68 | 2020-11-13 11:38:58 +0000 | [diff] [blame] | 104 | |
| 105 | /** Initialise the kernel's inputs and output |
| 106 | * |
Sheri Zhang | 6124ce6 | 2021-05-04 14:03:13 +0100 | [diff] [blame] | 107 | * Valid data layouts: |
| 108 | * - All |
| 109 | * |
| 110 | * Valid data type configurations: |
| 111 | * |src0 |src1 |dst | |
| 112 | * |:--------------|:-------------|:------------| |
| 113 | * |U8 |U8 |U8 | |
| 114 | * |
Georgios Pinitas | 58bce68 | 2020-11-13 11:38:58 +0000 | [diff] [blame] | 115 | * @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 | |
| 133 | private: |
| 134 | struct Impl; |
| 135 | std::unique_ptr<Impl> _impl; |
| 136 | }; |
| 137 | |
| 138 | /** Basic function to perform logical NOT */ |
| 139 | class NELogicalNot : public IFunction |
| 140 | { |
| 141 | public: |
| 142 | /** Constructor */ |
| 143 | NELogicalNot(); |
Michele Di Giorgio | 13c497a | 2021-05-13 12:54:31 +0100 | [diff] [blame] | 144 | /** 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 Pinitas | 58bce68 | 2020-11-13 11:38:58 +0000 | [diff] [blame] | 152 | /** Destructor */ |
| 153 | ~NELogicalNot(); |
Georgios Pinitas | 58bce68 | 2020-11-13 11:38:58 +0000 | [diff] [blame] | 154 | |
| 155 | /** Initialise the kernel's inputs and output |
| 156 | * |
Sheri Zhang | 6124ce6 | 2021-05-04 14:03:13 +0100 | [diff] [blame] | 157 | * Valid data layouts: |
| 158 | * - All |
| 159 | * |
| 160 | * Valid data type configurations: |
| 161 | * |src |dst | |
| 162 | * |:--------------|:-------------| |
| 163 | * |U8 |U8 | |
| 164 | * |
Georgios Pinitas | 58bce68 | 2020-11-13 11:38:58 +0000 | [diff] [blame] | 165 | * @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 | |
| 181 | private: |
| 182 | struct Impl; |
| 183 | std::unique_ptr<Impl> _impl; |
| 184 | }; |
| 185 | } // namespace arm_compute |
| 186 | #endif /* ARM_COMPUTE_NELOGICAL_H */ |