ONNX量化

ONNX量化

https://onnxruntime.ai/docs/performance/model-optimizations/quantization.html
Quantization Overview
Quantization in ONNX Runtime refers to 8 bit linear quantization of an ONNX model.

During quantization, the floating point values are mapped to an 8 bit quantization space of the form: val_fp32 = scale * (val_quantized - zero_point)

scale is a positive real number used to map the floating point numbers to a quantization space. It is calculated as follows:

For asymmetric quantization:

scale = (data_range_max - data_range_min) / (quantization_range_max - quantization_range_min)

For symmetric quantization:

scale = max(abs(data_range_max), abs(data_range_min)) * 2 / (quantization_range_max - quantization_range_min)

zero_point represents zero in the quantization space. It is important that the floating point zero value be exactly representable in quantization space. This is because zero padding is used in many CNNs. If it is not possible to represent 0 uniquely after quantization, it will result in accuracy errors.

相关推荐
在所不辞兄41 分钟前
为什么在新能源汽车电驱与热管理开发中,AI驱动的数字孪生和数据驱动仿真正在部分替代对物理台架与实车标定的依赖?
人工智能·深度学习·神经网络·算法·机器学习
伞伞悦读14 小时前
【第83期】特征选择中的验证泄漏排查的实验与排查
人工智能·深度学习·机器学习
一只废狗狗狗狗狗狗狗狗狗15 小时前
自监督式学习
人工智能·深度学习·机器学习·bert
aifannihao17 小时前
AI 学习第 14 课:CNN 训 6 轮卡在 0.5352,数据没打乱
pytorch·python·深度学习·cnn·学习路线
萝卜小白18 小时前
深度学习基础面经
人工智能·深度学习
高洁011 天前
数据同化与动态状态估计:让孪生持续贴合现实
人工智能·python·深度学习·transformer·迁移学习
通信仿真爱好者1 天前
第【139】期--基于深度学习的OFDM信道估计方法研究--python完整代码
python·深度学习·ofdm·信道估计
科研邪修法1 天前
混合方法文献矩阵:先拆字段,再确定分类
人工智能·深度学习
电科_银尘1 天前
【深度学习项目实战·30】PM2.5短期预测:用LSTM构造没有未来信息的滑动窗口
人工智能·深度学习·lstm
汤姆宝库1 天前
LoRA的低秩数学与QLoRA实现
人工智能·深度学习·机器学习