AI术语词典

A comprehensive multilingual AI terminology dictionary

Definition

量化将高精度浮点数(如 FP32)转换为低精度格式(如 INT8 或 FP16)。这种转换减少了模型的内存使用和计算需求,从而加速推理过程并降低硬件要求。

Summary

一种模型优化技术,通过降低神经网络计算中数字的精度来减小模型体积并提高速度。

Key Concepts

Use Cases

Code Example

1
2
3
4
5
6
import torch.quantization as quant
# Example of converting a model to quantized format
model.eval()
model.qconfig = quant.get_default_qconfig('fbgemm')
quantized_model = quant.prepare(model, inplace=False)
quantized_model = quant.convert(quantized_model, inplace=False)