oxideai / mlx-rs

Unofficial Rust bindings to Apple's mlx framework
https://oxideai.github.io/mlx-rs/
Apache License 2.0
68 stars 5 forks source link

Fix bug with `as_slice` when the underlying array is not contiguous #77

Open minghuaw opened 5 months ago

minghuaw commented 5 months ago

see ml-explore/mlx-swift#96

minghuaw commented 5 months ago

as_slice here is closer to asData in the swift binding than asArray.

Similar to the situation with performing implicit conversion for as_slice, a new continuous copy is created implicitly in the swift binding. This makes the lifetime of the newly created underlying buffer rather complicated, and maybe the equivalent of asArray in the swift binding should not be implemented.

TODO: