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

Method test_abs

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

Source from the content-addressed store, hash-verified

837 self.assertAlmostEqual(mx.std(x).item(), x_np.std().item(), places=6)
838
839 def test_abs(self):
840 a = mx.array([-1.0, 1.0, -2.0, 3.0])
841 result = mx.abs(a)
842 expected = np.abs(a, dtype=np.float32)
843 self.assertTrue(np.allclose(result, expected))
844
845 self.assertTrue(np.allclose(a.abs(), abs(a)))
846
847 def test_negative(self):
848 a = mx.array([-1.0, 1.0, -2.0, 3.0])

Callers

nothing calls this directly

Calls 2

absFunction · 0.85
arrayMethod · 0.60

Tested by

no test coverage detected