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

Method init_weights

word_language_model/model.py:42–46  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

40 self.nlayers = nlayers
41
42 def init_weights(self):
43 initrange = 0.1
44 nn.init.uniform_(self.encoder.weight, -initrange, initrange)
45 nn.init.zeros_(self.decoder.bias)
46 nn.init.uniform_(self.decoder.weight, -initrange, initrange)
47
48 def forward(self, input, hidden):
49 emb = self.drop(self.encoder(input))

Callers 1

__init__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected