<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/keras-team/keras/tree/v3.15.1/keras/src/ops/numpy.py#L5319-L5353) |

Creates grids of coordinates from coordinate vectors.

#### View aliases


**Main aliases**

[`tf.keras.ops.numpy.meshgrid`](https://www.tensorflow.org/api_docs/python/tf/keras/ops/meshgrid)

<br />

    tf.keras.ops.meshgrid(
        *x, indexing='xy'
    )

Given `N` 1-D tensors `T0, T1, ..., TN-1` as inputs with corresponding
lengths `S0, S1, ..., SN-1`, this creates an `N` N-dimensional tensors
`G0, G1, ..., GN-1` each with shape `(S0, ..., SN-1)` where the output
`Gi` is constructed by expanding `Ti` to the result shape.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `x` | 1-D tensors representing the coordinates of a grid. |
| `indexing` | `"xy"` or `"ij"`. "xy" is cartesian; `"ij"` is matrix indexing of output. Defaults to `"xy"`. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| Sequence of N tensors. ||

<br />

#### Example:

    from keras.src import ops
    x = ops.array([1, 2, 3])
    y = ops.array([4, 5, 6])

    grid_x, grid_y = ops.meshgrid(x, y, indexing="ij")
    grid_x
    array([[1, 1, 1],
           [2, 2, 2],
           [3, 3, 3]])
    grid_y
    array([[4, 5, 6],
           [4, 5, 6],
           [4, 5, 6]])