mindspore.ops.Rank
- class mindspore.ops.Rank[source]
Returns the rank of a tensor.
Refer to
mindspore.ops.rank()
for more detail.- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> input_tensor = Tensor(np.array([[2, 2], [2, 2]]), mindspore.float32) >>> rank = ops.Rank() >>> output = rank(input_tensor) >>> print(output) 2 >>> print(type(output)) <class 'int'>