5b4221cfdb9406e2eb199f4e2cfe1c24ab475d7b,parlai/core/torch_ranker_agent.py,TorchRankerAgent,eval_step,#TorchRankerAgent#Any#,344

Before Change


                cand_list = cands[i]
            if len(ordering) != len(cand_list):
                // ignore padding
                true_ordering = [x for x in ordering if x < len(cand_list)]
                ordering = true_ordering
            // using a generator instead of a list comprehension allows
            // to cap the number of elements.
            cand_preds_generator = (cand_list[rank] for rank in ordering)

After Change


            self.metrics["examples"] += batchsize
            for b in range(batchsize):
                rank = (ranks[b] == label_inds[b]).nonzero()
                rank = rank.item() if len(rank) == 1 else scores.size(1)
                self.metrics["rank"] += 1 + rank
                self.metrics["mrr"] += 1.0 / (1 + rank)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 5

Non-data size: 5

Instances


Project Name: facebookresearch/ParlAI
Commit Name: 5b4221cfdb9406e2eb199f4e2cfe1c24ab475d7b
Time: 2019-08-07
Author: ahm@fb.com
File Name: parlai/core/torch_ranker_agent.py
Class Name: TorchRankerAgent
Method Name: eval_step


Project Name: ClementPinard/FlowNetPytorch
Commit Name: d95f630a7b7f88621bc4abb4ac92692647f03781
Time: 2018-08-23
Author: clement.pinard@parrot.com
File Name: main.py
Class Name:
Method Name: train


Project Name: rusty1s/pytorch_geometric
Commit Name: 7c41e2eee4ff49865ea9fc2fc94fe91a68cb4807
Time: 2019-04-12
Author: matthias.fey@tu-dortmund.de
File Name: torch_geometric/datasets/icews.py
Class Name: TemporalDataset
Method Name: num_rels


Project Name: facebookresearch/ParlAI
Commit Name: 52be96bb254a48305064af8b4cbde803d8e83b51
Time: 2019-08-14
Author: edinan@fb.com
File Name: parlai/core/torch_ranker_agent.py
Class Name: TorchRankerAgent
Method Name: _get_train_preds


Project Name: OpenNMT/OpenNMT-py
Commit Name: fef30861374dd35f2dcf8e6d4bfa03d4016e4610
Time: 2018-07-12
Author: 31310587+FernandoSailing@users.noreply.github.com
File Name: onmt/translate/beam.py
Class Name: Beam
Method Name: advance