mindspore.ops.DynamicShape
- class mindspore.ops.DynamicShape(*args, **kwargs)[source]
Returns the shape of the input tensor.
- Inputs:
input_x (Tensor) - The shape of tensor is \((x_1, x_2, ..., x_R)\).
- Outputs:
Tensor[int], 1-dim Tensor of type int32
- Raises
TypeError – If input_x is not a Tensor.
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> input_tensor = Tensor(np.ones(shape=[3, 2, 1]), mindspore.float32) >>> shape = ops.DynamicShape() >>> output = shape(input_tensor) >>> print(output) [3 2 1]