From 374b93b988ca76c803a63b2d1cb9a14003dcd2b8 Mon Sep 17 00:00:00 2001
From: NAUD Maxence <maxence.naud@cea.fr>
Date: Wed, 26 Feb 2025 21:05:05 +0000
Subject: [PATCH] Reduce memory usage of some python binding during compilation

---
 python_binding/operator/pybind_Abs.cpp        |  3 ++-
 python_binding/operator/pybind_Add.cpp        |  1 -
 python_binding/operator/pybind_And.cpp        |  3 ++-
 python_binding/operator/pybind_BatchNorm.cpp  |  2 +-
 python_binding/operator/pybind_ReLU.cpp       |  3 ++-
 python_binding/operator/pybind_ReduceMean.cpp | 15 +++++++--------
 python_binding/operator/pybind_ReduceSum.cpp  | 11 +++++------
 7 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/python_binding/operator/pybind_Abs.cpp b/python_binding/operator/pybind_Abs.cpp
index e8ae1c26e..8df1bfd13 100644
--- a/python_binding/operator/pybind_Abs.cpp
+++ b/python_binding/operator/pybind_Abs.cpp
@@ -9,9 +9,10 @@
  *
  ********************************************************************************/
 
+#include <memory>
+
 #include <pybind11/pybind11.h>
 
-#include "aidge/data/Tensor.hpp"
 #include "aidge/operator/Abs.hpp"
 #include "aidge/operator/OperatorTensor.hpp"
 
diff --git a/python_binding/operator/pybind_Add.cpp b/python_binding/operator/pybind_Add.cpp
index cd85c73d3..814500070 100644
--- a/python_binding/operator/pybind_Add.cpp
+++ b/python_binding/operator/pybind_Add.cpp
@@ -15,7 +15,6 @@
 
 #include "aidge/operator/Add.hpp"
 #include "aidge/operator/OperatorTensor.hpp"
-#include "aidge/utils/Types.h"
 
 namespace py = pybind11;
 namespace Aidge {
diff --git a/python_binding/operator/pybind_And.cpp b/python_binding/operator/pybind_And.cpp
index 13c0f9085..bd3366ef8 100644
--- a/python_binding/operator/pybind_And.cpp
+++ b/python_binding/operator/pybind_And.cpp
@@ -9,9 +9,10 @@
  *
  ********************************************************************************/
 
+#include <memory>
+
 #include <pybind11/pybind11.h>
 
-#include "aidge/data/Tensor.hpp"
 #include "aidge/operator/And.hpp"
 #include "aidge/operator/OperatorTensor.hpp"
 
diff --git a/python_binding/operator/pybind_BatchNorm.cpp b/python_binding/operator/pybind_BatchNorm.cpp
index 199ef8134..4bcb94c4a 100644
--- a/python_binding/operator/pybind_BatchNorm.cpp
+++ b/python_binding/operator/pybind_BatchNorm.cpp
@@ -10,10 +10,10 @@
  ********************************************************************************/
 
 #include <string>
+#include <vector>
 
 #include <pybind11/pybind11.h>
 
-#include "aidge/data/Tensor.hpp"
 #include "aidge/operator/BatchNorm.hpp"
 #include "aidge/operator/OperatorTensor.hpp"
 #include "aidge/utils/Types.h"
diff --git a/python_binding/operator/pybind_ReLU.cpp b/python_binding/operator/pybind_ReLU.cpp
index 8222a6a03..41ef91ed9 100644
--- a/python_binding/operator/pybind_ReLU.cpp
+++ b/python_binding/operator/pybind_ReLU.cpp
@@ -9,9 +9,10 @@
  *
  ********************************************************************************/
 
+#include <memory>
+
 #include <pybind11/pybind11.h>
 
-#include "aidge/data/Tensor.hpp"
 #include "aidge/operator/ReLU.hpp"
 #include "aidge/operator/OperatorTensor.hpp"
 
diff --git a/python_binding/operator/pybind_ReduceMean.cpp b/python_binding/operator/pybind_ReduceMean.cpp
index f4520c9bd..a97c3795b 100644
--- a/python_binding/operator/pybind_ReduceMean.cpp
+++ b/python_binding/operator/pybind_ReduceMean.cpp
@@ -9,17 +9,16 @@
  *
  ********************************************************************************/
 
-#include <array>
-#include <pybind11/pybind11.h>
-#include <pybind11/stl.h>
-#include <string>
-#include <vector>
+ #include <cstdint>  // std::int32_t
+ #include <memory>
+ #include <string>
+ #include <vector>
+
+ #include <pybind11/pybind11.h>
+ #include <pybind11/stl.h>
 
-#include "aidge/backend/OperatorImpl.hpp"
-#include "aidge/data/Tensor.hpp"
 #include "aidge/operator/OperatorTensor.hpp"
 #include "aidge/operator/ReduceMean.hpp"
-#include "aidge/utils/Types.h"
 
 namespace py = pybind11;
 namespace Aidge {
diff --git a/python_binding/operator/pybind_ReduceSum.cpp b/python_binding/operator/pybind_ReduceSum.cpp
index 915e972f8..7517c62d2 100644
--- a/python_binding/operator/pybind_ReduceSum.cpp
+++ b/python_binding/operator/pybind_ReduceSum.cpp
@@ -9,17 +9,16 @@
  *
  ********************************************************************************/
 
-#include <array>
-#include <pybind11/pybind11.h>
-#include <pybind11/stl.h>
+#include <cstdint>  // std::int32_t
+#include <memory>
 #include <string>
 #include <vector>
 
-#include "aidge/backend/OperatorImpl.hpp"
-#include "aidge/data/Tensor.hpp"
+#include <pybind11/pybind11.h>
+#include <pybind11/stl.h>
+
 #include "aidge/operator/OperatorTensor.hpp"
 #include "aidge/operator/ReduceSum.hpp"
-#include "aidge/utils/Types.h"
 
 namespace py = pybind11;
 namespace Aidge {
-- 
GitLab