summaryrefslogtreecommitdiff
path: root/onert-micro/luci-interpreter/src/kernels/LogicalOr.cpp
diff options
context:
space:
mode:
authorHyeongseok Oh <hseok82.oh@samsung.com>2023-04-12 15:42:02 +0900
committerHyeongseok Oh <hseok82.oh@samsung.com>2023-04-12 15:42:02 +0900
commit323663bb115ef625642391a5a8e9b35fee8b2ae3 (patch)
tree17e2a6b91535e6f53f4cacda5e4db6aa0303dd22 /onert-micro/luci-interpreter/src/kernels/LogicalOr.cpp
parentc690d52bdd137ed6a17353aa7af35e8141ece77b (diff)
downloadnnfw-323663bb115ef625642391a5a8e9b35fee8b2ae3.tar.gz
nnfw-323663bb115ef625642391a5a8e9b35fee8b2ae3.tar.bz2
nnfw-323663bb115ef625642391a5a8e9b35fee8b2ae3.zip
Imported Upstream version 1.22.0upstream/1.22.0
Diffstat (limited to 'onert-micro/luci-interpreter/src/kernels/LogicalOr.cpp')
-rw-r--r--onert-micro/luci-interpreter/src/kernels/LogicalOr.cpp50
1 files changed, 50 insertions, 0 deletions
diff --git a/onert-micro/luci-interpreter/src/kernels/LogicalOr.cpp b/onert-micro/luci-interpreter/src/kernels/LogicalOr.cpp
new file mode 100644
index 000000000..ecb8ee49b
--- /dev/null
+++ b/onert-micro/luci-interpreter/src/kernels/LogicalOr.cpp
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
+ * Copyright 2019 The TensorFlow Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "kernels/LogicalOr.h"
+
+#include "kernels/Utils.h"
+#include "kernels/BinaryOpCommon.h"
+
+namespace luci_interpreter
+{
+namespace kernels
+{
+
+LogicalOr::LogicalOr(const Tensor *input1, const Tensor *input2, Tensor *output)
+ : Kernel({input1, input2}, {output})
+{
+}
+
+void LogicalOr::configure()
+{
+ LUCI_INTERPRETER_CHECK(input1()->element_type() == input2()->element_type());
+ LUCI_INTERPRETER_CHECK(input1()->element_type() == DataType::BOOL);
+ // TODO: enable it only if kernel with dynamic shapes
+ output()->resize(calculateShapeForBroadcast(input1()->shape(), input2()->shape()));
+}
+
+void LogicalOr::execute() const
+{
+ BinaryOpBroadcastSlow(getTensorShape(input1()), getTensorData<bool>(input1()),
+ getTensorShape(input2()), getTensorData<bool>(input2()),
+ getTensorShape(output()), getTensorData<bool>(output()),
+ [](bool x, bool y) { return x || y; });
+}
+
+} // namespace kernels
+} // namespace luci_interpreter