Array API compatible wrapper for :py:func:`np.meshgrid `. See its docstring for more information.
(*arrays: Array, indexing: str = "xy")
| 234 | |
| 235 | |
| 236 | def meshgrid(*arrays: Array, indexing: str = "xy") -> List[Array]: |
| 237 | """ |
| 238 | Array API compatible wrapper for :py:func:`np.meshgrid <numpy.meshgrid>`. |
| 239 | |
| 240 | See its docstring for more information. |
| 241 | """ |
| 242 | from ._array_object import Array |
| 243 | |
| 244 | # Note: unlike np.meshgrid, only inputs with all the same dtype are |
| 245 | # allowed |
| 246 | |
| 247 | if len({a.dtype for a in arrays}) > 1: |
| 248 | raise ValueError("meshgrid inputs must all have the same dtype") |
| 249 | |
| 250 | return [ |
| 251 | Array._new(array) |
| 252 | for array in np.meshgrid(*[a._array for a in arrays], indexing=indexing) |
| 253 | ] |
| 254 | |
| 255 | |
| 256 | def ones( |