Raise an exception in the rope op if input is integer (#1884)

This commit is contained in:
Angelos Katharopoulos
2025-02-19 14:43:39 -08:00
committed by GitHub
parent 1a2cb72030
commit 78ba24c37d
2 changed files with 15 additions and 0 deletions

View File

@@ -158,7 +158,17 @@ class TestFast(mlx_tests.MLXTestCase):
)
self.assertLess(mx.abs(rx - rx_fast).max(), tolerances[mx.float32])
# Test raises with integer inputs
dims, _, base, scale, offset, traditional = defaults
x = (mx.random.uniform(shape=(2, T, dims)) * 10).astype(mx.int32)
with self.assertRaises(ValueError):
y = mx.fast.rope(
x, dims, traditional=traditional, base=base, scale=scale, offset=offset
)
def test_rope_with_freqs(self):
mx.random.seed(0)
# Check throws
T = 4
dims = 8