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

Method test_prod

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

Source from the content-addressed store, hash-verified

657 self.assertTrue(np.array_equal(y_mlx, y_npy))
658
659 def test_prod(self):
660 x = mx.array(
661 [
662 [1, 2],
663 [3, 3],
664 ]
665 )
666 self.assertEqual(mx.prod(x).item(), 18)
667 y = mx.prod(x, keepdims=True)
668 self.assertEqual(y, mx.array(18))
669 self.assertEqual(y.shape, (1, 1))
670
671 self.assertEqual(mx.prod(x, axis=0).tolist(), [3, 6])
672 self.assertEqual(mx.prod(x, axis=1).tolist(), [2, 9])
673
674 def test_min_and_max(self):
675 x = mx.array(

Callers

nothing calls this directly

Calls 3

itemMethod · 0.80
arrayMethod · 0.60
prodMethod · 0.45

Tested by

no test coverage detected