blob: d3774da597246fe1dfcb8f05c7bdf9db67612110 [file] [log] [blame]
Sang-Hoon Park75eea332020-11-13 13:44:13 +00001/*
2 * Copyright (c) 2020 Arm Limited.
3 *
4 * SPDX-License-Identifier: MIT
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in all
14 * copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 */
24#include "arm_compute/runtime/CL/functions/CLLogicalNot.h"
25#include "arm_compute/core/CL/ICLTensor.h"
26#include "src/core/CL/kernels/CLElementWiseUnaryLayerKernel.h"
Sang-Hoon Park75eea332020-11-13 13:44:13 +000027
28#include <utility>
29
30namespace arm_compute
31{
32namespace experimental
33{
34void CLLogicalNot::configure(const CLCompileContext &compile_context, const ITensorInfo *input, ITensorInfo *output)
35{
Georgios Pinitas40f51a62020-11-21 03:04:18 +000036 auto k = std::make_unique<CLElementWiseUnaryLayerKernel>();
Sang-Hoon Park75eea332020-11-13 13:44:13 +000037 k->configure(compile_context, input, output, ElementWiseUnary::LOGICAL_NOT);
38 _kernel = std::move(k);
39}
40
41Status CLLogicalNot::validate(const ITensorInfo *input, const ITensorInfo *output)
42{
43 return CLElementWiseUnaryLayerKernel::validate(input, output, ElementWiseUnary::LOGICAL_NOT);
44}
45
46void CLLogicalNot::run(ITensorPack &tensors)
47{
48 ICLOperator::run(tensors);
49}
50} // namespace experimental
51
52struct CLLogicalNot::Impl
53{
54 const ICLTensor *src{ nullptr };
55 ICLTensor *dst{ nullptr };
56 std::unique_ptr<experimental::CLLogicalNot> op{ nullptr };
57};
58
59CLLogicalNot::CLLogicalNot()
Georgios Pinitas40f51a62020-11-21 03:04:18 +000060 : _impl(std::make_unique<Impl>())
Sang-Hoon Park75eea332020-11-13 13:44:13 +000061{
62}
63CLLogicalNot::CLLogicalNot(CLLogicalNot &&) = default;
64CLLogicalNot &CLLogicalNot::operator=(CLLogicalNot &&) = default;
65CLLogicalNot::~CLLogicalNot() = default;
66
67void CLLogicalNot::configure(const ICLTensor *input, ICLTensor *output)
68{
69 configure(CLKernelLibrary::get().get_compile_context(), input, output);
70}
71
72void CLLogicalNot::configure(const CLCompileContext &compile_context, const ICLTensor *input, ICLTensor *output)
73{
74 _impl->src = input;
75 _impl->dst = output;
Georgios Pinitas40f51a62020-11-21 03:04:18 +000076 _impl->op = std::make_unique<experimental::CLLogicalNot>();
Sang-Hoon Park75eea332020-11-13 13:44:13 +000077 _impl->op->configure(compile_context, input->info(), output->info());
78}
79
80Status CLLogicalNot::validate(const ITensorInfo *input, const ITensorInfo *output)
81{
82 return experimental::CLLogicalNot::validate(input, output);
83}
84
85void CLLogicalNot::run()
86{
87 ITensorPack pack;
88 pack.add_tensor(TensorType::ACL_SRC, _impl->src);
89 pack.add_tensor(TensorType::ACL_DST, _impl->dst);
90
91 _impl->op->run(pack);
92}
93
94} // namespace arm_compute