78eba7b3f82b8420deac3cd28318dbfead0f9b9e,python/baseline/pytorch/seq2seq/model.py,Seq2SeqModel,encode,#Seq2SeqModel#Any#Any#,160
Before Change
def encode(self, input, src_len):
embed_in_seq = self.embed(input)
//if self.training:
packed = torch.nn.utils.rnn.pack_padded_sequence(embed_in_seq, src_len.data.tolist())
output_tbh, hidden = self.encoder_rnn(packed)
output_tbh, _ = torch.nn.utils.rnn.pad_packed_sequence(output_tbh)
//else:
// output_tbh, hidden = self.encoder_rnn(embed_in_seq)
After Change
tensor = tensor[perm_idx]
example[key] = tensor
if self.gpu:
example[key] = example[key].cuda()
if "tgt" in batch_dict:
tgt = torch.from_numpy(batch_dict["tgt"])
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 7
Instances
Project Name: dpressel/mead-baseline
Commit Name: 78eba7b3f82b8420deac3cd28318dbfead0f9b9e
Time: 2018-10-30
Author: dpressel@gmail.com
File Name: python/baseline/pytorch/seq2seq/model.py
Class Name: Seq2SeqModel
Method Name: encode
Project Name: dpressel/mead-baseline
Commit Name: 1f8ddd6d1c71fc2d08999e0e49193ffc269c86d7
Time: 2019-10-25
Author: dpressel@gmail.com
File Name: python/eight_mile/pytorch/embeddings.py
Class Name: CharLSTMEmbeddings
Method Name: forward
Project Name: dpressel/mead-baseline
Commit Name: 839feded67f77757281dda4d9efc069252da4f39
Time: 2019-10-21
Author: blester125@users.noreply.github.com
File Name: python/baseline/pytorch/seq2seq/encoders.py
Class Name: RNNEncoder
Method Name: forward