From f88b2aa6af876ebeee940af8077c495a4d708245 Mon Sep 17 00:00:00 2001 From: Binyao Jiang Date: Wed, 19 Nov 2025 16:07:49 -0800 Subject: [PATCH] [GDN] Remove unnecessary contiguous() (#13604) --- .../layers/attention/hybrid_linear_attn_backend.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/python/sglang/srt/layers/attention/hybrid_linear_attn_backend.py b/python/sglang/srt/layers/attention/hybrid_linear_attn_backend.py index 5cfaac9e4..c121e663a 100644 --- a/python/sglang/srt/layers/attention/hybrid_linear_attn_backend.py +++ b/python/sglang/srt/layers/attention/hybrid_linear_attn_backend.py @@ -649,11 +649,9 @@ class GDNAttnBackend(MambaAttnBackendBase): if is_target_verify: batch_size = seq_len // forward_batch.spec_info.draft_token_num draft_token_num = forward_batch.spec_info.draft_token_num - mixed_qkv_reshaped = ( - mixed_qkv.view(batch_size, draft_token_num, -1) - .transpose(1, 2) - .contiguous() - ) + mixed_qkv_reshaped = mixed_qkv.view( + batch_size, draft_token_num, -1 + ).transpose(1, 2) mixed_qkv_processed = causal_conv1d_update( mixed_qkv_reshaped, conv_states_to_use, @@ -666,9 +664,7 @@ class GDNAttnBackend(MambaAttnBackendBase): retrieve_next_sibling=retrieve_next_sibling, retrieve_parent_token=retrieve_parent_token, ) - mixed_qkv = ( - mixed_qkv_processed.transpose(1, 2).contiguous().view(seq_len, -1) - ) + mixed_qkv = mixed_qkv_processed.transpose(1, 2).view(seq_len, -1) else: mixed_qkv = causal_conv1d_fn( mixed_qkv.transpose(0, 1),