summaryrefslogtreecommitdiff
path: root/compute/ncnn/include/ncnn/layer/binaryop.h
diff options
context:
space:
mode:
Diffstat (limited to 'compute/ncnn/include/ncnn/layer/binaryop.h')
-rw-r--r--compute/ncnn/include/ncnn/layer/binaryop.h69
1 files changed, 69 insertions, 0 deletions
diff --git a/compute/ncnn/include/ncnn/layer/binaryop.h b/compute/ncnn/include/ncnn/layer/binaryop.h
new file mode 100644
index 000000000..4ccfd94b4
--- /dev/null
+++ b/compute/ncnn/include/ncnn/layer/binaryop.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd. 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.
+ */
+// Tencent is pleased to support the open source community by making ncnn available.
+//
+// Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
+//
+// Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
+// in compliance with the License. You may obtain a copy of the License at
+//
+// https://opensource.org/licenses/BSD-3-Clause
+//
+// 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.
+
+#ifndef __NCNN_LAYER_BINARYOP_H__
+#define __NCNN_LAYER_BINARYOP_H__
+
+#include "ncnn/mat.h"
+
+namespace nnfw
+{
+namespace ncnn
+{
+
+enum class BinaryOp
+{
+ Operation_ADD = 0,
+ Operation_SUB = 1,
+ Operation_MUL = 2,
+ Operation_DIV = 3,
+ Operation_MAX = 4,
+ Operation_MIN = 5,
+ Operation_POW = 6,
+ Operation_SQUAREDDIFFERENCE = 7
+};
+
+struct BinaryOpParam
+{
+ BinaryOp op_type;
+ float b;
+
+ BinaryOpParam() : op_type{BinaryOp::Operation_ADD}, b{0.0f} {}
+};
+
+int ncnn_binary_op(const BinaryOpParam &param, const Mat &bottom_blob, const Mat &bottom_blob1,
+ Mat &top_blob);
+// TODO Inplace function porting
+// int ncnn_binary_op_inplace(const BinaryParam &param, Mat &bottom_top_blob) const;
+// int ncnn_binary_op_inplace(const BinaryOpParam &param, std::vector<Mat> &bottom_top_blobs) const;
+
+} // namespace ncnn
+} // naemsapce nnfw
+
+#endif // __NCNN_LAYER_BINARYOP_H__