mlx icon indicating copy to clipboard operation
mlx copied to clipboard

[BUG] Saving non-row or col contiguous arrays is broken.

Open awni opened this issue 1 year ago • 0 comments

We check contiguous in our saving but that doesn't mean row or col contiguous. This is an issue with safetensors as well. I think it would be nice to support these cases by doing a copy rather than throwing as a fix.

import mlx.core as mx
a = mx.array([1,2])
b = mx.broadcast_to([4, 2])
mx.save("b.npy", b)
print(mx.load("b.npy"))
array([[1, 2],
       [0, 0],
       [0, 0],
       [0, 0]], dtype=int32)

awni avatar Jan 04 '24 15:01 awni