MCPcopy Create free account
hub / github.com/numpy/numpy / meshgrid

Function meshgrid

numpy/array_api/_creation_functions.py:236–253  ·  view source on GitHub ↗

Array API compatible wrapper for :py:func:`np.meshgrid `. See its docstring for more information.

(*arrays: Array, indexing: str = "xy")

Source from the content-addressed store, hash-verified

234
235
236def 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
256def ones(

Callers 1

Calls 1

_newMethod · 0.80

Tested by 1