Michalis Spyrou | e936262 | 2018-11-23 17:41:37 +0000 | [diff] [blame] | 1 | /* |
Michele Di Giorgio | d9eaf61 | 2020-07-08 11:12:57 +0100 | [diff] [blame] | 2 | * Copyright (c) 2018-2020 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 | */ |
| 24 | #include "arm_compute/runtime/CL/functions/CLElementWiseUnaryLayer.h" |
| 25 | |
| 26 | #include "arm_compute/core/CL/kernels/CLElementWiseUnaryLayerKernel.h" |
Matthew Bentham | 9204646 | 2020-03-07 22:15:55 +0000 | [diff] [blame] | 27 | #include "support/MemorySupport.h" |
Michalis Spyrou | e936262 | 2018-11-23 17:41:37 +0000 | [diff] [blame] | 28 | |
| 29 | #include <utility> |
| 30 | |
| 31 | namespace arm_compute |
| 32 | { |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame^] | 33 | namespace experimental |
| 34 | { |
| 35 | void CLRsqrtLayer::configure(const CLCompileContext &compile_context, const ITensorInfo *input, ITensorInfo *output) |
| 36 | { |
| 37 | auto k = arm_compute::support::cpp14::make_unique<CLElementWiseUnaryLayerKernel>(); |
| 38 | k->configure(compile_context, input, output, ElementWiseUnary::RSQRT); |
| 39 | _kernel = std::move(k); |
| 40 | } |
| 41 | |
| 42 | Status CLRsqrtLayer::validate(const ITensorInfo *input, const ITensorInfo *output) |
| 43 | { |
| 44 | return arm_compute::CLElementWiseUnaryLayerKernel::validate(input, output, ElementWiseUnary::RSQRT); |
| 45 | } |
| 46 | |
| 47 | MemoryRequirements CLRsqrtLayer::workspace() const |
| 48 | { |
| 49 | return MemoryRequirements{}; |
| 50 | } |
| 51 | |
| 52 | void CLExpLayer::configure(const CLCompileContext &compile_context, const ITensorInfo *input, ITensorInfo *output) |
| 53 | { |
| 54 | auto k = arm_compute::support::cpp14::make_unique<CLElementWiseUnaryLayerKernel>(); |
| 55 | k->configure(compile_context, input, output, ElementWiseUnary::EXP); |
| 56 | _kernel = std::move(k); |
| 57 | } |
| 58 | |
| 59 | Status CLExpLayer::validate(const ITensorInfo *input, const ITensorInfo *output) |
| 60 | { |
| 61 | return arm_compute::CLElementWiseUnaryLayerKernel::validate(input, output, ElementWiseUnary::EXP); |
| 62 | } |
| 63 | |
| 64 | MemoryRequirements CLExpLayer::workspace() const |
| 65 | { |
| 66 | return MemoryRequirements{}; |
| 67 | } |
| 68 | |
| 69 | void CLNegLayer::configure(const CLCompileContext &compile_context, const ITensorInfo *input, ITensorInfo *output) |
| 70 | { |
| 71 | auto k = arm_compute::support::cpp14::make_unique<CLElementWiseUnaryLayerKernel>(); |
| 72 | k->configure(compile_context, input, output, ElementWiseUnary::NEG); |
| 73 | _kernel = std::move(k); |
| 74 | } |
| 75 | |
| 76 | Status CLNegLayer::validate(const ITensorInfo *input, const ITensorInfo *output) |
| 77 | { |
| 78 | return arm_compute::CLElementWiseUnaryLayerKernel::validate(input, output, ElementWiseUnary::NEG); |
| 79 | } |
| 80 | |
| 81 | MemoryRequirements CLNegLayer::workspace() const |
| 82 | { |
| 83 | return MemoryRequirements{}; |
| 84 | } |
| 85 | |
| 86 | void CLSinLayer::configure(const CLCompileContext &compile_context, const ITensorInfo *input, ITensorInfo *output) |
| 87 | { |
| 88 | auto k = arm_compute::support::cpp14::make_unique<CLElementWiseUnaryLayerKernel>(); |
| 89 | k->configure(compile_context, input, output, ElementWiseUnary::SIN); |
| 90 | _kernel = std::move(k); |
| 91 | } |
| 92 | |
| 93 | Status CLSinLayer::validate(const ITensorInfo *input, const ITensorInfo *output) |
| 94 | { |
| 95 | return arm_compute::CLElementWiseUnaryLayerKernel::validate(input, output, ElementWiseUnary::SIN); |
| 96 | } |
| 97 | |
| 98 | MemoryRequirements CLSinLayer::workspace() const |
| 99 | { |
| 100 | return MemoryRequirements{}; |
| 101 | } |
| 102 | |
| 103 | void CLAbsLayer::configure(const CLCompileContext &compile_context, const ITensorInfo *input, ITensorInfo *output) |
| 104 | { |
| 105 | auto k = arm_compute::support::cpp14::make_unique<CLElementWiseUnaryLayerKernel>(); |
| 106 | k->configure(compile_context, input, output, ElementWiseUnary::ABS); |
| 107 | _kernel = std::move(k); |
| 108 | } |
| 109 | |
| 110 | Status CLAbsLayer::validate(const ITensorInfo *input, const ITensorInfo *output) |
| 111 | { |
| 112 | return arm_compute::CLElementWiseUnaryLayerKernel::validate(input, output, ElementWiseUnary::ABS); |
| 113 | } |
| 114 | |
| 115 | MemoryRequirements CLAbsLayer::workspace() const |
| 116 | { |
| 117 | return MemoryRequirements{}; |
| 118 | } |
| 119 | |
| 120 | void CLLogLayer::configure(const CLCompileContext &compile_context, const ITensorInfo *input, ITensorInfo *output) |
| 121 | { |
| 122 | auto k = arm_compute::support::cpp14::make_unique<CLElementWiseUnaryLayerKernel>(); |
| 123 | k->configure(compile_context, input, output, ElementWiseUnary::LOG); |
| 124 | _kernel = std::move(k); |
| 125 | } |
| 126 | |
| 127 | Status CLLogLayer::validate(const ITensorInfo *input, const ITensorInfo *output) |
| 128 | { |
| 129 | return arm_compute::CLElementWiseUnaryLayerKernel::validate(input, output, ElementWiseUnary::LOG); |
| 130 | } |
| 131 | |
| 132 | MemoryRequirements CLLogLayer::workspace() const |
| 133 | { |
| 134 | return MemoryRequirements{}; |
| 135 | } |
| 136 | |
| 137 | void CLRoundLayer::configure(const CLCompileContext &compile_context, const ITensorInfo *input, ITensorInfo *output) |
| 138 | { |
| 139 | auto k = arm_compute::support::cpp14::make_unique<CLElementWiseUnaryLayerKernel>(); |
| 140 | k->configure(compile_context, input, output, ElementWiseUnary::ROUND); |
| 141 | _kernel = std::move(k); |
| 142 | } |
| 143 | |
| 144 | Status CLRoundLayer::validate(const ITensorInfo *input, const ITensorInfo *output) |
| 145 | { |
| 146 | return arm_compute::CLElementWiseUnaryLayerKernel::validate(input, output, ElementWiseUnary::ROUND); |
| 147 | } |
| 148 | |
| 149 | MemoryRequirements CLRoundLayer::workspace() const |
| 150 | { |
| 151 | return MemoryRequirements{}; |
| 152 | } |
| 153 | } // namespace experimental |
| 154 | |
| 155 | struct CLRsqrtLayer::Impl |
| 156 | { |
| 157 | const ICLTensor *src{ nullptr }; |
| 158 | ICLTensor *dst{ nullptr }; |
| 159 | std::unique_ptr<experimental::CLRsqrtLayer> op{ nullptr }; |
| 160 | }; |
| 161 | |
| 162 | CLRsqrtLayer::CLRsqrtLayer() |
| 163 | : _impl(support::cpp14::make_unique<Impl>()) |
| 164 | { |
| 165 | } |
| 166 | |
| 167 | CLRsqrtLayer::CLRsqrtLayer(CLRsqrtLayer &&) = default; |
| 168 | CLRsqrtLayer &CLRsqrtLayer::operator=(CLRsqrtLayer &&) = default; |
| 169 | CLRsqrtLayer::~CLRsqrtLayer() = default; |
| 170 | |
Michalis Spyrou | e936262 | 2018-11-23 17:41:37 +0000 | [diff] [blame] | 171 | void CLRsqrtLayer::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 CLRsqrtLayer::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; |
| 180 | _impl->op = arm_compute::support::cpp14::make_unique<experimental::CLRsqrtLayer>(); |
| 181 | _impl->op->configure(compile_context, input->info(), output->info()); |
Michalis Spyrou | e936262 | 2018-11-23 17:41:37 +0000 | [diff] [blame] | 182 | } |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame^] | 183 | |
Michalis Spyrou | e936262 | 2018-11-23 17:41:37 +0000 | [diff] [blame] | 184 | Status CLRsqrtLayer::validate(const ITensorInfo *input, const ITensorInfo *output) |
| 185 | { |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame^] | 186 | return experimental::CLRsqrtLayer::validate(input, output); |
Michalis Spyrou | e936262 | 2018-11-23 17:41:37 +0000 | [diff] [blame] | 187 | } |
| 188 | |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame^] | 189 | void CLRsqrtLayer::run() |
| 190 | { |
| 191 | const InputTensorMap src{ { TensorType::ACL_SRC, _impl->src } }; |
| 192 | const OutputTensorMap dst{ { TensorType::ACL_DST, _impl->dst } }; |
| 193 | |
| 194 | _impl->op->run(src, dst, {}); |
| 195 | } |
| 196 | |
| 197 | struct CLExpLayer::Impl |
| 198 | { |
| 199 | const ICLTensor *src{ nullptr }; |
| 200 | ICLTensor *dst{ nullptr }; |
| 201 | std::unique_ptr<experimental::CLExpLayer> op{ nullptr }; |
| 202 | }; |
| 203 | |
| 204 | CLExpLayer::CLExpLayer() |
| 205 | : _impl(support::cpp14::make_unique<Impl>()) |
| 206 | { |
| 207 | } |
| 208 | |
| 209 | CLExpLayer::CLExpLayer(CLExpLayer &&) = default; |
| 210 | CLExpLayer &CLExpLayer::operator=(CLExpLayer &&) = default; |
| 211 | CLExpLayer::~CLExpLayer() = default; |
| 212 | |
Michalis Spyrou | e936262 | 2018-11-23 17:41:37 +0000 | [diff] [blame] | 213 | void CLExpLayer::configure(const ICLTensor *input, ICLTensor *output) |
| 214 | { |
Manuel Bottini | 2b84be5 | 2020-04-08 10:15:51 +0100 | [diff] [blame] | 215 | configure(CLKernelLibrary::get().get_compile_context(), input, output); |
| 216 | } |
| 217 | |
| 218 | void CLExpLayer::configure(const CLCompileContext &compile_context, const ICLTensor *input, ICLTensor *output) |
| 219 | { |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame^] | 220 | _impl->src = input; |
| 221 | _impl->dst = output; |
| 222 | _impl->op = arm_compute::support::cpp14::make_unique<experimental::CLExpLayer>(); |
| 223 | _impl->op->configure(compile_context, input->info(), output->info()); |
Michalis Spyrou | e936262 | 2018-11-23 17:41:37 +0000 | [diff] [blame] | 224 | } |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame^] | 225 | |
Michalis Spyrou | e936262 | 2018-11-23 17:41:37 +0000 | [diff] [blame] | 226 | Status CLExpLayer::validate(const ITensorInfo *input, const ITensorInfo *output) |
| 227 | { |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame^] | 228 | return experimental::CLExpLayer::validate(input, output); |
Michalis Spyrou | e936262 | 2018-11-23 17:41:37 +0000 | [diff] [blame] | 229 | } |
Usama Arif | eb312ef | 2019-05-13 17:45:54 +0100 | [diff] [blame] | 230 | |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame^] | 231 | void CLExpLayer::run() |
| 232 | { |
| 233 | const InputTensorMap src{ { TensorType::ACL_SRC, _impl->src } }; |
| 234 | const OutputTensorMap dst{ { TensorType::ACL_DST, _impl->dst } }; |
| 235 | |
| 236 | _impl->op->run(src, dst, {}); |
| 237 | } |
| 238 | |
| 239 | struct CLNegLayer::Impl |
| 240 | { |
| 241 | const ICLTensor *src{ nullptr }; |
| 242 | ICLTensor *dst{ nullptr }; |
| 243 | std::unique_ptr<experimental::CLNegLayer> op{ nullptr }; |
| 244 | }; |
| 245 | |
| 246 | CLNegLayer::CLNegLayer() |
| 247 | : _impl(support::cpp14::make_unique<Impl>()) |
| 248 | { |
| 249 | } |
| 250 | |
| 251 | CLNegLayer::CLNegLayer(CLNegLayer &&) = default; |
| 252 | CLNegLayer &CLNegLayer::operator=(CLNegLayer &&) = default; |
| 253 | CLNegLayer::~CLNegLayer() = default; |
| 254 | |
Usama Arif | eb312ef | 2019-05-13 17:45:54 +0100 | [diff] [blame] | 255 | void CLNegLayer::configure(const ICLTensor *input, ICLTensor *output) |
| 256 | { |
Manuel Bottini | 2b84be5 | 2020-04-08 10:15:51 +0100 | [diff] [blame] | 257 | configure(CLKernelLibrary::get().get_compile_context(), input, output); |
| 258 | } |
| 259 | |
| 260 | void CLNegLayer::configure(const CLCompileContext &compile_context, const ICLTensor *input, ICLTensor *output) |
| 261 | { |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame^] | 262 | _impl->src = input; |
| 263 | _impl->dst = output; |
| 264 | _impl->op = arm_compute::support::cpp14::make_unique<experimental::CLNegLayer>(); |
| 265 | _impl->op->configure(compile_context, input->info(), output->info()); |
Usama Arif | eb312ef | 2019-05-13 17:45:54 +0100 | [diff] [blame] | 266 | } |
| 267 | Status CLNegLayer::validate(const ITensorInfo *input, const ITensorInfo *output) |
| 268 | { |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame^] | 269 | return experimental::CLNegLayer::validate(input, output); |
Usama Arif | eb312ef | 2019-05-13 17:45:54 +0100 | [diff] [blame] | 270 | } |
| 271 | |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame^] | 272 | void CLNegLayer::run() |
| 273 | { |
| 274 | const InputTensorMap src{ { TensorType::ACL_SRC, _impl->src } }; |
| 275 | const OutputTensorMap dst{ { TensorType::ACL_DST, _impl->dst } }; |
| 276 | |
| 277 | _impl->op->run(src, dst, {}); |
| 278 | } |
| 279 | |
| 280 | struct CLSinLayer::Impl |
| 281 | { |
| 282 | const ICLTensor *src{ nullptr }; |
| 283 | ICLTensor *dst{ nullptr }; |
| 284 | std::unique_ptr<experimental::CLSinLayer> op{ nullptr }; |
| 285 | }; |
| 286 | |
| 287 | CLSinLayer::CLSinLayer() |
| 288 | : _impl(support::cpp14::make_unique<Impl>()) |
| 289 | { |
| 290 | } |
| 291 | |
| 292 | CLSinLayer::CLSinLayer(CLSinLayer &&) = default; |
| 293 | CLSinLayer &CLSinLayer::operator=(CLSinLayer &&) = default; |
| 294 | CLSinLayer::~CLSinLayer() = default; |
| 295 | |
Michalis Spyrou | 0af4418 | 2019-05-17 14:04:47 +0100 | [diff] [blame] | 296 | void CLSinLayer::configure(const ICLTensor *input, ICLTensor *output) |
| 297 | { |
Manuel Bottini | 2b84be5 | 2020-04-08 10:15:51 +0100 | [diff] [blame] | 298 | configure(CLKernelLibrary::get().get_compile_context(), input, output); |
| 299 | } |
| 300 | |
| 301 | void CLSinLayer::configure(const CLCompileContext &compile_context, const ICLTensor *input, ICLTensor *output) |
| 302 | { |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame^] | 303 | _impl->src = input; |
| 304 | _impl->dst = output; |
| 305 | _impl->op = arm_compute::support::cpp14::make_unique<experimental::CLSinLayer>(); |
| 306 | _impl->op->configure(compile_context, input->info(), output->info()); |
Michalis Spyrou | 0af4418 | 2019-05-17 14:04:47 +0100 | [diff] [blame] | 307 | } |
| 308 | Status CLSinLayer::validate(const ITensorInfo *input, const ITensorInfo *output) |
| 309 | { |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame^] | 310 | return experimental::CLSinLayer::validate(input, output); |
Michalis Spyrou | 0af4418 | 2019-05-17 14:04:47 +0100 | [diff] [blame] | 311 | } |
| 312 | |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame^] | 313 | void CLSinLayer::run() |
| 314 | { |
| 315 | const InputTensorMap src{ { TensorType::ACL_SRC, _impl->src } }; |
| 316 | const OutputTensorMap dst{ { TensorType::ACL_DST, _impl->dst } }; |
| 317 | |
| 318 | _impl->op->run(src, dst, {}); |
| 319 | } |
| 320 | |
| 321 | struct CLAbsLayer::Impl |
| 322 | { |
| 323 | const ICLTensor *src{ nullptr }; |
| 324 | ICLTensor *dst{ nullptr }; |
| 325 | std::unique_ptr<experimental::CLAbsLayer> op{ nullptr }; |
| 326 | }; |
| 327 | |
| 328 | CLAbsLayer::CLAbsLayer() |
| 329 | : _impl(support::cpp14::make_unique<Impl>()) |
| 330 | { |
| 331 | } |
| 332 | |
| 333 | CLAbsLayer::CLAbsLayer(CLAbsLayer &&) = default; |
| 334 | CLAbsLayer &CLAbsLayer::operator=(CLAbsLayer &&) = default; |
| 335 | CLAbsLayer::~CLAbsLayer() = default; |
| 336 | |
giuros01 | f24411f | 2019-05-16 11:47:13 +0100 | [diff] [blame] | 337 | void CLAbsLayer::configure(const ICLTensor *input, ICLTensor *output) |
| 338 | { |
Manuel Bottini | 2b84be5 | 2020-04-08 10:15:51 +0100 | [diff] [blame] | 339 | configure(CLKernelLibrary::get().get_compile_context(), input, output); |
| 340 | } |
| 341 | |
| 342 | void CLAbsLayer::configure(const CLCompileContext &compile_context, const ICLTensor *input, ICLTensor *output) |
| 343 | { |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame^] | 344 | _impl->src = input; |
| 345 | _impl->dst = output; |
| 346 | _impl->op = arm_compute::support::cpp14::make_unique<experimental::CLAbsLayer>(); |
| 347 | _impl->op->configure(compile_context, input->info(), output->info()); |
giuros01 | f24411f | 2019-05-16 11:47:13 +0100 | [diff] [blame] | 348 | } |
| 349 | Status CLAbsLayer::validate(const ITensorInfo *input, const ITensorInfo *output) |
| 350 | { |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame^] | 351 | return experimental::CLAbsLayer::validate(input, output); |
giuros01 | f24411f | 2019-05-16 11:47:13 +0100 | [diff] [blame] | 352 | } |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame^] | 353 | |
| 354 | void CLAbsLayer::run() |
| 355 | { |
| 356 | const InputTensorMap src{ { TensorType::ACL_SRC, _impl->src } }; |
| 357 | const OutputTensorMap dst{ { TensorType::ACL_DST, _impl->dst } }; |
| 358 | |
| 359 | _impl->op->run(src, dst, {}); |
| 360 | } |
| 361 | |
| 362 | struct CLLogLayer::Impl |
| 363 | { |
| 364 | const ICLTensor *src{ nullptr }; |
| 365 | ICLTensor *dst{ nullptr }; |
| 366 | std::unique_ptr<experimental::CLLogLayer> op{ nullptr }; |
| 367 | }; |
| 368 | |
| 369 | CLLogLayer::CLLogLayer() |
| 370 | : _impl(support::cpp14::make_unique<Impl>()) |
| 371 | { |
| 372 | } |
| 373 | |
| 374 | CLLogLayer::CLLogLayer(CLLogLayer &&) = default; |
| 375 | CLLogLayer &CLLogLayer::operator=(CLLogLayer &&) = default; |
| 376 | CLLogLayer::~CLLogLayer() = default; |
| 377 | |
Usama Arif | ac33d7e | 2019-05-20 14:21:40 +0100 | [diff] [blame] | 378 | void CLLogLayer::configure(const ICLTensor *input, ICLTensor *output) |
| 379 | { |
Manuel Bottini | 2b84be5 | 2020-04-08 10:15:51 +0100 | [diff] [blame] | 380 | configure(CLKernelLibrary::get().get_compile_context(), input, output); |
| 381 | } |
| 382 | |
| 383 | void CLLogLayer::configure(const CLCompileContext &compile_context, const ICLTensor *input, ICLTensor *output) |
| 384 | { |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame^] | 385 | _impl->src = input; |
| 386 | _impl->dst = output; |
| 387 | _impl->op = arm_compute::support::cpp14::make_unique<experimental::CLLogLayer>(); |
| 388 | _impl->op->configure(compile_context, input->info(), output->info()); |
Usama Arif | ac33d7e | 2019-05-20 14:21:40 +0100 | [diff] [blame] | 389 | } |
| 390 | Status CLLogLayer::validate(const ITensorInfo *input, const ITensorInfo *output) |
| 391 | { |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame^] | 392 | return experimental::CLLogLayer::validate(input, output); |
Usama Arif | ac33d7e | 2019-05-20 14:21:40 +0100 | [diff] [blame] | 393 | } |
giuros01 | f24411f | 2019-05-16 11:47:13 +0100 | [diff] [blame] | 394 | |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame^] | 395 | void CLLogLayer::run() |
| 396 | { |
| 397 | const InputTensorMap src{ { TensorType::ACL_SRC, _impl->src } }; |
| 398 | const OutputTensorMap dst{ { TensorType::ACL_DST, _impl->dst } }; |
| 399 | |
| 400 | _impl->op->run(src, dst, {}); |
| 401 | } |
| 402 | |
| 403 | struct CLRoundLayer::Impl |
| 404 | { |
| 405 | const ICLTensor *src{ nullptr }; |
| 406 | ICLTensor *dst{ nullptr }; |
| 407 | std::unique_ptr<experimental::CLRoundLayer> op{ nullptr }; |
| 408 | }; |
| 409 | |
| 410 | CLRoundLayer::CLRoundLayer() |
| 411 | : _impl(support::cpp14::make_unique<Impl>()) |
| 412 | { |
| 413 | } |
| 414 | |
| 415 | CLRoundLayer::CLRoundLayer(CLRoundLayer &&) = default; |
| 416 | CLRoundLayer &CLRoundLayer::operator=(CLRoundLayer &&) = default; |
| 417 | CLRoundLayer::~CLRoundLayer() = default; |
| 418 | |
Usama Arif | 6a4d542 | 2019-05-24 14:53:59 +0100 | [diff] [blame] | 419 | void CLRoundLayer::configure(const ICLTensor *input, ICLTensor *output) |
| 420 | { |
Manuel Bottini | 2b84be5 | 2020-04-08 10:15:51 +0100 | [diff] [blame] | 421 | configure(CLKernelLibrary::get().get_compile_context(), input, output); |
| 422 | } |
| 423 | |
| 424 | void CLRoundLayer::configure(const CLCompileContext &compile_context, const ICLTensor *input, ICLTensor *output) |
| 425 | { |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame^] | 426 | _impl->src = input; |
| 427 | _impl->dst = output; |
| 428 | _impl->op = arm_compute::support::cpp14::make_unique<experimental::CLRoundLayer>(); |
| 429 | _impl->op->configure(compile_context, input->info(), output->info()); |
Usama Arif | 6a4d542 | 2019-05-24 14:53:59 +0100 | [diff] [blame] | 430 | } |
| 431 | Status CLRoundLayer::validate(const ITensorInfo *input, const ITensorInfo *output) |
| 432 | { |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame^] | 433 | return experimental::CLRoundLayer::validate(input, output); |
Usama Arif | 6a4d542 | 2019-05-24 14:53:59 +0100 | [diff] [blame] | 434 | } |
| 435 | |
Michalis Spyrou | f738fe6 | 2020-07-15 18:10:17 +0100 | [diff] [blame^] | 436 | void CLRoundLayer::run() |
| 437 | { |
| 438 | const InputTensorMap src{ { TensorType::ACL_SRC, _impl->src } }; |
| 439 | const OutputTensorMap dst{ { TensorType::ACL_DST, _impl->dst } }; |
| 440 | |
| 441 | _impl->op->run(src, dst, {}); |
| 442 | } |
Michalis Spyrou | e936262 | 2018-11-23 17:41:37 +0000 | [diff] [blame] | 443 | } // namespace arm_compute |