tf.meshgrid
Stay organized with collections
Save and categorize content based on your preferences.
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.
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
|
Tensor s 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 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 .
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2020-10-01 UTC.
[null,null,["Last updated 2020-10-01 UTC."],[],[],null,["# tf.meshgrid\n\n\u003cbr /\u003e\n\n|---------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------|\n| [TensorFlow 1 version](/versions/r1.15/api_docs/python/tf/meshgrid) | [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.1.0/tensorflow/python/ops/array_ops.py#L2993-L3066) |\n\nBroadcasts parameters for evaluation on an N-D grid.\n\n#### View aliases\n\n\n**Compat aliases for migration**\n\nSee\n[Migration guide](https://www.tensorflow.org/guide/migrate) for\nmore details.\n\n[`tf.compat.v1.meshgrid`](/api_docs/python/tf/meshgrid)\n\n\u003cbr /\u003e\n\n tf.meshgrid(\n *args, **kwargs\n )\n\nGiven N one-dimensional coordinate arrays `*args`, returns a list `outputs`\nof N-D coordinate arrays for evaluating expressions on an N-D grid.\n\n#### Notes:\n\n`meshgrid` supports cartesian ('xy') and matrix ('ij') indexing conventions.\nWhen the `indexing` argument is set to 'xy' (the default), the broadcasting\ninstructions for the first two dimensions are swapped.\n\n#### Examples:\n\nCalling `X, Y = meshgrid(x, y)` with the tensors \n\n x = [1, 2, 3]\n y = [4, 5, 6]\n X, Y = tf.meshgrid(x, y)\n # X = [[1, 2, 3],\n # [1, 2, 3],\n # [1, 2, 3]]\n # Y = [[4, 4, 4],\n # [5, 5, 5],\n # [6, 6, 6]]\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|------------|----------------------------------------------------------------------------------------------------------------|\n| `*args` | `Tensor`s with rank 1. |\n| `**kwargs` | \u003cbr /\u003e - indexing: Either 'xy' or 'ij' (optional, default: 'xy'). - name: A name for the operation (optional). |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|-----------|------------------------------------|\n| `outputs` | A list of N `Tensor`s with rank N. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Raises ------ ||\n|--------------|------------------------------------------------------------|\n| `TypeError` | When no keyword arguments (kwargs) are passed. |\n| `ValueError` | When indexing keyword argument is not one of `xy` or `ij`. |\n\n\u003cbr /\u003e"]]