From ab902aea9d03fa3fe7fdb135798fd0bfbd82a873 Mon Sep 17 00:00:00 2001
From: hrouis <houssemeddine.rouis92@gmail.com>
Date: Fri, 26 Jan 2024 14:50:20 +0100
Subject: [PATCH] add python binding for ArithmeticOperator

---
 .../operator/pybind_ArithmeticOperator.cpp    | 27 +++++++++++++++++++
 python_binding/pybind_core.cpp                |  2 ++
 2 files changed, 29 insertions(+)
 create mode 100644 python_binding/operator/pybind_ArithmeticOperator.cpp

diff --git a/python_binding/operator/pybind_ArithmeticOperator.cpp b/python_binding/operator/pybind_ArithmeticOperator.cpp
new file mode 100644
index 000000000..dc3b92141
--- /dev/null
+++ b/python_binding/operator/pybind_ArithmeticOperator.cpp
@@ -0,0 +1,27 @@
+/********************************************************************************
+ * Copyright (c) 2024 CEA-List
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ ********************************************************************************/
+
+#include <pybind11/pybind11.h>
+#include "aidge/backend/OperatorImpl.hpp"
+#include "aidge/operator/ArithmeticOperator.hpp"
+#include "aidge/operator/Operator.hpp"
+#include <pybind11/stl.h>
+
+namespace py = pybind11;
+namespace Aidge {
+void init_ArithmeticOperator(py::module& m){
+    py::class_<ArithmeticOperator, std::shared_ptr<ArithmeticOperator>, Operator>(m, "ArithmeticOperator")
+    .def("get_output", &ArithmeticOperator::getOutput, py::arg("outputIdx"))
+    .def("get_input", &ArithmeticOperator::getInput, py::arg("inputIdx"))
+    .def("output_dims_forwarded", &ArithmeticOperator::outputDimsForwarded)
+    ;
+}
+}
diff --git a/python_binding/pybind_core.cpp b/python_binding/pybind_core.cpp
index be0d357b7..a58c48ebb 100644
--- a/python_binding/pybind_core.cpp
+++ b/python_binding/pybind_core.cpp
@@ -17,6 +17,7 @@ namespace Aidge {
 void init_Data(py::module&);
 void init_Tensor(py::module&);
 void init_OperatorImpl(py::module&);
+void init_ArithmeticOperator(py::module&);
 void init_Attributes(py::module&);
 void init_Operator(py::module&);
 void init_OperatorTensor(py::module&);
@@ -73,6 +74,7 @@ void init_Aidge(py::module& m){
     init_OpArgs(m);
     init_Connector(m);
 
+    init_ArithmeticOperator(m);
     init_OperatorImpl(m);
     init_Attributes(m);
     init_Operator(m);
-- 
GitLab