View source on GitHub |
Broadcasts parameters for evaluation on an N-D grid.
tf.meshgrid( *args, **kwargs )
Given N one-dimensional coordinate arrays *args
, returns a list outputs
of N-D coordinate arrays for evaluating expressions on an N-D grid.
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.
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 | Tensor s with rank 1. |
**kwargs |
|
Returns | |
---|---|
outputs | A list of N Tensor s with rank N. |
Raises | |
---|---|
TypeError | When no keyword arguments (kwargs) are passed. |
ValueError | When indexing keyword argument is not one of xy or ij . |
© 2020 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r2.4/api_docs/python/tf/meshgrid