(self, x)
| 51 | self.fc = nn.Linear(config.hidden_size * 2, config.num_classes) |
| 52 | |
| 53 | def forward(self, x): |
| 54 | x, _ = x |
| 55 | out = self.embedding(x) # [batch_size, seq_len, embeding]=[128, 32, 300] |
| 56 | out, _ = self.lstm(out) |
| 57 | out = self.fc(out[:, -1, :]) # 句子最后时刻的 hidden state |
| 58 | return out |
| 59 | |
| 60 | '''变长RNN,效果差不多,甚至还低了点...''' |
| 61 | # def forward(self, x): |
nothing calls this directly
no outgoing calls
no test coverage detected