Skip to content

Commit 12fc560

Browse files
authored
fix PTQ docs (#1580)
1 parent 8e1691b commit 12fc560

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

docs/images/post_quant2.png

6.85 KB
Loading

docs/zh_cn/tutorials/quant/post_training_quantization.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ s=\frac{2^{b-1}-1}{\alpha}
2222
$$
2323

2424
$$
25-
x_{q}=\operatorname{quantize}(x, b, s)=\operatorname{clip}\left(\operatorname{round}(s \cdot x),-2^{b-1}+1,2^{b-1}-1\right)
25+
x_{q}=\operatorname{quantize}(x, b, s)=\operatorname{clip}\left(\operatorname{round}(s \cdot x),-2^{b-1},2^{b-1}-1\right)
2626
$$
2727

2828
反量化过程可以用以下公式表述:
2929

3030
$$
31-
x_{q}=\operatorname{quantize}(x, b, s)=\operatorname{clip}\left(\operatorname{round}(s \cdot x),-2^{b-1}+1,2^{b-1}-1\right)
31+
x_{dq}=\operatorname{dequantize}(x, s)=\frac{x}{s}
3232
$$
3333

3434
其中,s为所选取的scale值,即将s作为尺度因子,将全精度参数映射到低比特取值范围;α为选定的全精度参数的表示范围,即全精度参数将被限制在[-α,α]内;b为量化的比特数,x为待量化的全精度参数。因此,如果给定量化的比特数b,我们只需要选定合适的α值,就可以确定量化所需的参数s。

0 commit comments

Comments
 (0)