Int4WeightOnlyQATLinear¶
- class torchao.quantization.qat.linear.Int4WeightOnlyQATLinear(in_features: int, out_features: int, bias: bool = False, device: device = None, groupsize: int = 256, inner_k_tiles: int = 8, precision: dtype = torch.bfloat16, scales_precision: dtype = torch.bfloat16)[源代码]¶
此模块实现了一个线性层,该层具有 int4 按通道分组的伪量化权重,其前向数值与 WeightOnlyInt4Linear 匹配,后者使用高效的 int4 tinygemm 内核。
- 参数:
groupsize – 权重的每个量化组的元素数量
precision – 权重的精度
scales_precision – 每组尺度和零点的精度