Michalis Spyrou | e936262 | 2018-11-23 17:41:37 +0000 | [diff] [blame] | 1 | /* |
Michele Di Giorgio | c9c8905 | 2021-01-26 10:20:17 +0000 | [diff] [blame] | 2 | * Copyright (c) 2018-2021 Arm Limited. |
Michalis Spyrou | e936262 | 2018-11-23 17:41:37 +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 | */ |
Jakub Sujak | ee301b3 | 2021-06-04 09:46:08 +0100 | [diff] [blame] | 24 | #include "arm_compute/runtime/CL/functions/CLElementwiseUnaryLayer.h" |
Michalis Spyrou | e936262 | 2018-11-23 17:41:37 +0000 | [diff] [blame] | 25 | |
Michele Di Giorgio | c9c8905 | 2021-01-26 10:20:17 +0000 | [diff] [blame] | 26 | #include "arm_compute/core/CL/CLKernelLibrary.h" |
| 27 | #include "arm_compute/core/CL/ICLTensor.h" |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame] | 28 | |
Michele Di Giorgio | c9c8905 | 2021-01-26 10:20:17 +0000 | [diff] [blame] | 29 | #include "src/core/CL/ICLKernel.h" |
Georgios Pinitas | 7891a73 | 2021-08-20 21:39:25 +0100 | [diff] [blame] | 30 | #include "src/gpu/cl/operators/ClElementwiseUnary.h" |
Michalis Spyrou | e936262 | 2018-11-23 17:41:37 +0000 | [diff] [blame] | 31 | |
| 32 | namespace arm_compute |
| 33 | { |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 34 | struct CLRsqrtLayer::Impl |
| 35 | { |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame] | 36 | const ICLTensor *src{nullptr}; |
| 37 | ICLTensor *dst{nullptr}; |
| 38 | std::unique_ptr<opencl::ClRsqrt> op{nullptr}; |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 39 | }; |
| 40 | |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame] | 41 | CLRsqrtLayer::CLRsqrtLayer() : _impl(std::make_unique<Impl>()) |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 42 | { |
| 43 | } |
| 44 | |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame] | 45 | CLRsqrtLayer::CLRsqrtLayer(CLRsqrtLayer &&) = default; |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 46 | CLRsqrtLayer &CLRsqrtLayer::operator=(CLRsqrtLayer &&) = default; |
| 47 | CLRsqrtLayer::~CLRsqrtLayer() = default; |
| 48 | |
Michalis Spyrou | e936262 | 2018-11-23 17:41:37 +0000 | [diff] [blame] | 49 | void CLRsqrtLayer::configure(const ICLTensor *input, ICLTensor *output) |
| 50 | { |
Manuel Bottini | 2b84be5 | 2020-04-08 10:15:51 +0100 | [diff] [blame] | 51 | configure(CLKernelLibrary::get().get_compile_context(), input, output); |
| 52 | } |
| 53 | |
| 54 | void CLRsqrtLayer::configure(const CLCompileContext &compile_context, const ICLTensor *input, ICLTensor *output) |
| 55 | { |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 56 | _impl->src = input; |
| 57 | _impl->dst = output; |
Michele Di Giorgio | c9c8905 | 2021-01-26 10:20:17 +0000 | [diff] [blame] | 58 | _impl->op = std::make_unique<opencl::ClRsqrt>(); |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 59 | _impl->op->configure(compile_context, input->info(), output->info()); |
Michalis Spyrou | e936262 | 2018-11-23 17:41:37 +0000 | [diff] [blame] | 60 | } |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 61 | |
Michalis Spyrou | e936262 | 2018-11-23 17:41:37 +0000 | [diff] [blame] | 62 | Status CLRsqrtLayer::validate(const ITensorInfo *input, const ITensorInfo *output) |
| 63 | { |
Michele Di Giorgio | c9c8905 | 2021-01-26 10:20:17 +0000 | [diff] [blame] | 64 | return opencl::ClRsqrt::validate(input, output); |
Michalis Spyrou | e936262 | 2018-11-23 17:41:37 +0000 | [diff] [blame] | 65 | } |
| 66 | |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 67 | void CLRsqrtLayer::run() |
| 68 | { |
Georgios Pinitas | 0499dff | 2020-07-31 22:21:38 +0100 | [diff] [blame] | 69 | ITensorPack pack; |
| 70 | pack.add_tensor(TensorType::ACL_SRC, _impl->src); |
| 71 | pack.add_tensor(TensorType::ACL_DST, _impl->dst); |
| 72 | _impl->op->run(pack); |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 73 | } |
| 74 | |
| 75 | struct CLExpLayer::Impl |
| 76 | { |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame] | 77 | const ICLTensor *src{nullptr}; |
| 78 | ICLTensor *dst{nullptr}; |
| 79 | std::unique_ptr<opencl::ClExp> op{nullptr}; |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 80 | }; |
| 81 | |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame] | 82 | CLExpLayer::CLExpLayer() : _impl(std::make_unique<Impl>()) |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 83 | { |
| 84 | } |
| 85 | |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame] | 86 | CLExpLayer::CLExpLayer(CLExpLayer &&) = default; |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 87 | CLExpLayer &CLExpLayer::operator=(CLExpLayer &&) = default; |
| 88 | CLExpLayer::~CLExpLayer() = default; |
| 89 | |
Michalis Spyrou | e936262 | 2018-11-23 17:41:37 +0000 | [diff] [blame] | 90 | void CLExpLayer::configure(const ICLTensor *input, ICLTensor *output) |
| 91 | { |
Manuel Bottini | 2b84be5 | 2020-04-08 10:15:51 +0100 | [diff] [blame] | 92 | configure(CLKernelLibrary::get().get_compile_context(), input, output); |
| 93 | } |
| 94 | |
| 95 | void CLExpLayer::configure(const CLCompileContext &compile_context, const ICLTensor *input, ICLTensor *output) |
| 96 | { |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 97 | _impl->src = input; |
| 98 | _impl->dst = output; |
Michele Di Giorgio | c9c8905 | 2021-01-26 10:20:17 +0000 | [diff] [blame] | 99 | _impl->op = std::make_unique<opencl::ClExp>(); |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 100 | _impl->op->configure(compile_context, input->info(), output->info()); |
Michalis Spyrou | e936262 | 2018-11-23 17:41:37 +0000 | [diff] [blame] | 101 | } |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 102 | |
Michalis Spyrou | e936262 | 2018-11-23 17:41:37 +0000 | [diff] [blame] | 103 | Status CLExpLayer::validate(const ITensorInfo *input, const ITensorInfo *output) |
| 104 | { |
Michele Di Giorgio | c9c8905 | 2021-01-26 10:20:17 +0000 | [diff] [blame] | 105 | return opencl::ClExp::validate(input, output); |
Michalis Spyrou | e936262 | 2018-11-23 17:41:37 +0000 | [diff] [blame] | 106 | } |
Usama Arif | eb312ef | 2019-05-13 17:45:54 +0100 | [diff] [blame] | 107 | |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 108 | void CLExpLayer::run() |
| 109 | { |
Georgios Pinitas | 0499dff | 2020-07-31 22:21:38 +0100 | [diff] [blame] | 110 | ITensorPack pack; |
| 111 | pack.add_tensor(TensorType::ACL_SRC, _impl->src); |
| 112 | pack.add_tensor(TensorType::ACL_DST, _impl->dst); |
| 113 | _impl->op->run(pack); |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 114 | } |
| 115 | |
| 116 | struct CLNegLayer::Impl |
| 117 | { |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame] | 118 | const ICLTensor *src{nullptr}; |
| 119 | ICLTensor *dst{nullptr}; |
| 120 | std::unique_ptr<opencl::ClNeg> op{nullptr}; |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 121 | }; |
| 122 | |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame] | 123 | CLNegLayer::CLNegLayer() : _impl(std::make_unique<Impl>()) |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 124 | { |
| 125 | } |
| 126 | |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame] | 127 | CLNegLayer::CLNegLayer(CLNegLayer &&) = default; |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 128 | CLNegLayer &CLNegLayer::operator=(CLNegLayer &&) = default; |
| 129 | CLNegLayer::~CLNegLayer() = default; |
| 130 | |
Usama Arif | eb312ef | 2019-05-13 17:45:54 +0100 | [diff] [blame] | 131 | void CLNegLayer::configure(const ICLTensor *input, ICLTensor *output) |
| 132 | { |
Manuel Bottini | 2b84be5 | 2020-04-08 10:15:51 +0100 | [diff] [blame] | 133 | configure(CLKernelLibrary::get().get_compile_context(), input, output); |
| 134 | } |
| 135 | |
| 136 | void CLNegLayer::configure(const CLCompileContext &compile_context, const ICLTensor *input, ICLTensor *output) |
| 137 | { |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 138 | _impl->src = input; |
| 139 | _impl->dst = output; |
Michele Di Giorgio | c9c8905 | 2021-01-26 10:20:17 +0000 | [diff] [blame] | 140 | _impl->op = std::make_unique<opencl::ClNeg>(); |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 141 | _impl->op->configure(compile_context, input->info(), output->info()); |
Usama Arif | eb312ef | 2019-05-13 17:45:54 +0100 | [diff] [blame] | 142 | } |
| 143 | Status CLNegLayer::validate(const ITensorInfo *input, const ITensorInfo *output) |
| 144 | { |
Michele Di Giorgio | c9c8905 | 2021-01-26 10:20:17 +0000 | [diff] [blame] | 145 | return opencl::ClNeg::validate(input, output); |
Usama Arif | eb312ef | 2019-05-13 17:45:54 +0100 | [diff] [blame] | 146 | } |
| 147 | |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 148 | void CLNegLayer::run() |
| 149 | { |
Georgios Pinitas | 0499dff | 2020-07-31 22:21:38 +0100 | [diff] [blame] | 150 | ITensorPack pack; |
| 151 | pack.add_tensor(TensorType::ACL_SRC, _impl->src); |
| 152 | pack.add_tensor(TensorType::ACL_DST, _impl->dst); |
| 153 | _impl->op->run(pack); |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 154 | } |
| 155 | |
| 156 | struct CLSinLayer::Impl |
| 157 | { |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame] | 158 | const ICLTensor *src{nullptr}; |
| 159 | ICLTensor *dst{nullptr}; |
| 160 | std::unique_ptr<opencl::ClSin> op{nullptr}; |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 161 | }; |
| 162 | |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame] | 163 | CLSinLayer::CLSinLayer() : _impl(std::make_unique<Impl>()) |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 164 | { |
| 165 | } |
| 166 | |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame] | 167 | CLSinLayer::CLSinLayer(CLSinLayer &&) = default; |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 168 | CLSinLayer &CLSinLayer::operator=(CLSinLayer &&) = default; |
| 169 | CLSinLayer::~CLSinLayer() = default; |
| 170 | |
Michalis Spyrou | 0af4418 | 2019-05-17 14:04:47 +0100 | [diff] [blame] | 171 | void CLSinLayer::configure(const ICLTensor *input, ICLTensor *output) |
| 172 | { |
Manuel Bottini | 2b84be5 | 2020-04-08 10:15:51 +0100 | [diff] [blame] | 173 | configure(CLKernelLibrary::get().get_compile_context(), input, output); |
| 174 | } |
| 175 | |
| 176 | void CLSinLayer::configure(const CLCompileContext &compile_context, const ICLTensor *input, ICLTensor *output) |
| 177 | { |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 178 | _impl->src = input; |
| 179 | _impl->dst = output; |
Michele Di Giorgio | c9c8905 | 2021-01-26 10:20:17 +0000 | [diff] [blame] | 180 | _impl->op = std::make_unique<opencl::ClSin>(); |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 181 | _impl->op->configure(compile_context, input->info(), output->info()); |
Michalis Spyrou | 0af4418 | 2019-05-17 14:04:47 +0100 | [diff] [blame] | 182 | } |
| 183 | Status CLSinLayer::validate(const ITensorInfo *input, const ITensorInfo *output) |
| 184 | { |
Michele Di Giorgio | c9c8905 | 2021-01-26 10:20:17 +0000 | [diff] [blame] | 185 | return opencl::ClSin::validate(input, output); |
Michalis Spyrou | 0af4418 | 2019-05-17 14:04:47 +0100 | [diff] [blame] | 186 | } |
| 187 | |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 188 | void CLSinLayer::run() |
| 189 | { |
Georgios Pinitas | 0499dff | 2020-07-31 22:21:38 +0100 | [diff] [blame] | 190 | ITensorPack pack; |
| 191 | pack.add_tensor(TensorType::ACL_SRC, _impl->src); |
| 192 | pack.add_tensor(TensorType::ACL_DST, _impl->dst); |
| 193 | _impl->op->run(pack); |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 194 | } |
| 195 | |
| 196 | struct CLAbsLayer::Impl |
| 197 | { |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame] | 198 | const ICLTensor *src{nullptr}; |
| 199 | ICLTensor *dst{nullptr}; |
| 200 | std::unique_ptr<opencl::ClAbs> op{nullptr}; |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 201 | }; |
| 202 | |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame] | 203 | CLAbsLayer::CLAbsLayer() : _impl(std::make_unique<Impl>()) |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 204 | { |
| 205 | } |
| 206 | |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame] | 207 | CLAbsLayer::CLAbsLayer(CLAbsLayer &&) = default; |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 208 | CLAbsLayer &CLAbsLayer::operator=(CLAbsLayer &&) = default; |
| 209 | CLAbsLayer::~CLAbsLayer() = default; |
| 210 | |
giuros01 | f24411f | 2019-05-16 11:47:13 +0100 | [diff] [blame] | 211 | void CLAbsLayer::configure(const ICLTensor *input, ICLTensor *output) |
| 212 | { |
Manuel Bottini | 2b84be5 | 2020-04-08 10:15:51 +0100 | [diff] [blame] | 213 | configure(CLKernelLibrary::get().get_compile_context(), input, output); |
| 214 | } |
| 215 | |
| 216 | void CLAbsLayer::configure(const CLCompileContext &compile_context, const ICLTensor *input, ICLTensor *output) |
| 217 | { |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 218 | _impl->src = input; |
| 219 | _impl->dst = output; |
Michele Di Giorgio | c9c8905 | 2021-01-26 10:20:17 +0000 | [diff] [blame] | 220 | _impl->op = std::make_unique<opencl::ClAbs>(); |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 221 | _impl->op->configure(compile_context, input->info(), output->info()); |
giuros01 | f24411f | 2019-05-16 11:47:13 +0100 | [diff] [blame] | 222 | } |
| 223 | Status CLAbsLayer::validate(const ITensorInfo *input, const ITensorInfo *output) |
| 224 | { |
Michele Di Giorgio | c9c8905 | 2021-01-26 10:20:17 +0000 | [diff] [blame] | 225 | return opencl::ClAbs::validate(input, output); |
giuros01 | f24411f | 2019-05-16 11:47:13 +0100 | [diff] [blame] | 226 | } |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 227 | |
| 228 | void CLAbsLayer::run() |
| 229 | { |
Georgios Pinitas | 0499dff | 2020-07-31 22:21:38 +0100 | [diff] [blame] | 230 | ITensorPack pack; |
| 231 | pack.add_tensor(TensorType::ACL_SRC, _impl->src); |
| 232 | pack.add_tensor(TensorType::ACL_DST, _impl->dst); |
| 233 | _impl->op->run(pack); |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 234 | } |
| 235 | |
| 236 | struct CLLogLayer::Impl |
| 237 | { |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame] | 238 | const ICLTensor *src{nullptr}; |
| 239 | ICLTensor *dst{nullptr}; |
| 240 | std::unique_ptr<opencl::ClLog> op{nullptr}; |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 241 | }; |
| 242 | |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame] | 243 | CLLogLayer::CLLogLayer() : _impl(std::make_unique<Impl>()) |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 244 | { |
| 245 | } |
| 246 | |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame] | 247 | CLLogLayer::CLLogLayer(CLLogLayer &&) = default; |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 248 | CLLogLayer &CLLogLayer::operator=(CLLogLayer &&) = default; |
| 249 | CLLogLayer::~CLLogLayer() = default; |
| 250 | |
Usama Arif | ac33d7e | 2019-05-20 14:21:40 +0100 | [diff] [blame] | 251 | void CLLogLayer::configure(const ICLTensor *input, ICLTensor *output) |
| 252 | { |
Manuel Bottini | 2b84be5 | 2020-04-08 10:15:51 +0100 | [diff] [blame] | 253 | configure(CLKernelLibrary::get().get_compile_context(), input, output); |
| 254 | } |
| 255 | |
| 256 | void CLLogLayer::configure(const CLCompileContext &compile_context, const ICLTensor *input, ICLTensor *output) |
| 257 | { |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 258 | _impl->src = input; |
| 259 | _impl->dst = output; |
Michele Di Giorgio | c9c8905 | 2021-01-26 10:20:17 +0000 | [diff] [blame] | 260 | _impl->op = std::make_unique<opencl::ClLog>(); |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 261 | _impl->op->configure(compile_context, input->info(), output->info()); |
Usama Arif | ac33d7e | 2019-05-20 14:21:40 +0100 | [diff] [blame] | 262 | } |
| 263 | Status CLLogLayer::validate(const ITensorInfo *input, const ITensorInfo *output) |
| 264 | { |
Michele Di Giorgio | c9c8905 | 2021-01-26 10:20:17 +0000 | [diff] [blame] | 265 | return opencl::ClLog::validate(input, output); |
Usama Arif | ac33d7e | 2019-05-20 14:21:40 +0100 | [diff] [blame] | 266 | } |
giuros01 | f24411f | 2019-05-16 11:47:13 +0100 | [diff] [blame] | 267 | |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 268 | void CLLogLayer::run() |
| 269 | { |
Georgios Pinitas | 0499dff | 2020-07-31 22:21:38 +0100 | [diff] [blame] | 270 | ITensorPack pack; |
| 271 | pack.add_tensor(TensorType::ACL_SRC, _impl->src); |
| 272 | pack.add_tensor(TensorType::ACL_DST, _impl->dst); |
| 273 | _impl->op->run(pack); |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 274 | } |
| 275 | |
| 276 | struct CLRoundLayer::Impl |
| 277 | { |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame] | 278 | const ICLTensor *src{nullptr}; |
| 279 | ICLTensor *dst{nullptr}; |
| 280 | std::unique_ptr<opencl::ClRound> op{nullptr}; |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 281 | }; |
| 282 | |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame] | 283 | CLRoundLayer::CLRoundLayer() : _impl(std::make_unique<Impl>()) |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 284 | { |
| 285 | } |
| 286 | |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame] | 287 | CLRoundLayer::CLRoundLayer(CLRoundLayer &&) = default; |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 288 | CLRoundLayer &CLRoundLayer::operator=(CLRoundLayer &&) = default; |
| 289 | CLRoundLayer::~CLRoundLayer() = default; |
| 290 | |
Usama Arif | 6a4d542 | 2019-05-24 14:53:59 +0100 | [diff] [blame] | 291 | void CLRoundLayer::configure(const ICLTensor *input, ICLTensor *output) |
| 292 | { |
Manuel Bottini | 2b84be5 | 2020-04-08 10:15:51 +0100 | [diff] [blame] | 293 | configure(CLKernelLibrary::get().get_compile_context(), input, output); |
| 294 | } |
| 295 | |
| 296 | void CLRoundLayer::configure(const CLCompileContext &compile_context, const ICLTensor *input, ICLTensor *output) |
| 297 | { |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 298 | _impl->src = input; |
| 299 | _impl->dst = output; |
Michele Di Giorgio | c9c8905 | 2021-01-26 10:20:17 +0000 | [diff] [blame] | 300 | _impl->op = std::make_unique<opencl::ClRound>(); |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 301 | _impl->op->configure(compile_context, input->info(), output->info()); |
Usama Arif | 6a4d542 | 2019-05-24 14:53:59 +0100 | [diff] [blame] | 302 | } |
| 303 | Status CLRoundLayer::validate(const ITensorInfo *input, const ITensorInfo *output) |
| 304 | { |
Michele Di Giorgio | c9c8905 | 2021-01-26 10:20:17 +0000 | [diff] [blame] | 305 | return opencl::ClRound::validate(input, output); |
Usama Arif | 6a4d542 | 2019-05-24 14:53:59 +0100 | [diff] [blame] | 306 | } |
| 307 | |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 308 | void CLRoundLayer::run() |
| 309 | { |
Georgios Pinitas | 0499dff | 2020-07-31 22:21:38 +0100 | [diff] [blame] | 310 | ITensorPack pack; |
| 311 | pack.add_tensor(TensorType::ACL_SRC, _impl->src); |
| 312 | pack.add_tensor(TensorType::ACL_DST, _impl->dst); |
| 313 | _impl->op->run(pack); |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame] | 314 | } |
Michalis Spyrou | e936262 | 2018-11-23 17:41:37 +0000 | [diff] [blame] | 315 | } // namespace arm_compute |