| 106 | } |
| 107 | |
| 108 | mx::array mlx_get_item_array(const mx::array& src, const mx::array& indices) { |
| 109 | // Check input and raise error if 0 dim for parity with np |
| 110 | if (src.ndim() == 0) { |
| 111 | throw std::invalid_argument( |
| 112 | "too many indices for array: array is 0-dimensional"); |
| 113 | } |
| 114 | |
| 115 | if (indices.dtype() == mx::bool_) { |
| 116 | throw std::invalid_argument("boolean indices are not yet supported"); |
| 117 | } |
| 118 | |
| 119 | // If only one input array is mentioned, we set axis=0 in take |
| 120 | // for parity with np |
| 121 | return take(src, indices, 0); |
| 122 | } |
| 123 | |
| 124 | mx::array mlx_get_item_int(const mx::array& src, const nb::object& idx) { |
| 125 | // Check input and raise error if 0 dim for parity with np |