MCPcopy Create free account
hub / github.com/649453932/Chinese-Text-Classification-Pytorch / forward

Method forward

models/TextRNN.py:53–58  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

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):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected