# tf.raw_ops.Rank

<br />

Returns the rank of a tensor.

#### View aliases


**Compat aliases for migration**

See
[Migration guide](https://www.tensorflow.org/guide/migrate) for
more details.

[`tf.compat.v1.raw_ops.Rank`](https://www.tensorflow.org/api_docs/python/tf/raw_ops/Rank)

<br />

    tf.raw_ops.Rank(
        input, name=None
    )

This operation returns an integer representing the rank of `input`.

#### For example:

    # 't' is [[[1, 1, 1], [2, 2, 2]], [[3, 3, 3], [4, 4, 4]]]
    # shape of tensor 't' is [2, 2, 3]
    rank(t) ==> 3

> [!NOTE]
> **Note:** The rank of a tensor is not the same as the rank of a matrix. The rank of a tensor is the number of indices required to uniquely select each element of the tensor. Rank is also known as "order", "degree", or "ndims."

<br />

<br />

<br />

| ## Args ||
|---|---|
| `input` | A `Tensor`. |
| `name` | A name for the operation (optional). |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A `Tensor` of type `int32`. ||

<br />