31b245193541b1c8cc75b8eea8232a1fb7552c75,onmt/Models.py,Encoder,forward,#Encoder#Any#Any#,31
Before Change
emb = self.word_lut(input)
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)
After Change
self.word_lut.weight.copy_(pretrained)
def forward(self, input, hidden=None):
batch_size = input.size(0) // batch first for multi-gpu compatibility
emb = self.word_lut(input).transpose(0, 1)
if hidden is None:
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)
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 6
Instances
Project Name: OpenNMT/OpenNMT-py
Commit Name: 31b245193541b1c8cc75b8eea8232a1fb7552c75
Time: 2017-02-27
Author: bryan.mccann.is@gmail.com
File Name: onmt/Models.py
Class Name: Encoder
Method Name: forward
Project Name: OpenNMT/OpenNMT-py
Commit Name: f84ceac8a9ccf0604d9f9f88cbf1f17f3d763688
Time: 2017-02-23
Author: bryan.mccann.is@gmail.com
File Name: onmt/Models.py
Class Name: Encoder
Method Name: forward
Project Name: OpenNMT/OpenNMT-py
Commit Name: 84cb0b0c32979412565358f9d0606df902eeb7f9
Time: 2017-03-14
Author: bryan.mccann.is@gmail.com
File Name: onmt/Models.py
Class Name: Encoder
Method Name: forward