# tfr.utils.sorted_ranks

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/ranking/blob/v0.5.3/tensorflow_ranking/python/utils.py#L167-L195) |

Returns an int `Tensor` as the ranks (1-based) after sorting scores.

    tfr.utils.sorted_ranks(
        scores, shuffle_ties=True, seed=None
    )

Example: Given scores = \[\[1.0, 3.5, 2.1\]\], the returned ranks will be \[\[3, 1,
2\]\]. It means that scores 1.0 will be ranked at position 3, 3.5 will be ranked
at position 1, and 2.1 will be ranked at position 2.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `scores` | A `Tensor` of shape \[batch_size, list_size\] representing the per-example scores. |
| `shuffle_ties` | See `sort_by_scores`. |
| `seed` | See `sort_by_scores`. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A 1-based int `Tensor`s as the ranks. ||

<br />