c4610ff26a01a0622bc11dcac0f0812f05c56e0c,12_4_name_classify.py,RNNClassifier,forward,#RNNClassifier#Any#Any#,97
Before Change
output, hidden = self.gru(gru_input, hidden)
fc_output = self.fc(hidden[-1]) // Use the last layer
print("Final output size", fc_output.size())
return fc_output
def _init_hidden(self, batch_size):
After Change
embedded = self.embedding(input)
// Pack them up nicely
gru_input = pack_padded_sequence(embedded, seq_lengths.data.cpu().numpy())
// To compact weights again call flatten_parameters().
self.gru.flatten_parameters()
output, hidden = self.gru(gru_input, hidden)
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 3
Instances
Project Name: hunkim/PyTorchZeroToAll
Commit Name: c4610ff26a01a0622bc11dcac0f0812f05c56e0c
Time: 2017-11-02
Author: hunkim@gmail.com
File Name: 12_4_name_classify.py
Class Name: RNNClassifier
Method Name: forward
Project Name: stanfordnlp/stanza
Commit Name: fcea9fee573e854177b4b9af1cfd1b20029ed21e
Time: 2018-10-11
Author: qipeng@users.noreply.github.com
File Name: models/common/char_model.py
Class Name: CharacterModel
Method Name: forward
Project Name: asappresearch/sru
Commit Name: faf3aa876462323f2fa721ebd633752d6489808f
Time: 2020-09-18
Author: taolei@csail.mit.edu
File Name: sru/modules.py
Class Name: SRU
Method Name: forward