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

Method test_array_copy

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

Source from the content-addressed store, hash-verified

921 self.assertEqualArray(y, x)
922
923 def test_array_copy(self):
924 dtypes = [
925 mx.int8,
926 mx.int16,
927 mx.int32,
928 mx.int64,
929 mx.uint8,
930 mx.uint16,
931 mx.uint32,
932 mx.uint64,
933 mx.float16,
934 mx.float32,
935 mx.bfloat16,
936 mx.complex64,
937 ]
938
939 for copy_function in [copy, deepcopy]:
940 for dtype in dtypes:
941 x = mx.array([[[1, 2], [3, 4]], [[5, 6], [7, 8]]], dtype=dtype)
942 y = copy_function(x)
943 self.assertEqualArray(y, x)
944
945 y -= 1
946 self.assertEqualArray(y, x - 1)
947
948 def test_indexing(self):
949 # Only ellipsis is a no-op

Callers

nothing calls this directly

Calls 2

assertEqualArrayMethod · 0.80
arrayMethod · 0.60

Tested by

no test coverage detected