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

Method test_log

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

Source from the content-addressed store, hash-verified

942 self.assertTrue(math.isnan(mx.logaddexp(a, b).item()))
943
944 def test_log(self):
945 a = mx.array([1, 0.5, 10, 100])
946 result = mx.log(a)
947 expected = np.log(a, dtype=np.float32)
948
949 self.assertTrue(np.allclose(result, expected))
950
951 a = mx.array(1.0) + 1j * mx.array(2.0)
952 result = mx.log(a)
953 expected = np.log(np.array(a))
954 self.assertTrue(np.allclose(result, expected))
955
956 def test_log2(self):
957 a = mx.array([0.5, 1, 2, 10, 16])

Callers

nothing calls this directly

Calls 1

arrayMethod · 0.60

Tested by

no test coverage detected