From e2f9f441088dcbe33b7968f2fe7a0e64fad71445 Mon Sep 17 00:00:00 2001
From: hrouis <houssemeddine.rouis92@gmail.com>
Date: Tue, 21 Nov 2023 15:24:46 +0100
Subject: [PATCH] minor code cleanings

---
 include/aidge/operator/Erf.hpp                | 10 +++++-----
 include/aidge/operator/Gather.hpp             |  2 +-
 include/aidge/operator/ReduceMean.hpp         |  8 ++++----
 include/aidge/operator/Reshape.hpp            | 12 ++++++------
 python_binding/operator/pybind_ReduceMean.cpp |  4 ----
 5 files changed, 16 insertions(+), 20 deletions(-)

diff --git a/include/aidge/operator/Erf.hpp b/include/aidge/operator/Erf.hpp
index 31157558d..1fa961c73 100644
--- a/include/aidge/operator/Erf.hpp
+++ b/include/aidge/operator/Erf.hpp
@@ -64,7 +64,7 @@ public:
     }
 
     void associateInput(const IOIndex_t inputIdx, std::shared_ptr<Data> data) override final {
-        assert(inputIdx == 0 && "operator supports only 1 input");
+        assert(inputIdx == 0 && "Erf operator supports only 1 input");
         (void) inputIdx; // avoid unused warning
         assert(strcmp(data->type(), Tensor::Type)==0 && "input data must be of Tensor type");
         mInput = std::dynamic_pointer_cast<Tensor>(data);
@@ -85,24 +85,24 @@ public:
 
 
     inline std::shared_ptr<Tensor> getInput(const IOIndex_t inputIdx) const override final {
-        assert((inputIdx == 0) && "Erf Operator has only 1 input");
+        assert((inputIdx == 0) && "Erf operator has only 1 input");
         (void) inputIdx; // avoid unused warning
         return mInput;
     }
     inline std::shared_ptr<Tensor> getOutput(const IOIndex_t outputIdx) const override final {
-        assert((outputIdx == 0) && "Erf Operator has only 1 output");
+        assert((outputIdx == 0) && "Erf operator has only 1 output");
         (void) outputIdx; // avoid unused warning
         return mOutput;
     }
 
 
     std::shared_ptr<Data> getRawInput(const IOIndex_t inputIdx) const override final {
-        assert(inputIdx == 0 && "operator supports only 1 input");
+        assert(inputIdx == 0 && "Erf operator supports only 1 input");
         (void) inputIdx; // avoid unused warning
         return std::static_pointer_cast<Data>(mInput);
     }
     std::shared_ptr<Data> getRawOutput(const IOIndex_t outputIdx) const override final {
-        assert(outputIdx == 0 && "operator supports only 1 output");
+        assert(outputIdx == 0 && "Erf operator supports only 1 output");
         (void) outputIdx; // avoid unused warning
         return std::static_pointer_cast<Data>(mOutput);
     }
diff --git a/include/aidge/operator/Gather.hpp b/include/aidge/operator/Gather.hpp
index 2167076de..3a2346d3f 100644
--- a/include/aidge/operator/Gather.hpp
+++ b/include/aidge/operator/Gather.hpp
@@ -79,7 +79,7 @@ public:
     }
 
     void associateInput(const IOIndex_t inputIdx, std::shared_ptr<Data> data) override final {
-        assert(inputIdx < 2 && "Gather supports only 2 inputs");
+        assert(inputIdx < 2 && "Gather operator supports only 2 inputs");
         assert(strcmp(data->type(), Tensor::Type)==0 && "input data must be of Tensor type");
         mInputs[inputIdx] = std::dynamic_pointer_cast<Tensor>(data);
     }
diff --git a/include/aidge/operator/ReduceMean.hpp b/include/aidge/operator/ReduceMean.hpp
index 917f5bd37..70440da2d 100644
--- a/include/aidge/operator/ReduceMean.hpp
+++ b/include/aidge/operator/ReduceMean.hpp
@@ -115,24 +115,24 @@ class ReduceMean_Op : public Operator,
 
 
     inline std::shared_ptr<Tensor> getInput(const IOIndex_t inputIdx) const override final {
-        assert(inputIdx == 0 && "ReduceMean Operators supports only 1 input");
+        assert(inputIdx == 0 && "ReduceMean operators supports only 1 input");
         (void) inputIdx; // avoid unused warning
         return mInput;
     }
     inline std::shared_ptr<Tensor> getOutput(const IOIndex_t outputIdx) const override final {
-        assert((outputIdx == 0) && "ReduceMean Operator has only 1 output");
+        assert((outputIdx == 0) && "ReduceMean operator has only 1 output");
         (void) outputIdx; // avoid unused warning
         return mOutput;
     }
 
 
     std::shared_ptr<Data> getRawInput(const IOIndex_t inputIdx) const override final {
-        assert(inputIdx == 0 && "ReduceMean Operators supports only 1 input");
+        assert(inputIdx == 0 && "ReduceMean operators supports only 1 input");
         (void) inputIdx; // avoid unused warning
         return std::static_pointer_cast<Data>(mInput);
     }
     std::shared_ptr<Data> getRawOutput(const IOIndex_t outputIdx) const override final {
-        assert(outputIdx == 0 && "ReduceMean Operator supports only 1 output");
+        assert(outputIdx == 0 && "ReduceMean operator supports only 1 output");
         (void) outputIdx; // avoid unused warning
         return std::static_pointer_cast<Data>(mOutput);
     }
