mindspore.ops.dyn_shape

mindspore.ops.dyn_shape(input_x)[source]

Returns the shape of the input tensor.

Parameters

input_x (Tensor) – The input Tensor.

Returns

Tensor, the shape of input_x .

Raises

TypeError – If input_x is not a Tensor.

Supported Platforms:

Ascend GPU CPU

Examples

>>> import mindspore
>>> import numpy as np
>>> from mindspore import Tensor, ops
>>> input_x = Tensor(np.ones(shape=[3, 2, 1]), mindspore.float32)
>>> output = ops.dyn_shape(input_x)
>>> print(output)
[3 2 1]