Quantizer factory should do more
Current Quantizer factory only create a Mul node.
This issue propose to extend this. I propose the following signature:
/**
* @brief Create a Quantizer node that initially consists of a multiplier and a scaling factor.
* @param scalingFactor The value of the multiplicative coefficient.
* @param name Name of the Quantizer.
* @param round If true, the scaled value will be rounded to the nearest integer.
* @param clip_min The minimum clipping value. Any value below this will be clamped.
* @param clip_max The maximum clipping value. Any value above this will be clamped.
* @param toType The target data type to cast the quantized values to. If DataType::Any, no type conversion is applied.
*
* @return A shared pointer to the created Quantizer node.
*/
std::shared_ptr<Aidge::Node> Quantizer(
double scalingFactor,
const std::string& name,
double zero_point = 0,
bool round = false,
float clip_min = std::numeric_limits<float>::lowest(),
float clip_max = std::numeric_limits<float>::max(),
Aidge::DataType toType = Aidge::DataType::Any
);
My idea is that by default:
flowchart TD
Input --> Mul --> Add --> Clip --> Output;
Scale --> Mul;
ZeroPoint --> Add;
ClipMin --> Clip;
ClipMax --> Clip;
And after adding the clipping and the Cast node:
flowchart TD
Input --> CastScale --> Mul --> Round --> Add --> Clip --> CastInt --> Output;
Scale --> Mul;
ZeroPoint --> Add;
ClipMin --> Clip;
ClipMax --> Clip;
Edited by Cyril Moineau