diff --git a/include/aidge/operator/Reshape.hpp b/include/aidge/operator/Reshape.hpp
index 62fe3e929..bc60fee91 100644
--- a/include/aidge/operator/Reshape.hpp
+++ b/include/aidge/operator/Reshape.hpp
@@ -64,7 +64,7 @@ public:
     }
 
     void associateInput(const IOIndex_t inputIdx, std::shared_ptr<Data> data) override final {
-        assert(inputIdx < 2 && "Reshape Operator supports only 2 inputs");
+        assert(inputIdx < 2 && "Reshape operator supports only 2 inputs");
         assert(strcmp(data->type(), Tensor::Type)==0 && "input data must be of Tensor type");
         mInputs[inputIdx] = std::dynamic_pointer_cast<Tensor>(data);
     }
@@ -74,7 +74,7 @@ public:
         {
             std::vector<DimSize_t> outDims;
             int* shapeElem = static_cast<int*>(mInputs[1]->getImpl()->rawPtr());
-            for(std::size_t i=0; i<mInputs[1]->nbDims(); ++i)
+            for(std::size_t i=0; i<mInputs[1]->size(); ++i)
             {
                 outDims.push_back(shapeElem[i]);
             }
@@ -95,24 +95,24 @@ public:
 
 
     inline std::shared_ptr<Tensor> getInput(const IOIndex_t inputIdx) const override final {
-        assert((inputIdx < 2) && "Reshape Operator has 2 inputs");
+        assert((inputIdx < 2) && "Reshape operator has 2 inputs");
         (void) inputIdx; // avoid unused warning
         return mInputs[inputIdx];
     }
     inline std::shared_ptr<Tensor> getOutput(const IOIndex_t outputIdx) const override final {
-        assert((outputIdx == 0) && "Reshape Operator has only 1 output");
+        assert((outputIdx == 0) && "Reshape operator has only 1 output");
         (void) outputIdx; // avoid unused warning
         return mOutput;
     }
 
 
     std::shared_ptr<Data> getRawInput(const IOIndex_t inputIdx) const override final {
-        assert(inputIdx < 2 && "Reshape Operator supports only 2 inputs");
+        assert(inputIdx < 2 && "Reshape operator supports only 2 inputs");
         (void) inputIdx; // avoid unused warning
         return std::static_pointer_cast<Data>(mInputs[inputIdx]);
     }
     std::shared_ptr<Data> getRawOutput(const IOIndex_t outputIdx) const override final {
-        assert(outputIdx == 0 && "Reshape Operator supports only 1 output");
+        assert(outputIdx == 0 && "Reshape operator supports only 1 output");
         (void) outputIdx; // avoid unused warning
         return std::static_pointer_cast<Data>(mOutput);
     }
diff --git a/python_binding/operator/pybind_ReduceMean.cpp b/python_binding/operator/pybind_ReduceMean.cpp
index 90c00ff8e..1df907734 100644
--- a/python_binding/operator/pybind_ReduceMean.cpp
+++ b/python_binding/operator/pybind_ReduceMean.cpp
@@ -11,7 +11,6 @@
 
 #include <pybind11/pybind11.h>
 #include <pybind11/stl.h>
-#include <iostream>
 #include <string>
 #include <vector>
 #include <array>
@@ -27,9 +26,6 @@ namespace Aidge {
 template <DimIdx_t DIM> void declare_ReduceMeanOp(py::module &m) {
   py::class_<ReduceMean_Op<DIM>, std::shared_ptr<ReduceMean_Op<DIM>>, Operator, Attributes>(
     m, ("ReduceMeanOp" + std::to_string(DIM) + "D").c_str(), py::multiple_inheritance())
-//   .def(py::init<const std::array<DimSize_t, DIM> &, DimSize_t>(),
-//         py::arg("axes"),
-//         py::arg("keep_dims"))
     .def("get_inputs_name", &ReduceMean_Op<DIM>::getInputsName)
     .def("get_outputs_name", &ReduceMean_Op<DIM>::getOutputsName)
     ;
-- 
GitLab