f7afc7ae76ed2c328ed02f05e91ccceec8942e0b,python/baseline/pytorch/seq2seq/model.py,Seq2SeqModel,make_input,#Seq2SeqModel#Any#,121

Before Change


        src_len = torch.from_numpy(batch_dict["src_lengths"])
        src_len, perm_idx = src_len.sort(0, descending=True)
        example["src_len"] = src_len
        example["src"] = example["src"][perm_idx].transpose(0, 1).contiguous()
        if self.gpu:
            example["src"] = example["src"].cuda()
            example["src_len"] = example["src_len"].cuda()
        if "tgt" in batch_dict:
            tgt = torch.from_numpy(batch_dict["tgt"])
            example["dst"] = tgt[:, :-1]
            example["tgt"] = tgt[:, 1:]

After Change


        lengths = torch.from_numpy(batch_dict[self.src_lengths_key])
        lengths, perm_idx = lengths.sort(0, descending=True)

        if self.gpu:
            lengths = lengths.cuda()
        example["src_len"] = lengths
        for key in self.src_embeddings.keys():
            tensor = torch.from_numpy(batch_dict[key])
            tensor = tensor[perm_idx]
            example[key] = tensor.transpose(0, 1).contiguous()
            if self.gpu:
                example[key] = example[key].cuda()

        if "tgt" in batch_dict:
            tgt = torch.from_numpy(batch_dict["tgt"])
            example["dst"] = tgt[:, :-1]
            example["tgt"] = tgt[:, 1:]
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 10

Instances


Project Name: dpressel/mead-baseline
Commit Name: f7afc7ae76ed2c328ed02f05e91ccceec8942e0b
Time: 2018-09-26
Author: dpressel@gmail.com
File Name: python/baseline/pytorch/seq2seq/model.py
Class Name: Seq2SeqModel
Method Name: make_input


Project Name: dpressel/mead-baseline
Commit Name: f7afc7ae76ed2c328ed02f05e91ccceec8942e0b
Time: 2018-09-26
Author: dpressel@gmail.com
File Name: python/baseline/pytorch/seq2seq/model.py
Class Name: Seq2SeqModel
Method Name: make_input


Project Name: dpressel/mead-baseline
Commit Name: 2eb4c5f77bd8da9b1e23851b0acb84543e442953
Time: 2018-09-24
Author: dpressel@gmail.com
File Name: python/baseline/pytorch/classify/model.py
Class Name: WordClassifierModelBase
Method Name: make_input


Project Name: dpressel/mead-baseline
Commit Name: 7a4f4148317f7274c0c88095c037e93f95b1d00d
Time: 2018-09-25
Author: dpressel@gmail.com
File Name: python/baseline/pytorch/lm/model.py
Class Name: AbstractLanguageModel
Method Name: make_input