f4beaac559e00a3676d942dc7e8fea69efc01cfe,catalyst/metrics/mrr.py,,mrr,#,8

Before Change


        result (torch.Tensor):
            The mrr score for each user.
    
    k = min(outputs.size(1), k)
    _, indices_for_sort = outputs.sort(descending=True, dim=-1)
    true_sorted_by_preds = torch.gather(
        targets, dim=-1, index=indices_for_sort
    )

After Change


    
    results = []
    for k in topk:
        results.append(torch.mean(reciprocal_rank(outputs, targets, k)))

    return results
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: Scitator/catalyst
Commit Name: f4beaac559e00a3676d942dc7e8fea69efc01cfe
Time: 2020-11-30
Author: raveforlive@gmail.com
File Name: catalyst/metrics/mrr.py
Class Name:
Method Name: mrr


Project Name: HsinYingLee/DRIT
Commit Name: 8a04fa2c91f52a9c551849812d450079e667b16a
Time: 2018-07-28
Author: hytseng0509@gmail.com
File Name: src/networks.py
Class Name: LayerNorm
Method Name: forward


Project Name: batra-mlp-lab/visdial-challenge-starter-pytorch
Commit Name: 7db6246fae613a5abf1fbea0b2b987b615ae5a13
Time: 2018-12-26
Author: karandesai281196@gmail.com
File Name: visdialch/encoders/lf.py
Class Name: LateFusionEncoder
Method Name: forward