f485f7bc4f829d12bcc79ebcfc1ca2045a3af8a7,OpenNMT/onmt/Models.py,Encoder,forward,#Encoder#Any#Any#,31

Before Change


            self.word_lut.weight.copy_(pretrained)

    def forward(self, input, hidden=None):
        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)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 8

Instances


Project Name: pytorch/examples
Commit Name: f485f7bc4f829d12bcc79ebcfc1ca2045a3af8a7
Time: 2017-02-23
Author: bryan.mccann.is@gmail.com
File Name: OpenNMT/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: pytorch/examples
Commit Name: f485f7bc4f829d12bcc79ebcfc1ca2045a3af8a7
Time: 2017-02-23
Author: bryan.mccann.is@gmail.com
File Name: OpenNMT/onmt/Models.py
Class Name: Encoder
Method Name: forward


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