mindspore.ops.Shape
- class mindspore.ops.Shape[source]
Returns the shape of the input tensor.
Refer to
mindspore.ops.shape()
for more details.- Inputs:
input_x (Tensor) - The shape of tensor is \((x_1, x_2, ..., x_R)\).
- Outputs:
tuple[int], the output tuple is constructed by multiple integers, \((x_1, x_2, ..., x_R)\).
- 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) >>> shape = ops.Shape() >>> output = shape(input_x) >>> print(output) (3, 2, 1)