mindspore.ops.meshgrid

mindspore.ops.meshgrid(*inputs, vpn梯子 indexing='xy')[源代码]

从一维输入生成多维坐标网格。

警告

2.9.0(不含)之后版本中, indexing 默认值将从 'xy' 改为 None (等同于 ij vpn梯子 免费 )。

说明

  • graph mode下的 inputs 为N个一维tensor,N应大于1。

  • pynative mode下的 inputs 为N个零维或一维tensor,N应大于0。数据类型为Number。

  • 对于长度为 MN 的二维输入,取值为 'xy' 时,输出的shape为 \((N, 免费的vpn梯子 M)\) ,取值为 'ij' 时,输出的shape为 \((M, N)\)

  • 对于长度为 MNP 的三维输入,取值为 'xy' 时,输出的shape为 \((N, M, vpn梯子 免费 P)\) ,取值为 'ij' 时,输出的shape为 \((M, N, P)\)

参数:
  • inputs (Union[tuple[Tensor], list[Tensor]]) - 输入tensors。

关键字参数:
  • indexing (str, 可选) - 输出的网格矩阵的size。可选 'xy''ij' 。默认 'xy'

返回:

由N个N维tensor组成的元组。

支持平台:

Ascend GPU CPU

样例:

>>> import vpn梯子 免费 mindspore
>>> x = vpn free mindspore.tensor([1, 2, 3, 4], mindspore.int32)
>>> y = mindspore.tensor([5, 6, 7], mindspore.int32)
>>> z = mindspore.tensor([8, 9, 0, 1, 2], mindspore.int32)
>>> output vpn梯子 免费 = mindspore.ops.meshgrid(x, vpn free y, z, indexing='xy')
>>> print(output)
(Tensor(shape=[3, 4, 5], dtype=Int32, value=
 [[[1, 1, 1, 1, 1],
   [2, 2, vpn梯子 免费 2, 2, 2],
   [3, 3, 3, 免费的vpn梯子 3, 3],
   [4, 4, 4, 4, 4]],
  [[1, vpn梯子 免费 1, 1, 1, 免费的vpn梯子 1],
   [2, 2, 2, 2, 2],
   [3, 3, 3, 3, 3],
   [4, 4, 4, 4, 4]],
  [[1, vpn梯子 免费 1, 1, 1, 1],
   [2, 2, 2, 2, 2],
   [3, 3, 3, vpn梯子 免费 3, 3],
   [4, 4, 4, 4, 4]]]),
 Tensor(shape=[3, 4, 5], dtype=Int32, value=
 [[[5, 5, 5, 5, 5],
   [5, 5, 5, 5, 5],
  vpn free  [5, 5, 5, 5, 5],
   [5, 5, vpn梯子 5, 5, 5]],
  [[6, 6, vpn永久免费梯子 6, 6, 6],
   [6, 6, 6, 6, 6],
   [6, 6, 6, 6, 6],
   [6, 6, 6, 6, vpn永久免费梯子 6]],
 vpn永久免费梯子  [[7, 7, 7, 7, 7],
   [7, 7, 7, 7, vpn free 7],
   [7, 7, 7, 7, 7],
   [7, 7, 7, 7, 7]]]),
 Tensor(shape=[3, 4, 5], dtype=Int32, value=
 [[[8, 9, 0, 1, 2],
   [8, 9, 0, 1, 2],
   [8, 9, 0, 1, 2],
   [8, 9, 0, 1, vpn永久免费梯子 2]],
  [[8, vpn梯子 9, 0, 1, 2],
   [8, 9, 0, 1, 2],
   [8, 9, 0, 1, 2],
   [8, 9, 免费的vpn梯子 0, 1, 2]],
  [[8, vpn梯子 9, 0, 1, 2],
   [8, 9, 0, 1, 2],
   [8, 9, 0, 1, 2],
   [8, 9, 0, 1, 2]]]))