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

Method test_create_from_buffer

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

Source from the content-addressed store, hash-verified

1803 self.assertIsNone(wr())
1804
1805 def test_create_from_buffer(self):
1806 x = mx.array(b"Hello")
1807 self.assertEqual(x.dtype, mx.uint8)
1808 self.assertEqual(x.tolist(), [72, 101, 108, 108, 111])
1809
1810 x = mx.array(bytearray([1, 2, 3]))
1811 self.assertEqual(x.dtype, mx.uint8)
1812 self.assertEqual(x.tolist(), [1, 2, 3])
1813
1814 @unittest.skipIf(not has_tf, "requires TensorFlow")
1815 def test_buffer_protocol_tf(self):

Callers

nothing calls this directly

Calls 1

arrayMethod · 0.60

Tested by

no test coverage detected