Sorts list of features according to per-example scores.
tfr.utils.sort_by_scores(
scores, features_list, topn=None, shuffle_ties=True, seed=None, mask=None
)
Args |
scores
|
A Tensor of shape [batch_size, list_size] representing the
per-example scores.
|
features_list
|
A list of Tensor s to be sorted. The shape of the Tensor
can be [batch_size, list_size] or [batch_size, list_size, feature_dims].
The latter is applicable for example features.
|
topn
|
An integer as the cutoff of examples in the sorted list.
|
shuffle_ties
|
A boolean. If True, randomly shuffle before the sorting.
|
seed
|
The ops-level random seed used when shuffle_ties is True.
|
mask
|
An optional Tensor of shape [batch_size, list_size] representing
which entries are valid for sorting. Invalid entries will be pushed to the
end.
|
Returns |
A list of Tensor s as the list of sorted features by scores .
|