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

Method init_weights

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

Source from the content-addressed store, hash-verified

123 return torch.log(torch.tril(torch.ones(sz,sz)))
124
125 def init_weights(self):
126 initrange = 0.1
127 nn.init.uniform_(self.input_emb.weight, -initrange, initrange)
128 nn.init.zeros_(self.decoder.bias)
129 nn.init.uniform_(self.decoder.weight, -initrange, initrange)
130
131 def forward(self, src, has_mask=True):
132 if has_mask:

Callers 1

__init__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected