blob: e3061e1dc30d1054f1ca976e3ee1417240f25af7 [file] [log] [blame]
Sang-Hoon Park75eea332020-11-13 13:44:13 +00001/*
Michele Di Giorgio1e0208a2021-01-22 15:42:59 +00002 * Copyright (c) 2020-2021 Arm Limited.
Sang-Hoon Park75eea332020-11-13 13:44:13 +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_CLLOGICALAND_H
25#define ARM_COMPUTE_CLLOGICALAND_H
26
27#include "arm_compute/core/Error.h"
28#include "arm_compute/runtime/CL/ICLOperator.h"
29#include "arm_compute/runtime/IFunction.h"
30
31namespace arm_compute
32{
33class CLCompileContext;
34class ICLTensor;
35class ITensorInfo;
36
Michele Di Giorgio1e0208a2021-01-22 15:42:59 +000037/** Basic function to run @ref arm_compute::opencl::kernels::ClLogicalBinaryKernel.
Sang-Hoon Park75eea332020-11-13 13:44:13 +000038 *
39 * @note The tensor data type for the inputs must be U8.
40 * @note The function performs a logical AND operation using the two input tensors.
41 */
42class CLLogicalAnd : public IFunction
43{
44public:
45 /** Default Constructor */
46 CLLogicalAnd();
47 /** Default Destructor */
48 ~CLLogicalAnd();
49 /** Prevent instances of this class from being copied (As this class contains pointers) */
50 CLLogicalAnd(const CLLogicalAnd &) = delete;
51 /** Default move constructor */
52 CLLogicalAnd(CLLogicalAnd &&);
53 /** Prevent instances of this class from being copied (As this class contains pointers) */
54 CLLogicalAnd &operator=(const CLLogicalAnd &) = delete;
55 /** Default move assignment operator */
56 CLLogicalAnd &operator=(CLLogicalAnd &&);
57 /** Initialize the function
58 *
Sheri Zhang6124ce62021-05-04 14:03:13 +010059 * Valid data layouts:
60 * - All
61 *
62 * Valid data type configurations:
63 * |src0 |src1 |dst |
64 * |:--------------|:-------------|:------------|
65 * |U8 |U8 |U8 |
66 *
Sang-Hoon Park75eea332020-11-13 13:44:13 +000067 * @param[in] input1 Input tensor. Data types supported: U8.
Sang-Hoon Park2dbc5862020-11-18 13:52:11 +000068 * @param[in] input2 Input tensor. Data types supported: same as @p input1.
69 * @param[out] output Output tensor. Data types supported: same as @p input1.
Sang-Hoon Park75eea332020-11-13 13:44:13 +000070 */
71 void configure(ICLTensor *input1, ICLTensor *input2, ICLTensor *output);
72 /** Initialize the function
73 *
74 * @param[in] compile_context The compile context to be used.
75 * @param[in] input1 Input tensor. Data types supported: U8.
Sang-Hoon Park2dbc5862020-11-18 13:52:11 +000076 * @param[in] input2 Input tensor. Data types supported: same as @p input1.
77 * @param[out] output Output tensor. Data types supported: same as @p input1.
Sang-Hoon Park75eea332020-11-13 13:44:13 +000078 */
79 void configure(const CLCompileContext &compile_context, ICLTensor *input1, ICLTensor *input2, ICLTensor *output);
80 /** Static function to check if given info will lead to a valid configuration
81 *
82 * @param[in] input1 First tensor input info. Data types supported: U8.
Sang-Hoon Park2dbc5862020-11-18 13:52:11 +000083 * @param[in] input2 Second tensor input info. Data types supported: same as @p input1.
84 * @param[in] output Output tensor info. Data types supported: same as @p input1.
Sang-Hoon Park75eea332020-11-13 13:44:13 +000085 *
86 * @return a status
87 */
88 static Status validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output);
89
90 // Inherited methods overridden:
91 void run() override;
92
93private:
94 struct Impl;
95 std::unique_ptr<Impl> _impl;
96};
Georgios Pinitas856f66e2021-04-22 21:13:21 +010097
98namespace experimental
99{
100class CLLogicalAnd : public ICLOperator
101{
102public:
103 /** Default Constructor */
104 CLLogicalAnd() = default;
105 /** Initialise the kernel's inputs, output and conversion policy.
106 *
107 * @param[in] compile_context The compile context to be used.
108 * @param[in, out] input1 First tensor input. Data types supported: U8.
109 * The input tensor is [in, out] because its TensorInfo might be modified inside the kernel in case of broadcasting of dimension 0.
110 * @param[in, out] input2 Second tensor input. Data types supported: same as @p input1.
111 * The input tensor is [in, out] because its TensorInfo might be modified inside the kernel in case of broadcasting of dimension 0.
112 * @param[out] output Output tensor. Data types supported: same as @p input1.
113 */
114 void configure(const CLCompileContext &compile_context, ITensorInfo *input1, ITensorInfo *input2, ITensorInfo *output);
115 /** Static function to check if given info will lead to a valid configuration of @ref arm_compute::opencl::kernels::ClLogicalBinaryKernel
116 *
117 * @param[in] input1 First tensor input info. Data types supported: U8.
118 * @param[in] input2 Second tensor input info. Data types supported: same as @p input1.
119 * @param[in] output Output tensor info. Data types supported: same as @p input1.
120 *
121 * @return a status
122 */
123 static Status validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output);
124 // Inherited methods overridden:
125 void run(ITensorPack &tensors) override;
126};
127} // namespace experimental
Sang-Hoon Park75eea332020-11-13 13:44:13 +0000128} // namespace arm_compute
129#endif /* ARM_COMPUTE_CLLOGICALAND_H */