mindspore.ops.shape

查看源文件
mindspore.ops.shape(input_x)[源代码]

返回输入tensor的shape。

参数:
  • input_x (Tensor) - 输入tensor。

返回:

tuple[int]

支持平台:

Ascend GPU CPU

样例:

>>> import mindspore
>>> input_x = mindspore.ops.ones(shape=[3, 2, 1])
>>> output = mindspore.ops.shape(input_x)
>>> print(output)
(3, 2, 1)