[Perf] Use value-only reduction for native per-token FP8 quantization (#59800)
Signed-off-by: jackLei0901 <841747318@qq.com> Co-authored-by: Misha Goin <mgoin64@gmail.com>
This commit is contained in:
@@ -201,7 +201,7 @@ class QuantFP8(CustomOp):
|
||||
|
||||
if scale is None:
|
||||
if self.group_shape == GroupShape.PER_TOKEN:
|
||||
x_max, _ = x.abs().max(dim=-1)
|
||||
x_max = x.abs().amax(dim=-1)
|
||||
x_max = x_max.unsqueeze(-1).to(torch.float32)
|
||||
if scale_ub is not None:
|
||||
x_max = x_max.clamp(max=scale_ub)
|
||||
|
||||
Reference in New Issue
Block a user