8a70c277c355fe734a01fe58baafdc2dc5164205,OpenNMT/onmt/Models.py,Decoder,forward,#Decoder#,91
Before Change
output = Variable(emb.data.new(batch_size, self.hidden_size).zero_(),
requires_grad=False)
h_0 = Variable(emb.data.new(batch_size, self.hidden_size),
requires_grad=False)
c_0 = Variable(emb.data.new(batch_size, self.hidden_size),
requires_grad=False)
hidden = (h_0, c_0)
outputs = []
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(outputs)
pred = self.generator(outputs)
return pred
After Change
output = Variable(emb.data.new(batch_size, self.hidden_size).zero_(),
requires_grad=False)
h_0 = Variable(emb.data.new(batch_size, self.hidden_size).zero_(),
requires_grad=False)
c_0 = Variable(emb.data.new(batch_size, self.hidden_size).zero_(),
requires_grad=False)
hidden = (h_0, c_0)
outputs = []
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(outputs)
pred = self.generator(outputs)
return pred
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 3
Instances
Project Name: OpenNMT/OpenNMT-py
Commit Name: 8a70c277c355fe734a01fe58baafdc2dc5164205
Time: 2016-12-29
Author: alerer@fb.com
File Name: OpenNMT/onmt/Models.py
Class Name: Decoder
Method Name: forward
Project Name: asappresearch/sru
Commit Name: e25c3820aaa1ebb9c0bf7731467e24a2a2592a54
Time: 2019-10-22
Author: taolei@csail.mit.edu
File Name: sru/cuda_functional.py
Class Name: SRU_Compute_GPU
Method Name: forward
Project Name: asappresearch/sru
Commit Name: 7c2cf787d2cd4028dd25cb8af19b653c9b459e32
Time: 2019-08-24
Author: taolei@csail.mit.edu
File Name: sru/cuda_functional.py
Class Name: SRU_Compute_GPU
Method Name: forward