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

Class Decoder

distributed/rpc/rnn/rnn.py:58–70  ·  view source on GitHub ↗

r""" Decoding layers of the RNNModel

Source from the content-addressed store, hash-verified

56
57
58class Decoder(nn.Module):
59 r"""
60 Decoding layers of the RNNModel
61 """
62 def __init__(self, ntoken, nhid, dropout):
63 super(Decoder, self).__init__()
64 self.drop = nn.Dropout(dropout)
65 self.decoder = nn.Linear(nhid, ntoken)
66 nn.init.zeros_(self.decoder.bias)
67 nn.init.uniform_(self.decoder.weight, -0.1, 0.1)
68
69 def forward(self, output):
70 return self.decoder(self.drop(output))
71
72
73class RNNModel(nn.Module):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected