From ae233ab6481be8eca4fb61b1253a93d4246571c3 Mon Sep 17 00:00:00 2001 From: biondizzle Date: Tue, 19 May 2026 02:37:50 +0000 Subject: [PATCH] Fix test: cos_sin_cache on CUDA device --- tests/test_wo_a.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_wo_a.py b/tests/test_wo_a.py index 17f81a34..2fb21062 100644 --- a/tests/test_wo_a.py +++ b/tests/test_wo_a.py @@ -47,11 +47,11 @@ def test_inverse_rope(): rope_dim = ROPE_DIM half_rope = rope_dim // 2 base = 10000.0 - inv_freq = 1.0 / (base ** (torch.arange(0, half_rope, dtype=torch.float32) / half_rope)) + inv_freq = 1.0 / (base ** (torch.arange(0, half_rope, dtype=torch.float32, device=DEVICE) / half_rope)) - pos = torch.arange(max_pos, dtype=torch.float32) + pos = torch.arange(max_pos, dtype=torch.float32, device=DEVICE) freqs = torch.outer(pos, inv_freq) # (max_pos, half_rope) - cos_sin_cache = torch.cat([freqs.cos(), freqs.sin()], dim=-1) # (max_pos, rope_dim) + cos_sin_cache = torch.cat([freqs.cos(), freqs.sin(), ], dim=-1) # (max_pos, rope_dim) # Random attention output o = torch.randn(num_tokens, num_heads, HEAD_DIM, dtype=torch.bfloat16, device=DEVICE) * 2.0