MCPcopy Create free account
hub / github.com/pytorch/examples / forward

Method forward

word_language_model/model.py:48–54  ·  view source on GitHub ↗
(self, input, hidden)

Source from the content-addressed store, hash-verified

46 nn.init.uniform_(self.decoder.weight, -initrange, initrange)
47
48 def forward(self, input, hidden):
49 emb = self.drop(self.encoder(input))
50 output, hidden = self.rnn(emb, hidden)
51 output = self.drop(output)
52 decoded = self.decoder(output)
53 decoded = decoded.view(-1, self.ntoken)
54 return F.log_softmax(decoded, dim=1), hidden
55
56 def init_hidden(self, bsz):
57 weight = next(self.parameters())

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected