Skip to content
Snippets Groups Projects
Commit f981c212 authored by Inna Kucher's avatar Inna Kucher
Browse files

minor fix for hook and scaling update

parent 1251200f
No related branches found
No related tags found
No related merge requests found
......@@ -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>
......
......@@ -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>
......
......@@ -21,6 +21,7 @@
#include "aidge/data/Tensor.hpp"
#include "aidge/utils/Types.h"
#include "aidge/hook/Hook.hpp"
#include <iostream>
namespace Aidge {
......
......@@ -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__ */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment