tfr.utils.sorted_ranks

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

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.

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.

A 1-based int Tensors as the ranks.