From 7a7ad4659a7b7e1a78eebbb9bb8af6c21130f14e Mon Sep 17 00:00:00 2001 From: Zihao Ye Date: Sat, 26 Oct 2024 15:01:58 -0700 Subject: [PATCH] perf: remove unnecessary contiguous operation in block sparse attention (#561) The contiguous operation is no longer required after #513 --- python/flashinfer/sparse.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/python/flashinfer/sparse.py b/python/flashinfer/sparse.py index f53261c73..55d36e066 100644 --- a/python/flashinfer/sparse.py +++ b/python/flashinfer/sparse.py @@ -435,9 +435,8 @@ def run( rope_scale = 1.0 if rope_theta is None: rope_theta = 1e4 - - k = k.reshape(-1, self.C, *k.shape[-2:]).contiguous() - v = v.reshape(-1, self.C, *v.shape[-2:]).contiguous() + k = k.reshape(-1, self.C, *k.shape[-2:]) + v = v.reshape(-1, self.C, *v.shape[-2:]) lse = None if return_lse: