giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 1 | /* |
Michele Di Giorgio | 1e0208a | 2021-01-22 15:42:59 +0000 | [diff] [blame^] | 2 | * Copyright (c) 2018-2021 Arm Limited. |
giuros01 | 164a272 | 2018-11-20 18:34:46 +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 |
George Wort | 5a97b28 | 2018-12-21 16:21:04 +0000 | [diff] [blame] | 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 22 | * SOFTWARE. |
| 23 | */ |
Michalis Spyrou | f464337 | 2019-11-29 16:17:13 +0000 | [diff] [blame] | 24 | #ifndef ARM_COMPUTE_CLELEMENTWISEOPERATIONS_H |
| 25 | #define ARM_COMPUTE_CLELEMENTWISEOPERATIONS_H |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 26 | |
Michalis Spyrou | ad7515d | 2020-07-24 00:02:23 +0100 | [diff] [blame] | 27 | #include "arm_compute/runtime/CL/ICLOperator.h" |
| 28 | #include "arm_compute/runtime/IFunction.h" |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 29 | |
| 30 | namespace arm_compute |
| 31 | { |
| 32 | class ICLTensor; |
Sang-Hoon Park | bef7fa2 | 2020-10-21 15:58:54 +0100 | [diff] [blame] | 33 | class CLCompileContext; |
| 34 | class ITensorInfo; |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 35 | |
Michalis Spyrou | ad7515d | 2020-07-24 00:02:23 +0100 | [diff] [blame] | 36 | namespace experimental |
| 37 | { |
Michele Di Giorgio | 1e0208a | 2021-01-22 15:42:59 +0000 | [diff] [blame^] | 38 | /** Basic function to run @ref arm_compute::opencl::kernels::ClSaturatedArithmeticKernel for subtraction |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 39 | * |
Michele Di Giorgio | f6f7876 | 2020-07-06 11:27:21 +0100 | [diff] [blame] | 40 | * @note The tensor data type for the inputs must be U8/QASYMM8/QASYMM8_SIGNED/S16/S32/F16/F32. |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 41 | * @note The function performs an arithmetic subtraction between two tensors. |
| 42 | */ |
Michalis Spyrou | ad7515d | 2020-07-24 00:02:23 +0100 | [diff] [blame] | 43 | class CLArithmeticSubtraction : public ICLOperator |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 44 | { |
| 45 | public: |
Michalis Spyrou | ad7515d | 2020-07-24 00:02:23 +0100 | [diff] [blame] | 46 | /** Default Constructor */ |
| 47 | CLArithmeticSubtraction(); |
| 48 | /** Initialise the kernel's inputs, output and conversion policy. |
| 49 | * |
| 50 | * Valid configurations (Input1,Input2) -> Output : |
| 51 | * |
| 52 | * - (U8,U8) -> U8 |
| 53 | * - (U8,U8) -> S16 |
| 54 | * - (S16,U8) -> S16 |
| 55 | * - (U8,S16) -> S16 |
| 56 | * - (S16,S16) -> S16 |
| 57 | * - (S32,S32) -> S32 |
| 58 | * - (F16,F16) -> F16 |
| 59 | * - (F32,F32) -> F32 |
| 60 | * - (QASYMM8,QASYMM8) -> QASYMM8 |
| 61 | * - (QASYMM8_SIGNED,QASYMM8_SIGNED) -> QASYMM8_SIGNED |
| 62 | * - (QSYMM16,QSYMM16) -> QSYMM16 |
| 63 | * |
| 64 | * @param[in] compile_context The compile context to be used. |
| 65 | * @param[in, out] input1 First tensor input. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/S32/F16/F32. |
| 66 | * The input tensor is [in, out] because its TensorInfo might be modified inside the kernel in case of broadcasting of dimension 0. |
| 67 | * @param[in, out] input2 Second tensor input. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/S32/F16/F32. |
| 68 | * The input tensor is [in, out] because its TensorInfo might be modified inside the kernel in case of broadcasting of dimension 0. |
| 69 | * @param[out] output Output tensor. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/S32/F16/F32. |
| 70 | * @param[in] policy Policy to use to handle overflow. |
| 71 | * @param[in] act_info (Optional) Activation layer information in case of a fused activation. |
| 72 | */ |
| 73 | void configure(const CLCompileContext &compile_context, ITensorInfo *input1, ITensorInfo *input2, ITensorInfo *output, ConvertPolicy policy, |
| 74 | const ActivationLayerInfo &act_info = ActivationLayerInfo()); |
Michele Di Giorgio | 1e0208a | 2021-01-22 15:42:59 +0000 | [diff] [blame^] | 75 | /** Static function to check if given info will lead to a valid configuration of @ref arm_compute::opencl::kernels::ClSaturatedArithmeticKernel for subtraction |
Michalis Spyrou | ad7515d | 2020-07-24 00:02:23 +0100 | [diff] [blame] | 76 | * |
| 77 | * Valid configurations (Input1,Input2) -> Output : |
| 78 | * |
| 79 | * - (U8,U8) -> U8 |
| 80 | * - (U8,U8) -> S16 |
| 81 | * - (S16,U8) -> S16 |
| 82 | * - (U8,S16) -> S16 |
| 83 | * - (S16,S16) -> S16 |
| 84 | * - (S32,S32) -> S32 |
| 85 | * - (F16,F16) -> F16 |
| 86 | * - (F32,F32) -> F32 |
| 87 | * - (QASYMM8,QASYMM8) -> QASYMM8 |
| 88 | * - (QASYMM8_SIGNED,QASYMM8_SIGNED) -> QASYMM8_SIGNED |
| 89 | * - (QSYMM16,QSYMM16) -> QSYMM16 |
| 90 | * |
| 91 | * @param[in] input1 First tensor input info. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/S32/F16/F32. |
| 92 | * @param[in] input2 Second tensor input info. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/S32/F16/F32. |
| 93 | * @param[in] output Output tensor info. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/S32/F16/F32. |
| 94 | * @param[in] policy Policy to use to handle overflow. |
| 95 | * @param[in] act_info (Optional) Activation layer information in case of a fused activation. |
| 96 | * |
| 97 | * @return a status |
| 98 | */ |
| 99 | static Status validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output, ConvertPolicy policy, const ActivationLayerInfo &act_info = ActivationLayerInfo()); |
| 100 | |
| 101 | // Inherited methods overridden: |
Georgios Pinitas | 0499dff | 2020-07-31 22:21:38 +0100 | [diff] [blame] | 102 | void run(ITensorPack &tensors) override; |
Michalis Spyrou | ad7515d | 2020-07-24 00:02:23 +0100 | [diff] [blame] | 103 | }; |
| 104 | |
Michele Di Giorgio | 1e0208a | 2021-01-22 15:42:59 +0000 | [diff] [blame^] | 105 | /** Basic function to run @ref arm_compute::opencl::kernels::ClSaturatedArithmeticKernel for division |
Michalis Spyrou | ad7515d | 2020-07-24 00:02:23 +0100 | [diff] [blame] | 106 | * |
| 107 | * @note The tensor data type for the inputs must be F16/F32. |
| 108 | * @note The function performs an arithmetic division between two tensors. |
| 109 | */ |
| 110 | class CLArithmeticDivision : public ICLOperator |
| 111 | { |
| 112 | public: |
| 113 | /** Default Constructor */ |
| 114 | CLArithmeticDivision(); |
| 115 | /** Initialise the kernel's inputs, output. |
| 116 | * |
| 117 | * @param[in] compile_context The compile context to be used. |
| 118 | * @param[in, out] input1 First tensor input. Data types supported: F16/F32. |
| 119 | * The input tensor is [in, out] because its TensorInfo might be modified inside the kernel in case of broadcasting of dimension 0. |
| 120 | * @param[in, out] input2 Second tensor input. Same as @p input1. |
| 121 | * The input tensor is [in, out] because its TensorInfo might be modified inside the kernel in case of broadcasting of dimension 0. |
| 122 | * @param[out] output Output tensor. Data types supported: Same as @p input1. |
| 123 | * @param[in] act_info (Optional) Activation layer information in case of a fused activation. |
| 124 | */ |
| 125 | void configure(const CLCompileContext &compile_context, ITensorInfo *input1, ITensorInfo *input2, ITensorInfo *output, const ActivationLayerInfo &act_info = ActivationLayerInfo()); |
| 126 | /** Static function to check if given info will lead to a valid configuration of @ref CLArithmeticDivision |
| 127 | * |
| 128 | * @param[in] input1 First tensor input info. Data types supported: F16/F32. |
| 129 | * @param[in] input2 Second tensor input info. Data types supported: Same as @p input1. |
| 130 | * @param[in] output Output tensor info. Data types supported: Same as @p input1. |
| 131 | * @param[in] act_info (Optional) Activation layer information in case of a fused activation. |
| 132 | * |
| 133 | * @return a status |
| 134 | */ |
| 135 | static Status validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output, const ActivationLayerInfo &act_info = ActivationLayerInfo()); |
| 136 | |
| 137 | // Inherited methods overridden: |
Georgios Pinitas | 0499dff | 2020-07-31 22:21:38 +0100 | [diff] [blame] | 138 | void run(ITensorPack &tensors) override; |
Michalis Spyrou | ad7515d | 2020-07-24 00:02:23 +0100 | [diff] [blame] | 139 | }; |
| 140 | |
Michele Di Giorgio | 1e0208a | 2021-01-22 15:42:59 +0000 | [diff] [blame^] | 141 | /** Basic function to run @ref arm_compute::opencl::kernels::ClArithmeticKernel for max |
Michalis Spyrou | ad7515d | 2020-07-24 00:02:23 +0100 | [diff] [blame] | 142 | * |
| 143 | * @note The tensor data type for the inputs must be U8/QASYMM8/S16/QSYMM16/S32/U32/F16/F32. |
| 144 | * @note The function performs a max operation between two tensors. |
| 145 | */ |
| 146 | class CLElementwiseMax : public ICLOperator |
| 147 | { |
| 148 | public: |
| 149 | /** Default Constructor */ |
| 150 | CLElementwiseMax(); |
| 151 | /** Initialise the kernel's inputs, output and conversion policy. |
| 152 | * |
| 153 | * @param[in] compile_context The compile context to be used. |
| 154 | * @param[in, out] input1 First tensor input. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/S32/U32/F16/F32. |
| 155 | * The input tensor is [in, out] because its TensorInfo might be modified inside the kernel in case of broadcasting of dimension 0. |
| 156 | * @param[in, out] input2 Second tensor input. Data types supported: same as @p input1. |
| 157 | * The input tensor is [in, out] because its TensorInfo might be modified inside the kernel in case of broadcasting of dimension 0. |
| 158 | * @param[out] output Output tensor. Data types supported: same as @p input1. |
| 159 | * @param[in] act_info (Optional) Activation layer information in case of a fused activation. |
| 160 | */ |
| 161 | void configure(const CLCompileContext &compile_context, ITensorInfo *input1, ITensorInfo *input2, ITensorInfo *output, const ActivationLayerInfo &act_info = ActivationLayerInfo()); |
Michele Di Giorgio | 1e0208a | 2021-01-22 15:42:59 +0000 | [diff] [blame^] | 162 | /** Static function to check if given info will lead to a valid configuration of @ref arm_compute::opencl::kernels::ClArithmeticKernel for max |
Michalis Spyrou | ad7515d | 2020-07-24 00:02:23 +0100 | [diff] [blame] | 163 | * |
| 164 | * @param[in] input1 First tensor input info. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/S32/U32/F16/F32. |
| 165 | * @param[in] input2 Second tensor input info. Data types supported: same as @p input1. |
| 166 | * @param[in] output Output tensor info. Data types supported: same as @p input1. |
| 167 | * @param[in] act_info (Optional) Activation layer information in case of a fused activation. |
| 168 | * |
| 169 | * @return a status |
| 170 | */ |
| 171 | static Status validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output, const ActivationLayerInfo &act_info = ActivationLayerInfo()); |
| 172 | |
| 173 | // Inherited methods overridden: |
Georgios Pinitas | 0499dff | 2020-07-31 22:21:38 +0100 | [diff] [blame] | 174 | void run(ITensorPack &tensors) override; |
Michalis Spyrou | ad7515d | 2020-07-24 00:02:23 +0100 | [diff] [blame] | 175 | }; |
| 176 | |
Michele Di Giorgio | 1e0208a | 2021-01-22 15:42:59 +0000 | [diff] [blame^] | 177 | /** Basic function to run @ref arm_compute::opencl::kernels::ClArithmeticKernel for min |
Michalis Spyrou | ad7515d | 2020-07-24 00:02:23 +0100 | [diff] [blame] | 178 | * |
| 179 | * @note The tensor data type for the inputs must be U8/QASYMM8/S16/QSYMM16/S32/U32/F16/F32. |
| 180 | * @note The function performs a max operation between two tensors. |
| 181 | */ |
| 182 | class CLElementwiseMin : public ICLOperator |
| 183 | { |
| 184 | public: |
| 185 | /** Default Constructor */ |
| 186 | CLElementwiseMin(); |
| 187 | /** Initialise the kernel's inputs, output and conversion policy. |
| 188 | * |
| 189 | * @param[in] compile_context The compile context to be used. |
| 190 | * @param[in, out] input1 First tensor input. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/S32/U32/F16/F32. |
| 191 | * The input tensor is [in, out] because its TensorInfo might be modified inside the kernel in case of broadcasting of dimension 0. |
| 192 | * @param[in, out] input2 Second tensor input. Data types supported: same as @p input1. |
| 193 | * The input tensor is [in, out] because its TensorInfo might be modified inside the kernel in case of broadcasting of dimension 0. |
| 194 | * @param[out] output Output tensor. Data types supported: same as @p input1. |
| 195 | * @param[in] act_info (Optional) Activation layer information in case of a fused activation. |
| 196 | */ |
| 197 | void configure(const CLCompileContext &compile_context, ITensorInfo *input1, ITensorInfo *input2, ITensorInfo *output, const ActivationLayerInfo &act_info = ActivationLayerInfo()); |
Michele Di Giorgio | 1e0208a | 2021-01-22 15:42:59 +0000 | [diff] [blame^] | 198 | /** Static function to check if given info will lead to a valid configuration of @ref arm_compute::opencl::kernels::ClArithmeticKernel for min |
Michalis Spyrou | ad7515d | 2020-07-24 00:02:23 +0100 | [diff] [blame] | 199 | * |
| 200 | * @param[in] input1 First tensor input info. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/S32/U32/F16/F32. |
| 201 | * @param[in] input2 Second tensor input info. Data types supported: same as @p input1. |
| 202 | * @param[in] output Output tensor info. Data types supported: same as @p input1. |
| 203 | * @param[in] act_info (Optional) Activation layer information in case of a fused activation. |
| 204 | * |
| 205 | * @return a status |
| 206 | */ |
| 207 | static Status validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output, const ActivationLayerInfo &act_info = ActivationLayerInfo()); |
| 208 | |
| 209 | // Inherited methods overridden: |
Georgios Pinitas | 0499dff | 2020-07-31 22:21:38 +0100 | [diff] [blame] | 210 | void run(ITensorPack &tensors) override; |
Michalis Spyrou | ad7515d | 2020-07-24 00:02:23 +0100 | [diff] [blame] | 211 | }; |
| 212 | |
Michele Di Giorgio | 1e0208a | 2021-01-22 15:42:59 +0000 | [diff] [blame^] | 213 | /** Basic function to run @ref arm_compute::opencl::kernels::ClArithmeticKernel for squared difference |
Michalis Spyrou | ad7515d | 2020-07-24 00:02:23 +0100 | [diff] [blame] | 214 | * |
| 215 | * @note The tensor data type for the inputs must be QASYMM8/U8/S16/QSYMM16/F16/F32. |
| 216 | * @note The function performs a squared different operation between two tensors (i.e., out[i] = (in1[i] - in2[i])^2 |
| 217 | */ |
| 218 | class CLElementwiseSquaredDiff : public ICLOperator |
| 219 | { |
| 220 | public: |
| 221 | /** Default Constructor */ |
| 222 | CLElementwiseSquaredDiff(); |
| 223 | /** Initialise the kernel's inputs, output and conversion policy. |
| 224 | * |
| 225 | * @param[in] compile_context The compile context to be used. |
| 226 | * @param[in, out] input1 First tensor input. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/F16/F32. |
| 227 | * The input tensor is [in, out] because its TensorInfo might be modified inside the kernel in case of broadcasting of dimension 0. |
| 228 | * @param[in, out] input2 Second tensor input. Data types supported: same as @p input1. |
| 229 | * The input tensor is [in, out] because its TensorInfo might be modified inside the kernel in case of broadcasting of dimension 0. |
| 230 | * @param[out] output Output tensor. Data types supported: same as @p input1. |
| 231 | * @param[in] act_info (Optional) Activation layer information in case of a fused activation. |
| 232 | */ |
| 233 | void configure(const CLCompileContext &compile_context, ITensorInfo *input1, ITensorInfo *input2, ITensorInfo *output, const ActivationLayerInfo &act_info = ActivationLayerInfo()); |
Michele Di Giorgio | 1e0208a | 2021-01-22 15:42:59 +0000 | [diff] [blame^] | 234 | /** Static function to check if given info will lead to a valid configuration of @ref arm_compute::opencl::kernels::ClArithmeticKernel for squared difference |
Michalis Spyrou | ad7515d | 2020-07-24 00:02:23 +0100 | [diff] [blame] | 235 | * |
| 236 | * @param[in] input1 First tensor input info. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/F16/F32. |
| 237 | * @param[in] input2 Second tensor input info. Data types supported: same as @p input1. |
| 238 | * @param[in] output Output tensor info. Data types supported: same as @p input1. |
| 239 | * @param[in] act_info (Optional) Activation layer information in case of a fused activation. |
| 240 | * |
| 241 | * @return a status |
| 242 | */ |
| 243 | static Status validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output, const ActivationLayerInfo &act_info = ActivationLayerInfo()); |
| 244 | |
| 245 | // Inherited methods overridden: |
Georgios Pinitas | 0499dff | 2020-07-31 22:21:38 +0100 | [diff] [blame] | 246 | void run(ITensorPack &tensors) override; |
Michalis Spyrou | ad7515d | 2020-07-24 00:02:23 +0100 | [diff] [blame] | 247 | }; |
| 248 | |
Michele Di Giorgio | 1e0208a | 2021-01-22 15:42:59 +0000 | [diff] [blame^] | 249 | /** Basic function to run @ref arm_compute::opencl::kernels::ClArithmeticKernel for power |
Michalis Spyrou | ad7515d | 2020-07-24 00:02:23 +0100 | [diff] [blame] | 250 | * |
| 251 | * @note The tensor data type for the inputs must be F16/F32. |
| 252 | * @note The function performs an elementwise power of in1 to in2 (i.e., out[i] = in1[i] ^ in2[i]) |
| 253 | */ |
| 254 | class CLElementwisePower : public ICLOperator |
| 255 | { |
| 256 | public: |
| 257 | /** Default Constructor */ |
| 258 | CLElementwisePower(); |
| 259 | /** Initialise the kernel's inputs, output and conversion policy. |
| 260 | * |
| 261 | * @param[in] compile_context The compile context to be used. |
| 262 | * @param[in, out] input1 First tensor input. Data types supported: F16/F32. |
| 263 | * The input tensor is [in, out] because its TensorInfo might be modified inside the kernel in case of broadcasting of dimension 0. |
| 264 | * @param[in, out] input2 Second tensor input. Data types supported: F16/F32. |
| 265 | * The input tensor is [in, out] because its TensorInfo might be modified inside the kernel in case of broadcasting of dimension 0. |
| 266 | * @param[out] output Output tensor. Data types supported:F16/F32. |
| 267 | * @param[in] act_info (Optional) Activation layer information in case of a fused activation. |
| 268 | */ |
| 269 | void configure(const CLCompileContext &compile_context, ITensorInfo *input1, ITensorInfo *input2, ITensorInfo *output, const ActivationLayerInfo &act_info = ActivationLayerInfo()); |
Michele Di Giorgio | 1e0208a | 2021-01-22 15:42:59 +0000 | [diff] [blame^] | 270 | /** Static function to check if given info will lead to a valid configuration of @ref arm_compute::opencl::kernels::ClArithmeticKernel for power |
Michalis Spyrou | ad7515d | 2020-07-24 00:02:23 +0100 | [diff] [blame] | 271 | * |
| 272 | * @param[in] input1 First tensor input info. Data types supported: F16/F32. |
| 273 | * @param[in] input2 Second tensor input info. Data types supported: F16/F32. |
| 274 | * @param[in] output Output tensor info. Data types supported: F16/F32. |
| 275 | * @param[in] act_info (Optional) Activation layer information in case of a fused activation. |
| 276 | * |
| 277 | * @return a status |
| 278 | */ |
| 279 | static Status validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output, const ActivationLayerInfo &act_info = ActivationLayerInfo()); |
| 280 | |
| 281 | // Inherited methods overridden: |
Georgios Pinitas | 0499dff | 2020-07-31 22:21:38 +0100 | [diff] [blame] | 282 | void run(ITensorPack &tensors) override; |
Michalis Spyrou | ad7515d | 2020-07-24 00:02:23 +0100 | [diff] [blame] | 283 | }; |
| 284 | } // namespace experimental |
| 285 | |
Michele Di Giorgio | 1e0208a | 2021-01-22 15:42:59 +0000 | [diff] [blame^] | 286 | /** Basic function to run @ref opencl::kernels::ClSaturatedArithmeticKernel for addition |
Michalis Spyrou | ad7515d | 2020-07-24 00:02:23 +0100 | [diff] [blame] | 287 | * |
| 288 | * @note The tensor data type for the inputs must be U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/S32/F16/F32. |
| 289 | * @note The function performs an arithmetic addition between two tensors. |
| 290 | */ |
| 291 | class CLArithmeticAddition : public IFunction |
| 292 | { |
| 293 | public: |
| 294 | /** Default Constructor */ |
| 295 | CLArithmeticAddition(); |
| 296 | /** Default Destructor */ |
| 297 | ~CLArithmeticAddition(); |
| 298 | /** Prevent instances of this class from being copied (As this class contains pointers) */ |
| 299 | CLArithmeticAddition(const CLArithmeticAddition &) = delete; |
| 300 | /** Default move constructor */ |
| 301 | CLArithmeticAddition(CLArithmeticAddition &&); |
| 302 | /** Prevent instances of this class from being copied (As this class contains pointers) */ |
| 303 | CLArithmeticAddition &operator=(const CLArithmeticAddition &) = delete; |
| 304 | /** Default move assignment operator */ |
| 305 | CLArithmeticAddition &operator=(CLArithmeticAddition &&); |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 306 | /** Initialise the kernel's inputs, output and conversion policy. |
| 307 | * |
Michele Di Giorgio | f6f7876 | 2020-07-06 11:27:21 +0100 | [diff] [blame] | 308 | * Valid configurations (Input1,Input2) -> Output : |
| 309 | * |
| 310 | * - (U8,U8) -> U8 |
| 311 | * - (U8,U8) -> S16 |
| 312 | * - (S16,U8) -> S16 |
| 313 | * - (U8,S16) -> S16 |
| 314 | * - (S16,S16) -> S16 |
| 315 | * - (S32,S32) -> S32 |
| 316 | * - (F16,F16) -> F16 |
| 317 | * - (F32,F32) -> F32 |
| 318 | * - (QASYMM8,QASYMM8) -> QASYMM8 |
| 319 | * - (QASYMM8_SIGNED,QASYMM8_SIGNED) -> QASYMM8_SIGNED |
| 320 | * - (QSYMM16,QSYMM16) -> QSYMM16 |
| 321 | * |
| 322 | * @param[in, out] input1 First tensor input. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/S32/F16/F32. |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 323 | * The input tensor is [in, out] because its TensorInfo might be modified inside the kernel in case of broadcasting of dimension 0. |
Michele Di Giorgio | f6f7876 | 2020-07-06 11:27:21 +0100 | [diff] [blame] | 324 | * @param[in, out] input2 Second tensor input. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/S32/F16/F32. |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 325 | * The input tensor is [in, out] because its TensorInfo might be modified inside the kernel in case of broadcasting of dimension 0. |
Michele Di Giorgio | f6f7876 | 2020-07-06 11:27:21 +0100 | [diff] [blame] | 326 | * @param[out] output Output tensor. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/S32/F16/F32. |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 327 | * @param[in] policy Policy to use to handle overflow. |
| 328 | * @param[in] act_info (Optional) Activation layer information in case of a fused activation. |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 329 | */ |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 330 | void configure(ICLTensor *input1, ICLTensor *input2, ICLTensor *output, ConvertPolicy policy, const ActivationLayerInfo &act_info = ActivationLayerInfo()); |
Manuel Bottini | 2b84be5 | 2020-04-08 10:15:51 +0100 | [diff] [blame] | 331 | /** Initialise the kernel's inputs, output and conversion policy. |
| 332 | * |
Michele Di Giorgio | f6f7876 | 2020-07-06 11:27:21 +0100 | [diff] [blame] | 333 | * Valid configurations (Input1,Input2) -> Output : |
| 334 | * |
| 335 | * - (U8,U8) -> U8 |
| 336 | * - (U8,U8) -> S16 |
| 337 | * - (S16,U8) -> S16 |
| 338 | * - (U8,S16) -> S16 |
| 339 | * - (S16,S16) -> S16 |
| 340 | * - (S32,S32) -> S32 |
| 341 | * - (F16,F16) -> F16 |
| 342 | * - (F32,F32) -> F32 |
| 343 | * - (QASYMM8,QASYMM8) -> QASYMM8 |
| 344 | * - (QASYMM8_SIGNED,QASYMM8_SIGNED) -> QASYMM8_SIGNED |
| 345 | * - (QSYMM16,QSYMM16) -> QSYMM16 |
| 346 | * |
Manuel Bottini | 2b84be5 | 2020-04-08 10:15:51 +0100 | [diff] [blame] | 347 | * @param[in] compile_context The compile context to be used. |
Michele Di Giorgio | f6f7876 | 2020-07-06 11:27:21 +0100 | [diff] [blame] | 348 | * @param[in, out] input1 First tensor input. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/S32/F16/F32. |
Manuel Bottini | 2b84be5 | 2020-04-08 10:15:51 +0100 | [diff] [blame] | 349 | * The input tensor is [in, out] because its TensorInfo might be modified inside the kernel in case of broadcasting of dimension 0. |
Michele Di Giorgio | f6f7876 | 2020-07-06 11:27:21 +0100 | [diff] [blame] | 350 | * @param[in, out] input2 Second tensor input. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/S32/F16/F32. |
Manuel Bottini | 2b84be5 | 2020-04-08 10:15:51 +0100 | [diff] [blame] | 351 | * The input tensor is [in, out] because its TensorInfo might be modified inside the kernel in case of broadcasting of dimension 0. |
Michele Di Giorgio | f6f7876 | 2020-07-06 11:27:21 +0100 | [diff] [blame] | 352 | * @param[out] output Output tensor. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/S32/F16/F32. |
Manuel Bottini | 2b84be5 | 2020-04-08 10:15:51 +0100 | [diff] [blame] | 353 | * @param[in] policy Policy to use to handle overflow. |
| 354 | * @param[in] act_info (Optional) Activation layer information in case of a fused activation. |
| 355 | */ |
Michalis Spyrou | ad7515d | 2020-07-24 00:02:23 +0100 | [diff] [blame] | 356 | void configure(const CLCompileContext &compile_context, const ICLTensor *input1, const ICLTensor *input2, ICLTensor *output, ConvertPolicy policy, |
| 357 | const ActivationLayerInfo &act_info = ActivationLayerInfo()); |
Michele Di Giorgio | 1e0208a | 2021-01-22 15:42:59 +0000 | [diff] [blame^] | 358 | /** Static function to check if given info will lead to a valid configuration of @ref opencl::kernels::ClSaturatedArithmeticKernel for addition |
Michalis Spyrou | ad7515d | 2020-07-24 00:02:23 +0100 | [diff] [blame] | 359 | * |
| 360 | * Valid configurations (Input1,Input2) -> Output : |
| 361 | * |
| 362 | * - (U8,U8) -> U8 |
| 363 | * - (U8,U8) -> S16 |
| 364 | * - (S16,U8) -> S16 |
| 365 | * - (U8,S16) -> S16 |
| 366 | * - (S16,S16) -> S16 |
| 367 | * - (S32,S32) -> S32 |
| 368 | * - (F16,F16) -> F16 |
| 369 | * - (F32,F32) -> F32 |
| 370 | * - (QASYMM8,QASYMM8) -> QASYMM8 |
| 371 | * - (QASYMM8_SIGNED,QASYMM8_SIGNED) -> QASYMM8_SIGNED |
| 372 | * - (QSYMM16,QSYMM16) -> QSYMM16 |
| 373 | * |
| 374 | * @param[in] input1 First tensor input info. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/S32/F16/F32. |
| 375 | * @param[in] input2 Second tensor input info. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/S32/F16/F32. |
| 376 | * @param[in] output Output tensor info. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/S32/F16/F32. |
| 377 | * @param[in] policy Policy to use to handle overflow. |
| 378 | * @param[in] act_info (Optional) Activation layer information in case of a fused activation. |
| 379 | * |
| 380 | * @return a status |
| 381 | */ |
| 382 | static Status validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output, ConvertPolicy policy, const ActivationLayerInfo &act_info = ActivationLayerInfo()); |
| 383 | |
| 384 | // Inherited methods overridden: |
| 385 | void run() override; |
| 386 | |
| 387 | private: |
| 388 | struct Impl; |
| 389 | std::unique_ptr<Impl> _impl; |
| 390 | }; |
| 391 | |
Michele Di Giorgio | 1e0208a | 2021-01-22 15:42:59 +0000 | [diff] [blame^] | 392 | /** Basic function to run @ref opencl::kernels::ClSaturatedArithmeticKernel for subtraction |
Michalis Spyrou | ad7515d | 2020-07-24 00:02:23 +0100 | [diff] [blame] | 393 | * |
| 394 | * @note The tensor data type for the inputs must be U8/QASYMM8/QASYMM8_SIGNED/S16/S32/F16/F32. |
| 395 | * @note The function performs an arithmetic subtraction between two tensors. |
| 396 | */ |
| 397 | class CLArithmeticSubtraction : public IFunction |
| 398 | { |
| 399 | public: |
| 400 | /** Default Constructor */ |
| 401 | CLArithmeticSubtraction(); |
| 402 | /** Default Destructor */ |
| 403 | ~CLArithmeticSubtraction(); |
| 404 | /** Prevent instances of this class from being copied (As this class contains pointers) */ |
| 405 | CLArithmeticSubtraction(const CLArithmeticSubtraction &) = delete; |
| 406 | /** Default move constructor */ |
| 407 | CLArithmeticSubtraction(CLArithmeticSubtraction &&); |
| 408 | /** Prevent instances of this class from being copied (As this class contains pointers) */ |
| 409 | CLArithmeticSubtraction &operator=(const CLArithmeticSubtraction &) = delete; |
| 410 | /** Default move assignment operator */ |
| 411 | CLArithmeticSubtraction &operator=(CLArithmeticSubtraction &&); |
| 412 | /** Initialise the kernel's inputs, output and conversion policy. |
| 413 | * |
| 414 | * Valid configurations (Input1,Input2) -> Output : |
| 415 | * |
| 416 | * - (U8,U8) -> U8 |
| 417 | * - (U8,U8) -> S16 |
| 418 | * - (S16,U8) -> S16 |
| 419 | * - (U8,S16) -> S16 |
| 420 | * - (S16,S16) -> S16 |
| 421 | * - (S32,S32) -> S32 |
| 422 | * - (F16,F16) -> F16 |
| 423 | * - (F32,F32) -> F32 |
| 424 | * - (QASYMM8,QASYMM8) -> QASYMM8 |
| 425 | * - (QASYMM8_SIGNED,QASYMM8_SIGNED) -> QASYMM8_SIGNED |
| 426 | * - (QSYMM16,QSYMM16) -> QSYMM16 |
| 427 | * |
| 428 | * @param[in, out] input1 First tensor input. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/S32/F16/F32. |
| 429 | * The input tensor is [in, out] because its TensorInfo might be modified inside the kernel in case of broadcasting of dimension 0. |
| 430 | * @param[in, out] input2 Second tensor input. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/S32/F16/F32. |
| 431 | * The input tensor is [in, out] because its TensorInfo might be modified inside the kernel in case of broadcasting of dimension 0. |
| 432 | * @param[out] output Output tensor. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/S32/F16/F32. |
| 433 | * @param[in] policy Policy to use to handle overflow. |
| 434 | * @param[in] act_info (Optional) Activation layer information in case of a fused activation. |
| 435 | */ |
| 436 | void configure(const ICLTensor *input1, const ICLTensor *input2, ICLTensor *output, ConvertPolicy policy, const ActivationLayerInfo &act_info = ActivationLayerInfo()); |
| 437 | /** Initialise the kernel's inputs, output and conversion policy. |
| 438 | * |
| 439 | * Valid configurations (Input1,Input2) -> Output : |
| 440 | * |
| 441 | * - (U8,U8) -> U8 |
| 442 | * - (U8,U8) -> S16 |
| 443 | * - (S16,U8) -> S16 |
| 444 | * - (U8,S16) -> S16 |
| 445 | * - (S16,S16) -> S16 |
| 446 | * - (S32,S32) -> S32 |
| 447 | * - (F16,F16) -> F16 |
| 448 | * - (F32,F32) -> F32 |
| 449 | * - (QASYMM8,QASYMM8) -> QASYMM8 |
| 450 | * - (QASYMM8_SIGNED,QASYMM8_SIGNED) -> QASYMM8_SIGNED |
| 451 | * - (QSYMM16,QSYMM16) -> QSYMM16 |
| 452 | * |
| 453 | * @param[in] compile_context The compile context to be used. |
| 454 | * @param[in, out] input1 First tensor input. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/S32/F16/F32. |
| 455 | * The input tensor is [in, out] because its TensorInfo might be modified inside the kernel in case of broadcasting of dimension 0. |
| 456 | * @param[in, out] input2 Second tensor input. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/S32/F16/F32. |
| 457 | * The input tensor is [in, out] because its TensorInfo might be modified inside the kernel in case of broadcasting of dimension 0. |
| 458 | * @param[out] output Output tensor. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/S32/F16/F32. |
| 459 | * @param[in] policy Policy to use to handle overflow. |
| 460 | * @param[in] act_info (Optional) Activation layer information in case of a fused activation. |
| 461 | */ |
| 462 | void configure(const CLCompileContext &compile_context, const ICLTensor *input1, const ICLTensor *input2, ICLTensor *output, ConvertPolicy policy, |
| 463 | const ActivationLayerInfo &act_info = ActivationLayerInfo()); |
Michele Di Giorgio | 1e0208a | 2021-01-22 15:42:59 +0000 | [diff] [blame^] | 464 | /** Static function to check if given info will lead to a valid configuration of @ref opencl::kernels::ClSaturatedArithmeticKernel for subtraction |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 465 | * |
Michele Di Giorgio | f6f7876 | 2020-07-06 11:27:21 +0100 | [diff] [blame] | 466 | * Valid configurations (Input1,Input2) -> Output : |
| 467 | * |
| 468 | * - (U8,U8) -> U8 |
| 469 | * - (U8,U8) -> S16 |
| 470 | * - (S16,U8) -> S16 |
| 471 | * - (U8,S16) -> S16 |
| 472 | * - (S16,S16) -> S16 |
| 473 | * - (S32,S32) -> S32 |
| 474 | * - (F16,F16) -> F16 |
| 475 | * - (F32,F32) -> F32 |
| 476 | * - (QASYMM8,QASYMM8) -> QASYMM8 |
| 477 | * - (QASYMM8_SIGNED,QASYMM8_SIGNED) -> QASYMM8_SIGNED |
| 478 | * - (QSYMM16,QSYMM16) -> QSYMM16 |
| 479 | * |
| 480 | * @param[in] input1 First tensor input info. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/S32/F16/F32. |
| 481 | * @param[in] input2 Second tensor input info. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/S32/F16/F32. |
| 482 | * @param[in] output Output tensor info. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/S32/F16/F32. |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 483 | * @param[in] policy Policy to use to handle overflow. |
| 484 | * @param[in] act_info (Optional) Activation layer information in case of a fused activation. |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 485 | * |
| 486 | * @return a status |
| 487 | */ |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 488 | static Status validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output, ConvertPolicy policy, const ActivationLayerInfo &act_info = ActivationLayerInfo()); |
Michalis Spyrou | ad7515d | 2020-07-24 00:02:23 +0100 | [diff] [blame] | 489 | |
| 490 | // Inherited methods overridden: |
| 491 | void run() override; |
| 492 | |
| 493 | private: |
| 494 | struct Impl; |
| 495 | std::unique_ptr<Impl> _impl; |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 496 | }; |
| 497 | |
Michele Di Giorgio | 1e0208a | 2021-01-22 15:42:59 +0000 | [diff] [blame^] | 498 | /** Basic function to run @ref opencl::kernels::ClSaturatedArithmeticKernel for division |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 499 | * |
| 500 | * @note The tensor data type for the inputs must be F16/F32. |
| 501 | * @note The function performs an arithmetic division between two tensors. |
| 502 | */ |
Michalis Spyrou | ad7515d | 2020-07-24 00:02:23 +0100 | [diff] [blame] | 503 | class CLArithmeticDivision : public IFunction |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 504 | { |
| 505 | public: |
Michalis Spyrou | ad7515d | 2020-07-24 00:02:23 +0100 | [diff] [blame] | 506 | /** Default Constructor */ |
| 507 | CLArithmeticDivision(); |
| 508 | /** Default Destructor */ |
| 509 | ~CLArithmeticDivision(); |
| 510 | /** Prevent instances of this class from being copied (As this class contains pointers) */ |
| 511 | CLArithmeticDivision(const CLArithmeticDivision &) = delete; |
| 512 | /** Default move constructor */ |
| 513 | CLArithmeticDivision(CLArithmeticDivision &&); |
| 514 | /** Prevent instances of this class from being copied (As this class contains pointers) */ |
| 515 | CLArithmeticDivision &operator=(const CLArithmeticDivision &) = delete; |
| 516 | /** Default move assignment operator */ |
| 517 | CLArithmeticDivision &operator=(CLArithmeticDivision &&); |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 518 | /** Initialise the kernel's inputs, output. |
| 519 | * |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 520 | * @param[in, out] input1 First tensor input. Data types supported: F16/F32. |
| 521 | * The input tensor is [in, out] because its TensorInfo might be modified inside the kernel in case of broadcasting of dimension 0. |
| 522 | * @param[in, out] input2 Second tensor input. Same as @p input1. |
| 523 | * The input tensor is [in, out] because its TensorInfo might be modified inside the kernel in case of broadcasting of dimension 0. |
| 524 | * @param[out] output Output tensor. Data types supported: Same as @p input1. |
| 525 | * @param[in] act_info (Optional) Activation layer information in case of a fused activation. |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 526 | */ |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 527 | void configure(ICLTensor *input1, ICLTensor *input2, ICLTensor *output, const ActivationLayerInfo &act_info = ActivationLayerInfo()); |
Manuel Bottini | 2b84be5 | 2020-04-08 10:15:51 +0100 | [diff] [blame] | 528 | /** Initialise the kernel's inputs, output. |
| 529 | * |
| 530 | * @param[in] compile_context The compile context to be used. |
| 531 | * @param[in, out] input1 First tensor input. Data types supported: F16/F32. |
| 532 | * The input tensor is [in, out] because its TensorInfo might be modified inside the kernel in case of broadcasting of dimension 0. |
| 533 | * @param[in, out] input2 Second tensor input. Same as @p input1. |
| 534 | * The input tensor is [in, out] because its TensorInfo might be modified inside the kernel in case of broadcasting of dimension 0. |
| 535 | * @param[out] output Output tensor. Data types supported: Same as @p input1. |
| 536 | * @param[in] act_info (Optional) Activation layer information in case of a fused activation. |
| 537 | */ |
Michalis Spyrou | ad7515d | 2020-07-24 00:02:23 +0100 | [diff] [blame] | 538 | void configure(const CLCompileContext &compile_context, const ICLTensor *input1, const ICLTensor *input2, ICLTensor *output, const ActivationLayerInfo &act_info = ActivationLayerInfo()); |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 539 | /** Static function to check if given info will lead to a valid configuration of @ref CLArithmeticDivision |
| 540 | * |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 541 | * @param[in] input1 First tensor input info. Data types supported: F16/F32. |
| 542 | * @param[in] input2 Second tensor input info. Data types supported: Same as @p input1. |
| 543 | * @param[in] output Output tensor info. Data types supported: Same as @p input1. |
| 544 | * @param[in] act_info (Optional) Activation layer information in case of a fused activation. |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 545 | * |
| 546 | * @return a status |
| 547 | */ |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 548 | static Status validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output, const ActivationLayerInfo &act_info = ActivationLayerInfo()); |
Michalis Spyrou | ad7515d | 2020-07-24 00:02:23 +0100 | [diff] [blame] | 549 | |
| 550 | // Inherited methods overridden: |
| 551 | void run() override; |
| 552 | |
| 553 | private: |
| 554 | struct Impl; |
| 555 | std::unique_ptr<Impl> _impl; |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 556 | }; |
| 557 | |
Michele Di Giorgio | 1e0208a | 2021-01-22 15:42:59 +0000 | [diff] [blame^] | 558 | /** Basic function to run @ref opencl::kernels::ClArithmeticKernel for max |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 559 | * |
Michele Di Giorgio | 6997fc9 | 2019-06-18 10:23:22 +0100 | [diff] [blame] | 560 | * @note The tensor data type for the inputs must be U8/QASYMM8/S16/QSYMM16/S32/U32/F16/F32. |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 561 | * @note The function performs a max operation between two tensors. |
| 562 | */ |
Michalis Spyrou | ad7515d | 2020-07-24 00:02:23 +0100 | [diff] [blame] | 563 | class CLElementwiseMax : public IFunction |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 564 | { |
| 565 | public: |
Michalis Spyrou | ad7515d | 2020-07-24 00:02:23 +0100 | [diff] [blame] | 566 | /** Default Constructor */ |
| 567 | CLElementwiseMax(); |
| 568 | /** Default Destructor */ |
| 569 | ~CLElementwiseMax(); |
| 570 | /** Prevent instances of this class from being copied (As this class contains pointers) */ |
| 571 | CLElementwiseMax(const CLElementwiseMax &) = delete; |
| 572 | /** Default move constructor */ |
| 573 | CLElementwiseMax(CLElementwiseMax &&); |
| 574 | /** Prevent instances of this class from being copied (As this class contains pointers) */ |
| 575 | CLElementwiseMax &operator=(const CLElementwiseMax &) = delete; |
| 576 | /** Default move assignment operator */ |
| 577 | CLElementwiseMax &operator=(CLElementwiseMax &&); |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 578 | /** Initialise the kernel's inputs, output and conversion policy. |
| 579 | * |
Michele Di Giorgio | f6f7876 | 2020-07-06 11:27:21 +0100 | [diff] [blame] | 580 | * @param[in, out] input1 First tensor input. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/S32/U32/F16/F32. |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 581 | * The input tensor is [in, out] because its TensorInfo might be modified inside the kernel in case of broadcasting of dimension 0. |
Michele Di Giorgio | f6f7876 | 2020-07-06 11:27:21 +0100 | [diff] [blame] | 582 | * @param[in, out] input2 Second tensor input. Data types supported: same as @p input1. |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 583 | * The input tensor is [in, out] because its TensorInfo might be modified inside the kernel in case of broadcasting of dimension 0. |
Michele Di Giorgio | f6f7876 | 2020-07-06 11:27:21 +0100 | [diff] [blame] | 584 | * @param[out] output Output tensor. Data types supported: same as @p input1. |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 585 | * @param[in] act_info (Optional) Activation layer information in case of a fused activation. |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 586 | */ |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 587 | void configure(ICLTensor *input1, ICLTensor *input2, ICLTensor *output, const ActivationLayerInfo &act_info = ActivationLayerInfo()); |
Manuel Bottini | 2b84be5 | 2020-04-08 10:15:51 +0100 | [diff] [blame] | 588 | /** Initialise the kernel's inputs, output and conversion policy. |
| 589 | * |
| 590 | * @param[in] compile_context The compile context to be used. |
Michele Di Giorgio | f6f7876 | 2020-07-06 11:27:21 +0100 | [diff] [blame] | 591 | * @param[in, out] input1 First tensor input. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/S32/U32/F16/F32. |
Manuel Bottini | 2b84be5 | 2020-04-08 10:15:51 +0100 | [diff] [blame] | 592 | * The input tensor is [in, out] because its TensorInfo might be modified inside the kernel in case of broadcasting of dimension 0. |
Michele Di Giorgio | f6f7876 | 2020-07-06 11:27:21 +0100 | [diff] [blame] | 593 | * @param[in, out] input2 Second tensor input. Data types supported: same as @p input1. |
Manuel Bottini | 2b84be5 | 2020-04-08 10:15:51 +0100 | [diff] [blame] | 594 | * The input tensor is [in, out] because its TensorInfo might be modified inside the kernel in case of broadcasting of dimension 0. |
Michele Di Giorgio | f6f7876 | 2020-07-06 11:27:21 +0100 | [diff] [blame] | 595 | * @param[out] output Output tensor. Data types supported: same as @p input1. |
Manuel Bottini | 2b84be5 | 2020-04-08 10:15:51 +0100 | [diff] [blame] | 596 | * @param[in] act_info (Optional) Activation layer information in case of a fused activation. |
| 597 | */ |
| 598 | void configure(const CLCompileContext &compile_context, ICLTensor *input1, ICLTensor *input2, ICLTensor *output, const ActivationLayerInfo &act_info = ActivationLayerInfo()); |
Michele Di Giorgio | 1e0208a | 2021-01-22 15:42:59 +0000 | [diff] [blame^] | 599 | /** Static function to check if given info will lead to a valid configuration of @ref opencl::kernels::ClArithmeticKernel for max |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 600 | * |
Michele Di Giorgio | f6f7876 | 2020-07-06 11:27:21 +0100 | [diff] [blame] | 601 | * @param[in] input1 First tensor input info. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/S32/U32/F16/F32. |
| 602 | * @param[in] input2 Second tensor input info. Data types supported: same as @p input1. |
| 603 | * @param[in] output Output tensor info. Data types supported: same as @p input1. |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 604 | * @param[in] act_info (Optional) Activation layer information in case of a fused activation. |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 605 | * |
| 606 | * @return a status |
| 607 | */ |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 608 | static Status validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output, const ActivationLayerInfo &act_info = ActivationLayerInfo()); |
Michalis Spyrou | ad7515d | 2020-07-24 00:02:23 +0100 | [diff] [blame] | 609 | |
| 610 | // Inherited methods overridden: |
| 611 | void run() override; |
| 612 | |
| 613 | private: |
| 614 | struct Impl; |
| 615 | std::unique_ptr<Impl> _impl; |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 616 | }; |
| 617 | |
Michele Di Giorgio | 1e0208a | 2021-01-22 15:42:59 +0000 | [diff] [blame^] | 618 | /** Basic function to run @ref opencl::kernels::ClArithmeticKernel for min |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 619 | * |
Michele Di Giorgio | 6997fc9 | 2019-06-18 10:23:22 +0100 | [diff] [blame] | 620 | * @note The tensor data type for the inputs must be U8/QASYMM8/S16/QSYMM16/S32/U32/F16/F32. |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 621 | * @note The function performs a max operation between two tensors. |
| 622 | */ |
Michalis Spyrou | ad7515d | 2020-07-24 00:02:23 +0100 | [diff] [blame] | 623 | class CLElementwiseMin : public IFunction |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 624 | { |
| 625 | public: |
Michalis Spyrou | ad7515d | 2020-07-24 00:02:23 +0100 | [diff] [blame] | 626 | /** Default Constructor */ |
| 627 | CLElementwiseMin(); |
| 628 | /** Default Destructor */ |
| 629 | ~CLElementwiseMin(); |
| 630 | /** Prevent instances of this class from being copied (As this class contains pointers) */ |
| 631 | CLElementwiseMin(const CLElementwiseMin &) = delete; |
| 632 | /** Default move constructor */ |
| 633 | CLElementwiseMin(CLElementwiseMin &&); |
| 634 | /** Prevent instances of this class from being copied (As this class contains pointers) */ |
| 635 | CLElementwiseMin &operator=(const CLElementwiseMin &) = delete; |
| 636 | /** Default move assignment operator */ |
| 637 | CLElementwiseMin &operator=(CLElementwiseMin &&); |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 638 | /** Initialise the kernel's inputs, output and conversion policy. |
| 639 | * |
Michele Di Giorgio | f6f7876 | 2020-07-06 11:27:21 +0100 | [diff] [blame] | 640 | * @param[in, out] input1 First tensor input. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/S32/U32/F16/F32. |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 641 | * The input tensor is [in, out] because its TensorInfo might be modified inside the kernel in case of broadcasting of dimension 0. |
Michele Di Giorgio | f6f7876 | 2020-07-06 11:27:21 +0100 | [diff] [blame] | 642 | * @param[in, out] input2 Second tensor input. Data types supported: same as @p input1. |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 643 | * The input tensor is [in, out] because its TensorInfo might be modified inside the kernel in case of broadcasting of dimension 0. |
Michele Di Giorgio | f6f7876 | 2020-07-06 11:27:21 +0100 | [diff] [blame] | 644 | * @param[out] output Output tensor. Data types supported: same as @p input1. |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 645 | * @param[in] act_info (Optional) Activation layer information in case of a fused activation. |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 646 | */ |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 647 | void configure(ICLTensor *input1, ICLTensor *input2, ICLTensor *output, const ActivationLayerInfo &act_info = ActivationLayerInfo()); |
Manuel Bottini | 2b84be5 | 2020-04-08 10:15:51 +0100 | [diff] [blame] | 648 | /** Initialise the kernel's inputs, output and conversion policy. |
| 649 | * |
| 650 | * @param[in] compile_context The compile context to be used. |
Michele Di Giorgio | f6f7876 | 2020-07-06 11:27:21 +0100 | [diff] [blame] | 651 | * @param[in, out] input1 First tensor input. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/S32/U32/F16/F32. |
Manuel Bottini | 2b84be5 | 2020-04-08 10:15:51 +0100 | [diff] [blame] | 652 | * The input tensor is [in, out] because its TensorInfo might be modified inside the kernel in case of broadcasting of dimension 0. |
Michele Di Giorgio | f6f7876 | 2020-07-06 11:27:21 +0100 | [diff] [blame] | 653 | * @param[in, out] input2 Second tensor input. Data types supported: same as @p input1. |
Manuel Bottini | 2b84be5 | 2020-04-08 10:15:51 +0100 | [diff] [blame] | 654 | * The input tensor is [in, out] because its TensorInfo might be modified inside the kernel in case of broadcasting of dimension 0. |
Michele Di Giorgio | f6f7876 | 2020-07-06 11:27:21 +0100 | [diff] [blame] | 655 | * @param[out] output Output tensor. Data types supported: same as @p input1. |
Manuel Bottini | 2b84be5 | 2020-04-08 10:15:51 +0100 | [diff] [blame] | 656 | * @param[in] act_info (Optional) Activation layer information in case of a fused activation. |
| 657 | */ |
| 658 | void configure(const CLCompileContext &compile_context, ICLTensor *input1, ICLTensor *input2, ICLTensor *output, const ActivationLayerInfo &act_info = ActivationLayerInfo()); |
Michele Di Giorgio | 1e0208a | 2021-01-22 15:42:59 +0000 | [diff] [blame^] | 659 | /** Static function to check if given info will lead to a valid configuration of @ref opencl::kernels::ClArithmeticKernel for min |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 660 | * |
Michele Di Giorgio | f6f7876 | 2020-07-06 11:27:21 +0100 | [diff] [blame] | 661 | * @param[in] input1 First tensor input info. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/S32/U32/F16/F32. |
| 662 | * @param[in] input2 Second tensor input info. Data types supported: same as @p input1. |
| 663 | * @param[in] output Output tensor info. Data types supported: same as @p input1. |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 664 | * @param[in] act_info (Optional) Activation layer information in case of a fused activation. |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 665 | * |
| 666 | * @return a status |
| 667 | */ |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 668 | static Status validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output, const ActivationLayerInfo &act_info = ActivationLayerInfo()); |
Michalis Spyrou | ad7515d | 2020-07-24 00:02:23 +0100 | [diff] [blame] | 669 | |
| 670 | // Inherited methods overridden: |
| 671 | void run() override; |
| 672 | |
| 673 | private: |
| 674 | struct Impl; |
| 675 | std::unique_ptr<Impl> _impl; |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 676 | }; |
| 677 | |
Michele Di Giorgio | 1e0208a | 2021-01-22 15:42:59 +0000 | [diff] [blame^] | 678 | /** Basic function to run @ref opencl::kernels::ClArithmeticKernel for squared difference |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 679 | * |
Michele Di Giorgio | 6997fc9 | 2019-06-18 10:23:22 +0100 | [diff] [blame] | 680 | * @note The tensor data type for the inputs must be QASYMM8/U8/S16/QSYMM16/F16/F32. |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 681 | * @note The function performs a squared different operation between two tensors (i.e., out[i] = (in1[i] - in2[i])^2 |
| 682 | */ |
Michalis Spyrou | ad7515d | 2020-07-24 00:02:23 +0100 | [diff] [blame] | 683 | class CLElementwiseSquaredDiff : public IFunction |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 684 | { |
| 685 | public: |
Michalis Spyrou | ad7515d | 2020-07-24 00:02:23 +0100 | [diff] [blame] | 686 | /** Default Constructor */ |
| 687 | CLElementwiseSquaredDiff(); |
| 688 | /** Default Destructor */ |
| 689 | ~CLElementwiseSquaredDiff(); |
| 690 | /** Prevent instances of this class from being copied (As this class contains pointers) */ |
| 691 | CLElementwiseSquaredDiff(const CLElementwiseSquaredDiff &) = delete; |
| 692 | /** Default move constructor */ |
| 693 | CLElementwiseSquaredDiff(CLElementwiseSquaredDiff &&); |
| 694 | /** Prevent instances of this class from being copied (As this class contains pointers) */ |
| 695 | CLElementwiseSquaredDiff &operator=(const CLElementwiseSquaredDiff &) = delete; |
| 696 | /** Default move assignment operator */ |
| 697 | CLElementwiseSquaredDiff &operator=(CLElementwiseSquaredDiff &&); |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 698 | /** Initialise the kernel's inputs, output and conversion policy. |
| 699 | * |
Michele Di Giorgio | f6f7876 | 2020-07-06 11:27:21 +0100 | [diff] [blame] | 700 | * @param[in, out] input1 First tensor input. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/F16/F32. |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 701 | * The input tensor is [in, out] because its TensorInfo might be modified inside the kernel in case of broadcasting of dimension 0. |
Michele Di Giorgio | f6f7876 | 2020-07-06 11:27:21 +0100 | [diff] [blame] | 702 | * @param[in, out] input2 Second tensor input. Data types supported: same as @p input1. |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 703 | * The input tensor is [in, out] because its TensorInfo might be modified inside the kernel in case of broadcasting of dimension 0. |
Michele Di Giorgio | f6f7876 | 2020-07-06 11:27:21 +0100 | [diff] [blame] | 704 | * @param[out] output Output tensor. Data types supported: same as @p input1. |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 705 | * @param[in] act_info (Optional) Activation layer information in case of a fused activation. |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 706 | */ |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 707 | void configure(ICLTensor *input1, ICLTensor *input2, ICLTensor *output, const ActivationLayerInfo &act_info = ActivationLayerInfo()); |
Manuel Bottini | 2b84be5 | 2020-04-08 10:15:51 +0100 | [diff] [blame] | 708 | /** Initialise the kernel's inputs, output and conversion policy. |
| 709 | * |
| 710 | * @param[in] compile_context The compile context to be used. |
Michele Di Giorgio | f6f7876 | 2020-07-06 11:27:21 +0100 | [diff] [blame] | 711 | * @param[in, out] input1 First tensor input. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/F16/F32. |
Manuel Bottini | 2b84be5 | 2020-04-08 10:15:51 +0100 | [diff] [blame] | 712 | * The input tensor is [in, out] because its TensorInfo might be modified inside the kernel in case of broadcasting of dimension 0. |
Michele Di Giorgio | f6f7876 | 2020-07-06 11:27:21 +0100 | [diff] [blame] | 713 | * @param[in, out] input2 Second tensor input. Data types supported: same as @p input1. |
Manuel Bottini | 2b84be5 | 2020-04-08 10:15:51 +0100 | [diff] [blame] | 714 | * The input tensor is [in, out] because its TensorInfo might be modified inside the kernel in case of broadcasting of dimension 0. |
Michele Di Giorgio | f6f7876 | 2020-07-06 11:27:21 +0100 | [diff] [blame] | 715 | * @param[out] output Output tensor. Data types supported: same as @p input1. |
Manuel Bottini | 2b84be5 | 2020-04-08 10:15:51 +0100 | [diff] [blame] | 716 | * @param[in] act_info (Optional) Activation layer information in case of a fused activation. |
| 717 | */ |
| 718 | void configure(const CLCompileContext &compile_context, ICLTensor *input1, ICLTensor *input2, ICLTensor *output, const ActivationLayerInfo &act_info = ActivationLayerInfo()); |
Michele Di Giorgio | 1e0208a | 2021-01-22 15:42:59 +0000 | [diff] [blame^] | 719 | /** Static function to check if given info will lead to a valid configuration of @ref opencl::kernels::ClArithmeticKernel for squared difference |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 720 | * |
Michele Di Giorgio | f6f7876 | 2020-07-06 11:27:21 +0100 | [diff] [blame] | 721 | * @param[in] input1 First tensor input info. Data types supported: U8/QASYMM8/QASYMM8_SIGNED/S16/QSYMM16/F16/F32. |
| 722 | * @param[in] input2 Second tensor input info. Data types supported: same as @p input1. |
| 723 | * @param[in] output Output tensor info. Data types supported: same as @p input1. |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 724 | * @param[in] act_info (Optional) Activation layer information in case of a fused activation. |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 725 | * |
| 726 | * @return a status |
| 727 | */ |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 728 | static Status validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output, const ActivationLayerInfo &act_info = ActivationLayerInfo()); |
Michalis Spyrou | ad7515d | 2020-07-24 00:02:23 +0100 | [diff] [blame] | 729 | |
| 730 | // Inherited methods overridden: |
| 731 | void run() override; |
| 732 | |
| 733 | private: |
| 734 | struct Impl; |
| 735 | std::unique_ptr<Impl> _impl; |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 736 | }; |
Usama Arif | 52c54f6 | 2019-05-14 10:22:36 +0100 | [diff] [blame] | 737 | |
Michele Di Giorgio | 1e0208a | 2021-01-22 15:42:59 +0000 | [diff] [blame^] | 738 | /** Basic function to run @ref opencl::kernels::ClArithmeticKernel for power |
Usama Arif | 52c54f6 | 2019-05-14 10:22:36 +0100 | [diff] [blame] | 739 | * |
| 740 | * @note The tensor data type for the inputs must be F16/F32. |
| 741 | * @note The function performs an elementwise power of in1 to in2 (i.e., out[i] = in1[i] ^ in2[i]) |
| 742 | */ |
Michalis Spyrou | ad7515d | 2020-07-24 00:02:23 +0100 | [diff] [blame] | 743 | class CLElementwisePower : public IFunction |
Usama Arif | 52c54f6 | 2019-05-14 10:22:36 +0100 | [diff] [blame] | 744 | { |
| 745 | public: |
Michalis Spyrou | ad7515d | 2020-07-24 00:02:23 +0100 | [diff] [blame] | 746 | /** Default Constructor */ |
| 747 | CLElementwisePower(); |
| 748 | /** Default Destructor */ |
| 749 | ~CLElementwisePower(); |
| 750 | /** Prevent instances of this class from being copied (As this class contains pointers) */ |
| 751 | CLElementwisePower(const CLElementwisePower &) = delete; |
| 752 | /** Default move constructor */ |
| 753 | CLElementwisePower(CLElementwisePower &&); |
| 754 | /** Prevent instances of this class from being copied (As this class contains pointers) */ |
| 755 | CLElementwisePower &operator=(const CLElementwisePower &) = delete; |
| 756 | /** Default move assignment operator */ |
| 757 | CLElementwisePower &operator=(CLElementwisePower &&); |
Usama Arif | 52c54f6 | 2019-05-14 10:22:36 +0100 | [diff] [blame] | 758 | /** Initialise the kernel's inputs, output and conversion policy. |
| 759 | * |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 760 | * @param[in, out] input1 First tensor input. Data types supported: F16/F32. |
| 761 | * The input tensor is [in, out] because its TensorInfo might be modified inside the kernel in case of broadcasting of dimension 0. |
| 762 | * @param[in, out] input2 Second tensor input. Data types supported: F16/F32. |
| 763 | * The input tensor is [in, out] because its TensorInfo might be modified inside the kernel in case of broadcasting of dimension 0. |
| 764 | * @param[out] output Output tensor. Data types supported:F16/F32. |
| 765 | * @param[in] act_info (Optional) Activation layer information in case of a fused activation. |
Usama Arif | 52c54f6 | 2019-05-14 10:22:36 +0100 | [diff] [blame] | 766 | */ |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 767 | void configure(ICLTensor *input1, ICLTensor *input2, ICLTensor *output, const ActivationLayerInfo &act_info = ActivationLayerInfo()); |
Manuel Bottini | 2b84be5 | 2020-04-08 10:15:51 +0100 | [diff] [blame] | 768 | /** Initialise the kernel's inputs, output and conversion policy. |
| 769 | * |
| 770 | * @param[in] compile_context The compile context to be used. |
| 771 | * @param[in, out] input1 First tensor input. Data types supported: F16/F32. |
| 772 | * The input tensor is [in, out] because its TensorInfo might be modified inside the kernel in case of broadcasting of dimension 0. |
| 773 | * @param[in, out] input2 Second tensor input. Data types supported: F16/F32. |
| 774 | * The input tensor is [in, out] because its TensorInfo might be modified inside the kernel in case of broadcasting of dimension 0. |
| 775 | * @param[out] output Output tensor. Data types supported:F16/F32. |
| 776 | * @param[in] act_info (Optional) Activation layer information in case of a fused activation. |
| 777 | */ |
| 778 | void configure(const CLCompileContext &compile_context, ICLTensor *input1, ICLTensor *input2, ICLTensor *output, const ActivationLayerInfo &act_info = ActivationLayerInfo()); |
Michele Di Giorgio | 1e0208a | 2021-01-22 15:42:59 +0000 | [diff] [blame^] | 779 | /** Static function to check if given info will lead to a valid configuration of @ref opencl::kernels::ClArithmeticKernel for power |
Usama Arif | 52c54f6 | 2019-05-14 10:22:36 +0100 | [diff] [blame] | 780 | * |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 781 | * @param[in] input1 First tensor input info. Data types supported: F16/F32. |
| 782 | * @param[in] input2 Second tensor input info. Data types supported: F16/F32. |
| 783 | * @param[in] output Output tensor info. Data types supported: F16/F32. |
| 784 | * @param[in] act_info (Optional) Activation layer information in case of a fused activation. |
Usama Arif | 52c54f6 | 2019-05-14 10:22:36 +0100 | [diff] [blame] | 785 | * |
| 786 | * @return a status |
| 787 | */ |
Giorgio Arena | 8b2a7d3 | 2020-02-11 17:21:31 +0000 | [diff] [blame] | 788 | static Status validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output, const ActivationLayerInfo &act_info = ActivationLayerInfo()); |
Michalis Spyrou | ad7515d | 2020-07-24 00:02:23 +0100 | [diff] [blame] | 789 | |
| 790 | // Inherited methods overridden: |
| 791 | void run() override; |
| 792 | |
| 793 | private: |
| 794 | struct Impl; |
| 795 | std::unique_ptr<Impl> _impl; |
Usama Arif | 52c54f6 | 2019-05-14 10:22:36 +0100 | [diff] [blame] | 796 | }; |
giuros01 | 164a272 | 2018-11-20 18:34:46 +0000 | [diff] [blame] | 797 | } // namespace arm_compute |
Michalis Spyrou | f464337 | 2019-11-29 16:17:13 +0000 | [diff] [blame] | 798 | #endif /* ARM_COMPUTE_CLELEMENTWISEOPERATIONS_H */ |