mlx icon indicating copy to clipboard operation
mlx copied to clipboard

Fix conversion to array

Open awni opened this issue 1 year ago • 0 comments

Closes #1066

This is kind of a nanobind issue but one that they have refused to fix in the past.

  • Basically a np.ndarray is implicitly convertible to a std::complex<float> so our to_array was allowing that.
  • Rather than disallowing ops with np.ndarrays instead I added it as a member in the variant.
  • That however has side effects because now mx.array gets implicitly converted to nb::ndarray because of the buffer protocol.
  • So to fix that I also had to enable array as a member of the variant.

awni avatar May 03 '24 13:05 awni