From 35e45eeb07ff7a40b509e5104948fff0c19d3c61 Mon Sep 17 00:00:00 2001
From: Jerome Hue <jerome.hue@cea.fr>
Date: Thu, 21 Nov 2024 10:31:07 +0100
Subject: [PATCH] feat: Add python binding files for Stack operator

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

diff --git a/python_binding/operator/pybind_Stack.cpp b/python_binding/operator/pybind_Stack.cpp
new file mode 100644
index 000000000..9bd429002
--- /dev/null
+++ b/python_binding/operator/pybind_Stack.cpp
@@ -0,0 +1,29 @@
+/********************************************************************************
+ * 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/data/Tensor.hpp"
+#include "aidge/operator/Stack.hpp"
+#include "aidge/operator/OperatorTensor.hpp"
+
+namespace py = pybind11;
+namespace Aidge {
+void init_Stack(py::module& m) {
+    py::class_<StackOp, std::shared_ptr<StackOp>, OperatorTensor>(m, "StackOp", py::multiple_inheritance())
+    .def(py::init<const std::uint32_t>(), py::arg("max_elements"))
+    .def_static("get_inputs_name", &StackOp::getInputsName)
+    .def_static("get_outputs_name", &StackOp::getOutputsName)
+    .def_readonly_static("Type", &StackOp::s_type);
+
+    m.def("Stack", &stack, py::arg("max_elements"), py::arg("name") = "");
+}
+}
diff --git a/python_binding/pybind_core.cpp b/python_binding/pybind_core.cpp
index 7a88f61f5..4f7ffea5f 100644
--- a/python_binding/pybind_core.cpp
+++ b/python_binding/pybind_core.cpp
@@ -77,6 +77,7 @@ void init_Softmax(py::module&);
 void init_Split(py::module&);
 void init_Sqrt(py::module&);
 void init_Squeeze(py::module&);
+void init_Stack(py::module&);
 void init_Sub(py::module&);
 void init_Tanh(py::module&);
 void init_Transpose(py::module&);
@@ -169,6 +170,7 @@ void init_Aidge(py::module& m) {
     init_Split(m);
     init_Sqrt(m);
     init_Squeeze(m);
+    init_Stack(m);
     init_Sub(m);
     init_Tanh(m);
     init_Transpose(m);
-- 
GitLab