tf.meshgrid  |  TensorFlow v2.0.0 (original) (raw)

tf.meshgrid

Stay organized with collections Save and categorize content based on your preferences.

Broadcasts parameters for evaluation on an N-D grid.

View aliases

Compat aliases for migration

SeeMigration guide for more details.

tf.compat.v1.meshgrid

tf.meshgrid(
    *args, **kwargs
)

Given N one-dimensional coordinate arrays *args, returns a list outputsof 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]]
Args
*args Tensors with rank 1.
**kwargs indexing: Either 'xy' or 'ij' (optional, default: 'xy'). name: A name for the operation (optional).
Returns
outputs A list of N Tensors with rank N.
Raises
TypeError When no keyword arguments (kwargs) are passed.
ValueError When indexing keyword argument is not one of xy or ij.