2 * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include "kernels/LogicalNot.h"
19 #include "kernels/Utils.h"
21 #include "kernels/BinaryOpCommon.h"
23 namespace luci_interpreter
28 LogicalNot::LogicalNot(const Tensor *input, Tensor *output) : Kernel({input}, {output}) {}
30 void LogicalNot::configure()
32 LUCI_INTERPRETER_CHECK(input()->element_type() == output()->element_type());
33 // TODO: enable it only if kernel with dynamic shapes
34 output()->resize(input()->shape());
37 void LogicalNot::execute() const
39 switch (input()->element_type())
45 assert(false && "Unsupported type.");
49 inline void LogicalNot::evalLogicalNot() const
51 const int size = tflite::MatchingFlatSize(getTensorShape(input()), getTensorShape(output()));
52 bool *output_data = getTensorData<bool>(output());
53 const bool *input_data = getTensorData<bool>(input());
54 for (int i = 0; i < size; ++i)
56 output_data[i] = !input_data[i];
60 } // namespace kernels
61 } // namespace luci_interpreter