Adds isinf (#445)
* adds isinf Signed-off-by: matthewfernst <[email protected]> * use stream + nits * typo --------- Signed-off-by: matthewfernst <[email protected]> Co-authored-by: Awni Hannun <[email protected]>
This commit is contained in:
co-authored by
Awni Hannun
parent
6022d4129e
commit
92a2fdd577
@@ -336,6 +336,21 @@ class TestOps(mlx_tests.MLXTestCase):
|
||||
|
||||
self.assertEqual(mx.isnan(0 * mx.array(float("inf"))).tolist(), True)
|
||||
|
||||
def test_isinf(self):
|
||||
x = mx.array([0.0, float("inf")])
|
||||
self.assertEqual(mx.isinf(x).tolist(), [False, True])
|
||||
|
||||
x = mx.array([0.0, float("inf")]).astype(mx.float16)
|
||||
self.assertEqual(mx.isinf(x).tolist(), [False, True])
|
||||
|
||||
x = mx.array([0.0, float("inf")]).astype(mx.bfloat16)
|
||||
self.assertEqual(mx.isinf(x).tolist(), [False, True])
|
||||
|
||||
x = mx.array([0.0, float("inf")]).astype(mx.complex64)
|
||||
self.assertEqual(mx.isinf(x).tolist(), [False, True])
|
||||
|
||||
self.assertEqual(mx.isinf(0 * mx.array(float("inf"))).tolist(), False)
|
||||
|
||||
def test_tri(self):
|
||||
for shape in [[4], [4, 4], [2, 10]]:
|
||||
for diag in [-1, 0, 1, -2]:
|
||||
|
||||
Reference in New Issue
Block a user