[Performance] Move the contiguous to torch compile region (#13199)

This commit is contained in:
DarkSharpness
2025-11-16 12:49:52 +08:00
committed by GitHub
parent f35f7f1245
commit f969664172

View File

@@ -1481,6 +1481,8 @@ class MRotaryEmbedding(RotaryEmbedding):
num_tokens = positions.shape[-1]
cos_sin = self.cos_sin_cache[positions]
cos, sin = cos_sin.chunk(2, dim=-1)
cos = cos.contiguous()
sin = sin.contiguous()
query_shape = query.shape
key_shape = key.shape
if positions.ndim == 2: