mirror of
https://github.com/ml-explore/mlx.git
synced 2025-09-04 06:44:40 +08:00
GPU mx.sign for complex64 (#1326)
This commit is contained in:
@@ -760,6 +760,15 @@ class TestOps(mlx_tests.MLXTestCase):
|
||||
expected = np.sign(a, dtype=np.float32)
|
||||
self.assertTrue(np.allclose(result, expected))
|
||||
|
||||
a = mx.array([-1.0, 1.0, 0.0, -2.0, 3.0])
|
||||
b = mx.array([-4.0, -3.0, 1.0, 0.0, 3.0])
|
||||
c = a + b * 1j
|
||||
result = mx.sign(c)
|
||||
# np.sign differs in NumPy 1 and 2 so
|
||||
# we manually implement the NumPy 2 version here.
|
||||
expected = c / np.abs(c)
|
||||
self.assertTrue(np.allclose(result, expected))
|
||||
|
||||
def test_logical_not(self):
|
||||
a = mx.array([-1.0, 1.0, 0.0, 1.0, -2.0, 3.0])
|
||||
result = mx.logical_not(a)
|
||||
|
Reference in New Issue
Block a user