blob: daf7d85aef7f9dc489a8347b5da83909154db527 [file] [log] [blame]
Sang-Hoon Park75eea332020-11-13 13:44:13 +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_CLLOGICALOR_H
25#define ARM_COMPUTE_CLLOGICALOR_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
37namespace experimental
38{
39class CLLogicalOr : public ICLOperator
40{
41public:
42 /** Default Constructor */
43 CLLogicalOr() = default;
44 /** Initialise the kernel's inputs, output and conversion policy.
45 *
46 * @param[in] compile_context The compile context to be used.
47 * @param[in, out] input1 First tensor input. Data types supported: U8.
48 * The input tensor is [in, out] because its TensorInfo might be modified inside the kernel in case of broadcasting of dimension 0.
Sang-Hoon Park2dbc5862020-11-18 13:52:11 +000049 * @param[in, out] input2 Second tensor input. Data types supported: same as @p input1.
Sang-Hoon Park75eea332020-11-13 13:44:13 +000050 * The input tensor is [in, out] because its TensorInfo might be modified inside the kernel in case of broadcasting of dimension 0.
Sang-Hoon Park2dbc5862020-11-18 13:52:11 +000051 * @param[out] output Output tensor. Data types supported: same as @p input1.
Sang-Hoon Park75eea332020-11-13 13:44:13 +000052 */
53 void configure(const CLCompileContext &compile_context, ITensorInfo *input1, ITensorInfo *input2, ITensorInfo *output);
54 /** Static function to check if given info will lead to a valid configuration of @ref CLLogicalBinaryKernel
55 *
56 * @param[in] input1 First tensor input info. Data types supported: U8.
Sang-Hoon Park2dbc5862020-11-18 13:52:11 +000057 * @param[in] input2 Second tensor input info. Data types supported: same as @p input1.
58 * @param[in] output Output tensor info. Data types supported: same as @p input1.
Sang-Hoon Park75eea332020-11-13 13:44:13 +000059 *
60 * @return a status
61 */
62 static Status validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output);
63 // Inherited methods overridden:
64 void run(ITensorPack &tensors) override;
65};
66} // namespace experimental
67
68/** Basic function to run @ref CLLogicalBinaryKernel.
69 *
70 * @note The tensor data type for the inputs must be U8.
71 * @note The function performs a logical OR operation using the two input tensors.
72 */
73class CLLogicalOr : public IFunction
74{
75public:
76 /** Default Constructor */
77 CLLogicalOr();
78 /** Default Destructor */
79 ~CLLogicalOr();
80 /** Prevent instances of this class from being copied (As this class contains pointers) */
81 CLLogicalOr(const CLLogicalOr &) = delete;
82 /** Default move constructor */
83 CLLogicalOr(CLLogicalOr &&);
84 /** Prevent instances of this class from being copied (As this class contains pointers) */
85 CLLogicalOr &operator=(const CLLogicalOr &) = delete;
86 /** Default move assignment operator */
87 CLLogicalOr &operator=(CLLogicalOr &&);
88 /** Initialize the function
89 *
90 * @param[in] input1 Input tensor. Data types supported: U8.
Sang-Hoon Park2dbc5862020-11-18 13:52:11 +000091 * @param[in] input2 Input tensor. Data types supported: same as @p input1.
92 * @param[out] output Output tensor. Data types supported: same as @p input1.
Sang-Hoon Park75eea332020-11-13 13:44:13 +000093 */
94 void configure(ICLTensor *input1, ICLTensor *input2, ICLTensor *output);
95 /** Initialize the function
96 *
97 * @param[in] compile_context The compile context to be used.
98 * @param[in] input1 Input tensor. Data types supported: U8.
Sang-Hoon Park2dbc5862020-11-18 13:52:11 +000099 * @param[in] input2 Input tensor. Data types supported: same as @p input1.
100 * @param[out] output Output tensor. Data types supported: same as @p input1.
Sang-Hoon Park75eea332020-11-13 13:44:13 +0000101 */
102 void configure(const CLCompileContext &compile_context, ICLTensor *input1, ICLTensor *input2, ICLTensor *output);
103 /** Static function to check if given info will lead to a valid configuration
104 *
105 * @param[in] input1 First tensor input info. Data types supported: U8.
Sang-Hoon Park2dbc5862020-11-18 13:52:11 +0000106 * @param[in] input2 Second tensor input info. Data types supported: same as @p input1.
107 * @param[in] output Output tensor info. Data types supported: same as @p input1.
Sang-Hoon Park75eea332020-11-13 13:44:13 +0000108 *
109 * @return a status
110 */
111 static Status validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output);
112
113 // Inherited methods overridden:
114 void run() override;
115
116private:
117 struct Impl;
118 std::unique_ptr<Impl> _impl;
119};
120} // namespace arm_compute
121#endif /* ARM_COMPUTE_CLLOGICALOR_H */