Skip to content
Snippets Groups Projects

Fix the NaN bug

Merged Benjamin Halimi requested to merge bhalimi/aidge_quantization:DevPTQ into main
Files
3
@@ -54,9 +54,9 @@ namespace Aidge {
* @brief Normalize the activations of each affine node so that it become equal to one.
* This is done by reconfiguring the scaling nodes, as well as rescaling the weights and biases tensors.
* @param graphView The GraphView containing the affine nodes.
* @param inputDataSet The input dataset on which the value ranges are computed.
* @param valueRanges The node output value ranges computed over the calibration dataset.
*/
void normalizeActivations(std::shared_ptr<GraphView> graphView, std::vector<std::shared_ptr<Tensor>> inputDataSet);
void normalizeActivations(std::shared_ptr<GraphView> graphView, std::map<std::string, float> valueRanges);
/**
@@ -72,7 +72,7 @@ namespace Aidge {
* @param nbBits The desired number of bits of the quantization.
* @param inputDataSet The input dataset on which the value ranges are computed.
*/
void quantizeNetwork(std::shared_ptr<GraphView> graphView, std::uint8_t nbBits, std::vector<std::shared_ptr<Tensor>> inputDataSet);
void quantizeNetwork(std::shared_ptr<GraphView> graphView, std::uint8_t nbBits, std::vector<std::shared_ptr<Tensor>> inputDataSet, bool OptimizeCliping);
/**
* @brief Compute the weight ranges of every affine node. Provided for debuging purposes.
@@ -88,6 +88,11 @@ namespace Aidge {
void clearBiases(std::shared_ptr<GraphView> graphView);
void devPTQ(std::shared_ptr<GraphView> graphView);
std::map<std::string, std::vector<int>> computeScalingHistograms(std::map<std::string, float> valueRanges, int nbBins, std::shared_ptr<GraphView> graphView, std::vector<std::shared_ptr<Tensor>> inputDataSet);
float computeBestClipping(std::vector<int> histogram, std::uint8_t nbBits);
}
#endif /* AIDGE_QUANTIZATION_QUANTPTQ_H_ */
Loading