mindspore.ops.rank
- mindspore.ops.rank(input_x)[source]
Return the rank of a tensor.
- Parameters
input_x (Tensor) – The input tensor.
- Returns
Tensor
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> import mindspore >>> input_tensor = mindspore.tensor([[2, 2], [2, 2]], mindspore.float32) >>> output = mindspore.ops.rank(input_tensor) >>> print(output) 2 >>> print(type(output)) <class 'int'>