7ee5c4cc9f2224f24f8121e78fdc969a2bf754e1,OpenNMT/onmt/Models.py,Decoder,forward,#Decoder#Any#Any#Any#,102
Before Change
hidden = enc_hidden
outputs = []
hidden = (hidden[0].squeeze(0), hidden[1].squeeze(0))
for emb_t in emb.chunk(emb.size(0)):
emb_t = emb_t.squeeze(0)
if self.input_feed:
emb_t = torch.cat([emb_t, output], 1)
// FIXME: multilayer
hidden = self.rnn(emb_t, hidden)
output = hidden[0]
output = self.attn(output, context.t())
output = self.dropout(output)
outputs += [output]
outputs = torch.cat([x.unsqueeze(0) for x in outputs])
return outputs
After Change
output = self.dropout(output)
outputs += [output]
outputs = torch.stack(outputs)
return outputs
class NMTModel(nn.Container):
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 6
Instances
Project Name: OpenNMT/OpenNMT-py
Commit Name: 7ee5c4cc9f2224f24f8121e78fdc969a2bf754e1
Time: 2017-01-11
Author: alerer@fb.com
File Name: OpenNMT/onmt/Models.py
Class Name: Decoder
Method Name: forward
Project Name: OpenNMT/OpenNMT-py
Commit Name: 68fbfd1876c367323acf830736bae1af499cc0fe
Time: 2018-03-07
Author: dengyuntian@gmail.com
File Name: onmt/modules/Transformer.py
Class Name: TransformerDecoder
Method Name: forward