From f981c212cafda87b9cb621a77851d6659d28e037 Mon Sep 17 00:00:00 2001
From: IKucher <Inna.KUCHER@cea.fr>
Date: Wed, 15 Nov 2023 08:59:40 +0000
Subject: [PATCH] minor fix for hook and scaling update

---
 include/aidge/hook/ExecTime.hpp     |  2 +-
 include/aidge/hook/OutputRange.hpp  |  2 +-
 include/aidge/operator/Operator.hpp |  1 +
 include/aidge/operator/Scaling.hpp  | 26 +++++++++++++++++---------
 4 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/include/aidge/hook/ExecTime.hpp b/include/aidge/hook/ExecTime.hpp
index 212fef586..0964d9575 100644
--- a/include/aidge/hook/ExecTime.hpp
+++ b/include/aidge/hook/ExecTime.hpp
@@ -18,7 +18,7 @@
 #define execTime_H_
 
 #include "aidge/operator/Operator.hpp"
-#include "aidge/hook/hook.hpp"
+#include "aidge/hook/Hook.hpp"
 #include <memory>
 #include <chrono>
 #include <vector>
diff --git a/include/aidge/hook/OutputRange.hpp b/include/aidge/hook/OutputRange.hpp
index a2da2a997..355f4aaa1 100644
--- a/include/aidge/hook/OutputRange.hpp
+++ b/include/aidge/hook/OutputRange.hpp
@@ -18,7 +18,7 @@
 #define AIDGE_CORE_HOOK_OUTPUTRANGE_H_
 
 #include "aidge/operator/Operator.hpp"
-#include "aidge/hook/hook.hpp"
+#include "aidge/hook/Hook.hpp"
 #include <memory>
 #include <chrono>
 #include <vector>
diff --git a/include/aidge/operator/Operator.hpp b/include/aidge/operator/Operator.hpp
index 903b6362a..0281e1bb8 100644
--- a/include/aidge/operator/Operator.hpp
+++ b/include/aidge/operator/Operator.hpp
@@ -21,6 +21,7 @@
 #include "aidge/data/Tensor.hpp"
 #include "aidge/utils/Types.h"
 #include "aidge/hook/Hook.hpp"
+#include <iostream>
 
 namespace Aidge {
 
diff --git a/include/aidge/operator/Scaling.hpp b/include/aidge/operator/Scaling.hpp
index 353666fb3..43dd7beb1 100644
--- a/include/aidge/operator/Scaling.hpp
+++ b/include/aidge/operator/Scaling.hpp
@@ -28,12 +28,12 @@
 
 namespace Aidge {
 enum class ScalingAttr {
-    scalingFactor
+    scalingFactor, quantizedNbBits, isOutputUnsigned
 };
 
 class Scaling_Op : public Operator,
     public Registrable<Scaling_Op, std::string, std::unique_ptr<OperatorImpl>(const Scaling_Op&)>,
-    public StaticAttributes<ScalingAttr, float> {
+    public StaticAttributes<ScalingAttr, float, size_t, bool> {
 public:
     // FIXME: change accessibility
     std::shared_ptr<Tensor> mInput = std::make_shared<Tensor>();
@@ -44,16 +44,18 @@ public:
 
     Scaling_Op() = delete;
 
-    using Attributes_ = StaticAttributes<ScalingAttr, float>;
+    using Attributes_ = StaticAttributes<ScalingAttr, float, std::size_t, bool>;
     template <ScalingAttr e> using attr = typename Attributes_::template attr<e>;
 
-    Scaling_Op(float scalingFactor)
+    Scaling_Op(float scalingFactor, std::size_t nbBits, bool isOutputUnsigned)
             : Operator(Type),
             Attributes_(
-                attr<ScalingAttr::scalingFactor>(scalingFactor))
-    {
-        setDatatype(DataType::Float32);
-    }
+                attr<ScalingAttr::scalingFactor>(scalingFactor),
+                attr<ScalingAttr::quantizedNbBits>(nbBits),
+                attr<ScalingAttr::isOutputUnsigned>(isOutputUnsigned)) {
+            
+            setDatatype(DataType::Float32);
+        }
 
     /**
      * @brief Copy-constructor. Copy the operator attributes and its output tensor(s), but not its input tensors (the new operator has no input associated).
@@ -154,15 +156,21 @@ public:
     }
 };
 
+/*
 inline std::shared_ptr<Node> Scaling(float scalingFactor = 1.0f, const std::string& name = "") {
     return std::make_shared<Node>(std::make_shared<Scaling_Op>(scalingFactor), name);
 }
+*/
+inline std::shared_ptr<Node> Scaling(float scalingFactor = 1.0f, std::size_t quantizedNbBits=8, bool isOutputUnsigned=true, const std::string& name = "") {
+    return std::make_shared<Node>(std::make_shared<Scaling_Op>(scalingFactor,quantizedNbBits, isOutputUnsigned), name);
+}
+
 }
 
 namespace {
 template <>
 const char* const EnumStrings<Aidge::ScalingAttr>::data[]
-    = {"scalingFactor"};
+    = {"scalingFactor", "quantizedNbBits", "isOutputUnsigned"};
 }
 
 #endif /* __AIDGE_CORE_OPERATOR_RELU_H__ */
-- 
GitLab