From a0b77db84d9efa73cb3f598f59fe4e20286e6ad9 Mon Sep 17 00:00:00 2001 From: Chunan Zeng Date: Sat, 17 Oct 2026 20:40:16 -0700 Subject: [PATCH] [Perf] DFLASH: build the draft num_token_non_padded scalar with torch.full (#44119) --- python/sglang/srt/speculative/dflash_worker_v2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/sglang/srt/speculative/dflash_worker_v2.py b/python/sglang/srt/speculative/dflash_worker_v2.py index 872e49a61e..f59653563b 100644 --- a/python/sglang/srt/speculative/dflash_worker_v2.py +++ b/python/sglang/srt/speculative/dflash_worker_v2.py @@ -2599,7 +2599,7 @@ class DFlashWorkerV2(BaseSpecWorker): spec_info=self._draft_block_spec_info, capture_hidden_mode=CaptureHiddenMode.NULL, num_token_non_padded=( - torch.tensor(bs * block_size, dtype=torch.int32, device=device) + torch.full((), bs * block_size, dtype=torch.int32, device=device) if enable_num_token_non_padded() else None ),