diff --git a/python/sglang/srt/mem_cache/allocation.py b/python/sglang/srt/mem_cache/allocation.py index d87482278..9605c9e3b 100644 --- a/python/sglang/srt/mem_cache/allocation.py +++ b/python/sglang/srt/mem_cache/allocation.py @@ -352,7 +352,7 @@ def alloc_for_extend( else: # Paged allocation - build last_loc last_loc = [ - (t[-1:] if len(t) > 0 else torch.tensor([-1], device=batch.device)) + (t[-1:] if len(t) > 0 else torch.full((1,), -1, device=batch.device)) for t in prefix_tensors ] out_cache_loc = alloc_paged_token_slots_extend(