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.

相关推荐
海天一色y6 小时前
模型部署的「通用语」:ONNX 转换
pytorch·onnx
量子-Alex7 小时前
【大模型后训练SFT】Finetuning with Sampling: SFT Learns Better Than You Think
人工智能·深度学习·机器学习
ForDreamMusk7 小时前
Transformer Encoder Block
人工智能·深度学习·transformer
打工仔折腾 AI7 小时前
LLaMA 1 到 LLaMA 3 架构演进拆解:从 RoPE、GQA 到词表扩张
人工智能·后端·python·深度学习·langchain·llama
这张生成的图像能检测吗8 小时前
(论文速读)LINN:液体神经网络与脉冲神经元融合的可解释旋转机械故障诊断
人工智能·深度学习·神经网络·故障诊断
东方佑9 小时前
v24 (Hybrid2Fast) 架构与实验报告
人工智能·深度学习·语言模型·自然语言处理·架构
龍德明宇9 小时前
无摩擦的智能与有重力的主体-龍德明宇
人工智能·深度学习·ai哲学·负主体性·ai存在论
成为深度学习高手11 小时前
SEMixer:以随机注意力增强patch语义、渐进混合多尺度的轻量长期时序预测模型
人工智能·深度学习·机器学习·数据挖掘·时间序列
阡陌数智13 小时前
大模型领域自适应微调:小样本场景下过拟合抑制与数据构建方法论
人工智能·深度学习·机器学习
超大青花鱼13 小时前
Ubuntu20.04安装CUDA11.8教程
人工智能·深度学习·计算机视觉