mlx
mlx copied to clipboard
[BUG] Saving non-row or col contiguous arrays is broken.
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)