ml-explore / mlx

MLX: An array framework for Apple silicon
https://ml-explore.github.io/mlx/
MIT License
14.83k stars 845 forks source link

[Feature Request] Support `numpy.ndarray.view` #1042

Open mochiya98 opened 3 weeks ago

mochiya98 commented 3 weeks ago

A perfect implementation is complex, but even just being able to change to another dtype of the same size would make it easier to do bitwise advanced processing in mlx.

np.array(3.14, dtype=np.float32).view(dtype=np.int32)
# array(1078523331, dtype=int32)
# -> 4048f5c3 .. raw