From b1d099b8367af03f7ecc0f5247fa6a8b4007377e Mon Sep 17 00:00:00 2001
From: NAUD Maxence <maxence.naud@cea.fr>
Date: Fri, 21 Feb 2025 13:13:28 +0000
Subject: [PATCH] [Fix] attribute names in Operators

---
 include/aidge/operator/AvgPooling.hpp | 12 ++++++------
 include/aidge/operator/MaxPooling.hpp | 24 +++++++++++-------------
 include/aidge/operator/Stack.hpp      |  2 +-
 src/operator/MaxPooling.cpp           |  2 +-
 4 files changed, 19 insertions(+), 21 deletions(-)

diff --git a/include/aidge/operator/AvgPooling.hpp b/include/aidge/operator/AvgPooling.hpp
index 6022d6a2a..3c7d943a3 100644
--- a/include/aidge/operator/AvgPooling.hpp
+++ b/include/aidge/operator/AvgPooling.hpp
@@ -28,6 +28,11 @@ namespace Aidge {
  * @brief Attributes specific to the AvgPooling operation.
  */
 enum class AvgPoolingAttr {
+    /**
+     * @brief Kernel dimensions for the pooling operation.
+     * Specifies the size of the pooling window along each spatial dimension.
+     */
+    KernelDims,
     /**
      * @brief Stride dimensions for sliding the pooling window.
      * Specifies the step size of the sliding window along each spatial dimension.
@@ -37,11 +42,6 @@ enum class AvgPoolingAttr {
      * @brief Dilation along each spatial axis. Default value is 1.
      */
     Dilations,
-    /**
-     * @brief Kernel dimensions for the pooling operation.
-     * Specifies the size of the pooling window along each spatial dimension.
-     */
-    KernelDims,
     /**
      * @brief Flag indicating whether to use ceil or floor when calculating output size.
      * - `true`: Use `ceil` for output size calculation.
@@ -56,7 +56,7 @@ namespace {
      */
     template <>
     const char *const EnumStrings<Aidge::AvgPoolingAttr>::data[] = {
-        "stride_dims", "kernel_dims", "dilations", "ceil_mode"
+        "kernel_dims", "stride_dims", "dilations", "ceil_mode"
     };
 }
 namespace Aidge {
diff --git a/include/aidge/operator/MaxPooling.hpp b/include/aidge/operator/MaxPooling.hpp
index d90aab4a0..94c786c31 100644
--- a/include/aidge/operator/MaxPooling.hpp
+++ b/include/aidge/operator/MaxPooling.hpp
@@ -32,26 +32,25 @@ namespace Aidge {
 
 /**
  * @enum MaxPoolingAttr
- * @brief Attributes defining the configuration of a MaxPooling operation.
+ * @brief Attributes defining the configuration of a MaxPooling Operator.
  */
 enum class MaxPoolingAttr {
+  /**
+   * @brief Kernel dimensions specifying the size of the pooling window for each spatial dimension.
+   * Must be an array of positive integers. Common examples include [2,2] or [3,3].
+   */
+  KernelDims,
   /**
    * @brief Stride dimensions for sliding the pooling window across the input dimensions.
    * The stride specifies how much the window moves after each operation.
-   * Must be positive integers.
+   * Must be an array of positive integers. For example, [1,1] or [2,2].
    */
   StrideDims,
   /**
-   * @brief Dilation along each spatial axis. Default value is 1.
+   * @brief Dilation along each spatial axis. Default value is 1 for all axes.
+   * Must be an array of positive integers. For example, [1,1].
    */
   Dilations,
-  /**
-   * @brief Kernel dimensions specifying the size of the pooling window for each spatial dimension.
-   * For example, common kernel dimensions include 2x2 or 3x3.
-   * Must be positive integers.
-   */
-  KernelDims,
-
   /**
    * @brief Flag indicating whether to use ceil or floor when calculating output size.
    * - `true`: Use `ceil` for output size calculation.
@@ -65,7 +64,7 @@ namespace {
      * @brief String representations of MaxPooling attributes for debugging and logging.
      */
     template <>
-    const char *const EnumStrings<Aidge::MaxPoolingAttr>::data[] = {"stride_dims", "kernel_dims", "dilations", "ceil_mode"};
+    const char *const EnumStrings<Aidge::MaxPoolingAttr>::data[] = {"kernel_dims", "stride_dims", "dilations", "ceil_mode"};
     }
 
 namespace Aidge{
@@ -107,13 +106,12 @@ class MaxPooling_Op : public OperatorTensor,
 public:
     static const std::string Type; ///< Static identifier for this operator type.
 
+private:
     using Attributes_ = StaticAttributes<MaxPoolingAttr,
                                          std::array<DimSize_t, DIM>,
                                          std::array<DimSize_t, DIM>,
                                          std::array<DimSize_t, DIM>,
                                          bool>;
-
-private:
     template <MaxPoolingAttr e>
     using attr = typename Attributes_::template attr<e>;
     const std::shared_ptr<Attributes_> mAttributes; ///< Shared pointer to operator attributes.
diff --git a/include/aidge/operator/Stack.hpp b/include/aidge/operator/Stack.hpp
index 83e4f68e1..d22b2f2dd 100644
--- a/include/aidge/operator/Stack.hpp
+++ b/include/aidge/operator/Stack.hpp
@@ -107,7 +107,7 @@ namespace {
      * @brief String representations of the Stack operator's attributes.
      */
     template <>
-    const char *const EnumStrings<Aidge::StackAttr>::data[] = {"forward_step", "max_elements"};
+    const char *const EnumStrings<Aidge::StackAttr>::data[] = {"forward_step", "backward_step", "max_elements"};
 }
 namespace Aidge {
 /**
diff --git a/src/operator/MaxPooling.cpp b/src/operator/MaxPooling.cpp
index afd8e00cc..b0bd167dd 100644
--- a/src/operator/MaxPooling.cpp
+++ b/src/operator/MaxPooling.cpp
@@ -29,8 +29,8 @@ Aidge::MaxPooling_Op<DIM>::MaxPooling_Op(const std::array<Aidge::DimSize_t, DIM>
                             bool ceil_mode)
     : OperatorTensor(Type, {InputCategory::Data}, 1),
     mAttributes(std::make_shared<Attributes_>(
-    attr<MaxPoolingAttr::StrideDims>(stride_dims),
     attr<MaxPoolingAttr::KernelDims>(kernel_dims),
+    attr<MaxPoolingAttr::StrideDims>(stride_dims),
     attr<MaxPoolingAttr::Dilations>(dilations),
     attr<MaxPoolingAttr::CeilMode>(ceil_mode)))
 {}
-- 
GitLab