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

Method test_array_iteration

python/tests/test_array.py:889–899  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

887 self.assertEqual(b.dtype, mx.float32)
888
889 def test_array_iteration(self):
890 a = mx.array([0, 1, 2])
891
892 for i, x in enumerate(a):
893 self.assertEqual(x.item(), i)
894
895 a = mx.array([[1.0, 2.0], [3.0, 4.0], [5.0, 6.0]])
896 x, y, z = a
897 self.assertEqual(x.tolist(), [1.0, 2.0])
898 self.assertEqual(y.tolist(), [3.0, 4.0])
899 self.assertEqual(z.tolist(), [5.0, 6.0])
900
901 def test_array_pickle(self):
902 dtypes = [

Callers

nothing calls this directly

Calls 2

itemMethod · 0.80
arrayMethod · 0.60

Tested by

no test coverage detected