<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.21.0/tensorflow/python/ops/array_ops.py#L3378-L3457) |

Broadcasts parameters for evaluation on an N-D grid.

#### View aliases


**Compat aliases for migration**

See
[Migration guide](https://www.tensorflow.org/guide/migrate) for
more details.

[`tf.compat.v1.meshgrid`](https://www.tensorflow.org/api_docs/python/tf/meshgrid)

<br />

    tf.meshgrid(
        *args, **kwargs
    )

### Used in the notebooks

| Used in the guide |
|---|
| - [Optimizers with Core APIs](https://www.tensorflow.org/guide/core/optimizers_core) |

Given N one-dimensional coordinate arrays `*args`, returns a list `outputs`
of N-D coordinate arrays for evaluating expressions on an N-D grid.

#### Notes:

`meshgrid` supports cartesian ('xy') and matrix ('ij') indexing conventions.
When the `indexing` argument is set to 'xy' (the default), the broadcasting
instructions for the first two dimensions are swapped.

#### Examples:

Calling `X, Y = meshgrid(x, y)` with the tensors

    x = [1, 2, 3]
    y = [4, 5, 6]
    X, Y = tf.meshgrid(x, y)
    # X = [[1, 2, 3],
    #      [1, 2, 3],
    #      [1, 2, 3]]
    # Y = [[4, 4, 4],
    #      [5, 5, 5],
    #      [6, 6, 6]]

<br />

<br />

<br />

| ## Args ||
|---|---|
| `*args` | `Tensor`s with rank 1. |
| `**kwargs` | <br /> - indexing: Either 'xy' or 'ij' (optional, default: 'xy'). - name: A name for the operation (optional). |

<br />

<br />

<br />

| ## Returns ||
|---|---|
| `outputs` | A list of N `Tensor`s with rank N. |

<br />

<br />

<br />

<br />

| ## Raises ||
|---|---|
| `TypeError` | When no keyword arguments (kwargs) are passed. |
| `ValueError` | When indexing keyword argument is not one of `xy` or `ij`. |

<br />