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.

相关推荐
其美杰布-富贵-李37 分钟前
为什么注意力分数要除以 $\sqrt{d_k}$
深度学习·注意力
ZENERGY-众壹1 小时前
AI 诊断光伏组件热斑:从 10% 功率偏差到深度学习建模的实战复盘
人工智能·深度学习·光伏运维·逆变器api·能源数字化
今心上2 小时前
关于d2l中train_ch3以及softmax中图在pycharm中显示不出来的解决方案
深度学习·机器学习·pycharm
大鱼>19 小时前
深入Real-ESRGAN架构:RRDBNet设计精髓与ONNX/TensorRT部署优化
人工智能·深度学习·架构
2zcode19 小时前
项目文档:基于MATLAB深度卷积神经网络的肺癌CT影像智能检测系统设计与实现
深度学习·matlab·cnn
m沐沐20 小时前
【深度学习】卷积神经网络 数据增强、保存最优模型实现,详细解读
人工智能·python·深度学习·机器学习·cnn·数据增强
硅谷秋水20 小时前
PhyGround:生成式世界模型中的物理推理基准测试
人工智能·深度学习·机器学习·计算机视觉·语言模型
coder_zrx20 小时前
大语言模型训练范式:从 GPT 到 Llama 的 RLHF 演进
人工智能·深度学习
不懒不懒21 小时前
Windows 深度学习环境配置(CUDA12.8 + cuDNN9.x + PyTorch)最简避坑指南(2026 最新)
人工智能·pytorch·深度学习
Kobebryant-Manba21 小时前
Hugging Face中transformers库
人工智能·深度学习·机器学习·bert