MCPcopy Create free account
hub / github.com/ml-explore/mlx / test_allclose

Method test_allclose

python/tests/test_ops.py:1083–1096  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1081 self.assertNotEqual(mx.sigmoid(a).item(), 1.0)
1082
1083 def test_allclose(self):
1084 a = mx.array(1.0)
1085 b = mx.array(1.0)
1086
1087 self.assertTrue(mx.allclose(a, b).item())
1088
1089 b = mx.array(1.1)
1090 self.assertFalse(mx.allclose(a, b).item())
1091 self.assertTrue(mx.allclose(a, b, 0.1).item())
1092 self.assertFalse(mx.allclose(a, b, 0.01).item())
1093 self.assertTrue(mx.allclose(a, b, 0.01, 0.1).item())
1094
1095 c = mx.array(float("inf"))
1096 self.assertTrue(mx.allclose(c, c).item())
1097
1098 def test_isclose(self):
1099 a = mx.array([float("inf"), float("inf"), float("-inf")])

Callers

nothing calls this directly

Calls 2

itemMethod · 0.80
arrayMethod · 0.60

Tested by

no test coverage detected