72e28f315e6458993407beb4d7041ccebca90735,parlai/core/torch_ranker_agent.py,TorchRankerAgent,eval_step,#TorchRankerAgent#Any#,113

Before Change


                rank = (ranks[b] == label_inds[b]).nonzero().item()
                self.metrics["rank"] += 1 + rank

        cand_preds = [[cands[i] for i in row] for row in ranks]
        preds = [row[0] for row in cand_preds]
        return Output(preds, cand_preds)

After Change


                self.metrics["rank"] += 1 + rank

        cand_preds = []
        for i, ordering in enumerate(ranks):
            if cand_vecs.dim() == 2:
                cand_list = cands
            elif cand_vecs.dim() == 3:
                cand_list = cands[i]
            cand_preds.append([cand_list[rank] for rank in ordering])
        preds = [cand_preds[i][0] for i in range(batchsize)]
        return Output(preds, cand_preds)

    def _build_candidates(self, batch, source, mode):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

Instances


Project Name: facebookresearch/ParlAI
Commit Name: 72e28f315e6458993407beb4d7041ccebca90735
Time: 2018-10-16
Author: bhancock@fb.com
File Name: parlai/core/torch_ranker_agent.py
Class Name: TorchRankerAgent
Method Name: eval_step


Project Name: stanford-mast/nn_dataflow
Commit Name: 999fd2807c746ab0c203f1ec20adcdd14be7da89
Time: 2017-07-13
Author: mgao12@stanford.edu
File Name: nn_dataflow/Partition.py
Class Name:
Method Name: get_ofmap_layout


Project Name: facebookresearch/ParlAI
Commit Name: 72e28f315e6458993407beb4d7041ccebca90735
Time: 2018-10-16
Author: bhancock@fb.com
File Name: parlai/core/torch_ranker_agent.py
Class Name: TorchRankerAgent
Method Name: train_step