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