From 0fab52f0aa0fa34d96f2aefe507283478caa66d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elvir=20Crn=C4=8Devi=C4=87?= Date: Wed, 1 Apr 2026 04:14:59 +0200 Subject: [PATCH] Fix NaN from stale FP4 scale padding in create_fp4_scale_tensor (#38148) Signed-off-by: Elvir Crncevic Co-authored-by: Tyler Michael Smith --- vllm/_custom_ops.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vllm/_custom_ops.py b/vllm/_custom_ops.py index c55f5b923..55e50e4ec 100644 --- a/vllm/_custom_ops.py +++ b/vllm/_custom_ops.py @@ -56,11 +56,11 @@ def create_fp4_scale_tensor( rounded_m = round_up(m, 128) scale_n = n // block_size rounded_n = round_up(scale_n, 4) - return torch.empty( + return torch.zeros( (rounded_m, rounded_n // 4), device=device, dtype=torch.int32 ) else: - return torch.empty((m, n // block_size), device=device, dtype=torch.uint8) + return torch.zeros((m, n // block_size), device=device, dtype=torch.uint8) def create_fp4_output_tensors(