52be96bb254a48305064af8b4cbde803d8e83b51,parlai/core/torch_ranker_agent.py,TorchRankerAgent,_get_train_preds,#TorchRankerAgent#Any#Any#Any#Any#,262

Before Change



        // Get predictions but not full rankings for the sake of speed
        if cand_vecs.dim() == 2:
            preds = [cands[ordering[0]] for ordering in ranks]
        elif cand_vecs.dim() == 3:
            preds = [cands[i][ordering[0]] for i, ordering in enumerate(ranks)]
        return Output(preds)

After Change


        ranks = ranks.cpu()
        // Here we get the top prediction for each example, but do not
        // return the full ranked list for the sake of training speed
        preds = []
        for i, ordering in enumerate(ranks):
            if cand_vecs.dim() == 2:  // num cands x max cand length
                cand_list = cands
            elif cand_vecs.dim() == 3:  // batchsize x num cands x max cand length
                cand_list = cands[i]
            if len(ordering) != len(cand_list):
                // We may have added padded cands to fill out the batch;
                // Here we break after finding the first non-pad cand in the
                // ranked list
                for x in ordering:
                    if x < len(cand_list):
                        preds.append(cand_list[x])
                        break
            else:
                preds.append(cand_list[ordering[0]])

        return Output(preds)

    def is_valid(self, obs):
        
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 13

Instances


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: 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: keras-team/keras
Commit Name: 09b97e951a0d47e7d5f31a66804a8e76f389315b
Time: 2017-07-08
Author: souptc@gmail.com
File Name: keras/backend/cntk_backend.py
Class Name:
Method Name: rnn


Project Name: deepfakes/faceswap
Commit Name: bcf38b02cc7209d1baccd1302b5224f5faf2f00a
Time: 2021-01-31
Author: 36920800+torzdf@users.noreply.github.com
File Name: plugins/train/model/_base.py
Class Name: _Inference
Method Name: _make_inference_model