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.

相关推荐
ForDreamMusk2 小时前
BPTT
深度学习
不要生病了3 小时前
Brain-JEPA:用功能梯度定位与时空遮蔽预训练 fMRI 基础模型
人工智能·深度学习
棣廷3 小时前
初识深度学习——数据增强与模型保存
人工智能·深度学习
不要生病了3 小时前
Through Their Eyes:用简单对齐实现跨被试与跨数据集视觉脑解码
人工智能·深度学习
一木 之林3 小时前
深度学习-计算优化与分布式训练-111-128
人工智能·深度学习
夜瞬3 小时前
Merge、Ensemble 与 Cooperate:一文读懂大语言模型协同
人工智能·深度学习·语言模型
羞儿13 小时前
人体姿态估计系统知识框架
深度学习·计算机视觉·姿态估计·行为识别
Easy_API14 小时前
从“有多少卡“到“卖多少 Token“:算力的标尺正在换
大数据·人工智能·深度学习
蓝羽飞鸟16 小时前
什么是自监督学习
人工智能·深度学习
大江东去浪淘尽千古风流人物17 小时前
【UniSim-SLAM】前馈SLAM的双流架构:Sim(3)统一位姿图、与经典SLAM及DPVO的三范式对比
深度学习·计算机视觉·3d·交互·人体姿态估计·eccv·3d重建