From c090d60968a7c3c51f96ae75cd44ef2258bd72eb Mon Sep 17 00:00:00 2001
From: Wissam Boussella <wissam.boussella@cea.fr>
Date: Thu, 19 Dec 2024 10:32:01 +0100
Subject: [PATCH] [Upd] Add pybind recipes for constant of shape and debug log
 for node_export.py

---
 aidge_core/export_utils/node_export.py    | 7 ++++++-
 python_binding/recipes/pybind_Recipes.cpp | 6 +++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/aidge_core/export_utils/node_export.py b/aidge_core/export_utils/node_export.py
index 5777814a0..c67dc00d3 100644
--- a/aidge_core/export_utils/node_export.py
+++ b/aidge_core/export_utils/node_export.py
@@ -402,7 +402,12 @@ class ExportNodeCpp(ExportNode):
             )
             kernel_include_list.append(
                 self.kernels_path + "/" + kernel_path.stem + kernel_path.suffix)
-
+            
+            if kernel_path.suffix is ["h", "hpp"]:
+                kernel_include_list.append(
+                    self.kernels_path + "/" + kernel_path.stem + kernel_path.suffix)
+            else : aidge_core.Log.debug(f"Did not copy {kernel_path.stem} because suffix is {kernel_path.suffix}, which is not 'h' or 'hpp'.")
+            
         if self.config_template != "":
             path_to_definition = f"{self.config_path}/{self.attributes['name']}.{self.config_extension}"
 
diff --git a/python_binding/recipes/pybind_Recipes.cpp b/python_binding/recipes/pybind_Recipes.cpp
index f656af70d..053a699c5 100644
--- a/python_binding/recipes/pybind_Recipes.cpp
+++ b/python_binding/recipes/pybind_Recipes.cpp
@@ -24,7 +24,11 @@ namespace py = pybind11;
 namespace Aidge {
 void init_Recipes(py::module &m)
 {
-
+  m.def("constant_folding", static_cast<void(*)(std::shared_ptr<GraphView>)>(constantFolding), py::arg("graph_view"), R"mydelimiter(
+    Recipe to optimize a computational graph by repeatedly identifying nodes with constant inputs, executes them immediately, and replaces them with pre-computed constant.
+    :param graph_view: Graph view on which we want to apply the recipe
+    :type graph_view: :py:class:`aidge_core.GraphView`
+    )mydelimiter");
 
   m.def("matmul_to_fc", static_cast<void(*)(std::shared_ptr<GraphView>)>(matMulToFC), py::arg("graph_view"), R"mydelimiter(
     Recipe to Fuse MatMul and Add operators into an :py:class:`aidge_core.FC` operator.
-- 
GitLab