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.

相关推荐
大江东去浪淘尽千古风流人物几秒前
【RT-1】面向真实世界规模化控制的机器人Transformer
深度学习·机器人·transformer
ting945200016 分钟前
动手学深度学习(PyTorch版)深度详解(4):深度学习计算实战详解
人工智能·pytorch·深度学习
小糖学代码33 分钟前
LLM系列:2.pytorch入门:9.神经网络的学习
人工智能·python·深度学习·神经网络·学习·机器学习
liuyunshengsir41 分钟前
手写最基础的大模型推理并使用Profile监控GPU性能消耗情况
人工智能·深度学习·机器学习
数据门徒1 小时前
神经网络原理 第三章:单层感知器
深度学习·神经网络
小超同学你好1 小时前
Transformer 31. ALBEF:Align before Fuse,用「先对齐、再融合」解决图文交互难学的问题
深度学习·transformer·交互
AI周红伟1 小时前
周红伟:OpenClaw安全防控:OpenClaw+Skills+私有大模型安全部署、实操和企业应用实操
大数据·人工智能·深度学习·安全·copilot·openclaw
GoAI2 小时前
《深入浅出Agent》:项目深度解析Autoresearch
人工智能·深度学习·大模型·llm·agent
kishu_iOS&AI2 小时前
NLP —— LSTM/GRU模型
人工智能·pytorch·深度学习·自然语言处理·gru·lstm
硅谷秋水2 小时前
《自动驾驶系统开发》英文版《Autonomous Driving Hanbook》推荐
人工智能·深度学习·机器学习·计算机视觉·语言模型·自动驾驶