Fix small sort with metal validation (#1695)

This commit is contained in:
Awni Hannun
2024-12-12 09:21:45 -08:00
committed by GitHub
parent 6bd28d246e
commit 9111999af3
2 changed files with 17 additions and 3 deletions

View File

@@ -1956,6 +1956,12 @@ class TestOps(mlx_tests.MLXTestCase):
b_mx = mx.sort(a_mx)
self.assertTrue(np.array_equal(b_np, b_mx))
# 1D strided sort
a = mx.array([[4, 3], [2, 1], [5, 4], [3, 2]])
out = mx.argsort(a[:, 1])
expected = mx.array([1, 3, 0, 2], dtype=mx.uint32)
self.assertTrue(mx.array_equal(out, expected))
def test_partition(self):
shape = (3, 4, 5)
for dtype in ("int32", "float32"):