mirror of
https://github.com/ml-explore/mlx.git
synced 2025-10-19 08:29:35 +08:00
xor op on arrays (#1875)
This commit is contained in:
@@ -1725,6 +1725,7 @@ class TestArray(mlx_tests.MLXTestCase):
|
||||
self.assertEqual((mx.array(True) | False).item(), True)
|
||||
self.assertEqual((mx.array(False) | False).item(), False)
|
||||
self.assertEqual((~mx.array(False)).item(), True)
|
||||
self.assertEqual((mx.array(False) ^ True).item(), True)
|
||||
|
||||
def test_inplace(self):
|
||||
iops = [
|
||||
@@ -1734,6 +1735,7 @@ class TestArray(mlx_tests.MLXTestCase):
|
||||
"__ifloordiv__",
|
||||
"__imod__",
|
||||
"__ipow__",
|
||||
"__ixor__",
|
||||
]
|
||||
|
||||
for op in iops:
|
||||
@@ -1773,6 +1775,10 @@ class TestArray(mlx_tests.MLXTestCase):
|
||||
b @= a
|
||||
self.assertTrue(mx.array_equal(a, b))
|
||||
|
||||
a = mx.array(False)
|
||||
a ^= True
|
||||
self.assertEqual(a.item(), True)
|
||||
|
||||
def test_inplace_preserves_ids(self):
|
||||
a = mx.array([1.0])
|
||||
orig_id = id(a)
|
||||
|
Reference in New Issue
Block a user