setite negative indexing bug (#189)

This commit is contained in:
Awni Hannun
2023-12-16 06:44:47 -08:00
committed by GitHub
parent dc2edc762c
commit 104c34f906
2 changed files with 12 additions and 4 deletions

View File

@@ -903,6 +903,11 @@ class TestArray(mlx_tests.MLXTestCase):
np.array([0, 1]),
)
# Check slice assign with negative indices works
a = mx.zeros((5, 5), mx.int32)
a[2:-2, 2:-2] = 4
self.assertEquals(a[2, 2].item(), 4)
def test_slice_negative_step(self):
a_np = np.arange(20)
a_mx = mx.array(a_np)