mindspore.ops.shape

View Source On Gitee
mindspore.ops.shape(input_x)[source]

Return the shape of the input tensor.

Parameters

input_x (Tensor) – The input tensor.

Returns

tuple[int]

Supported Platforms:

Ascend GPU CPU

Examples

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