MLX is faster than torch and numpy for converting arrays to numpy. Why? #854
famishedrover
started this conversation in
General
Replies: 1 comment 2 replies
-
I got this on my M1 Max with the latest MLX (using Nanobind is a lot faster), also using
|
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am benchmarking conversion of framework specific array type to numpy array and generally found that mlx is 2-3x better than torch to numpy conversion (which is amazing), however, what surprised me was that a numpy.array(x) call when x is torch.Tensor is similar to when x is ndarray. Therefore, mlx.core.array -> ndarray is 2-3x faster than ndarray -> ndarray!
MLX Array -> Numpy
(and the following when I used mx.random.randint instead of float from uniform)
Torch.Tensor CPU -> Numpy
Torch Tensor GPU -> Numpy
Numpy -> Numpy
Jax -> np array
Beta Was this translation helpful? Give feedback.
All reactions