cc80175c2704c0dbbfe908f6b678c84ef1741a56,onmt/Models.py,Encoder,forward,#Encoder#Any#Any#,28
Before Change
if hidden is None:
batch_size = emb.size(1)
h_size = (self.layers * self.num_directions, batch_size, self.hidden_size)
h_0 = Variable(emb.data.new(*h_size).zero_(), requires_grad=False)
c_0 = Variable(emb.data.new(*h_size).zero_(), requires_grad=False)
hidden = (h_0, c_0)
outputs, hidden_t = self.rnn(emb, hidden)
return hidden_t, outputs
After Change
def forward(self, input, hidden=None):
if isinstance(input, tuple):
emb = pack(self.word_lut(input[0]), input[1])
else:
emb = self.word_lut(input)
outputs, hidden_t = self.rnn(emb, hidden)
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 3
Instances
Project Name: OpenNMT/OpenNMT-py
Commit Name: cc80175c2704c0dbbfe908f6b678c84ef1741a56
Time: 2017-03-22
Author: bryan.mccann.is@gmail.com
File Name: onmt/Models.py
Class Name: Encoder
Method Name: forward
Project Name: NifTK/NiftyNet
Commit Name: 53633acd7c861fd73e3954088a48d0ac8dc42895
Time: 2017-11-01
Author: eli.gibson@gmail.com
File Name: niftynet/application/gan_application.py
Class Name: GANApplication
Method Name: connect_data_and_network
Project Name: maciejkula/spotlight
Commit Name: bed4f2dd50ff54eb7629362c3d03a3b758e0745a
Time: 2017-08-09
Author: maciej.kula@gmail.com
File Name: spotlight/layers.py
Class Name: BloomEmbedding
Method Name: forward