Skip to content

Instantly share code, notes, and snippets.

@piEsposito
Created May 24, 2020 22:14
Show Gist options
  • Save piEsposito/921394de01ab9e2b8b3b81f50991f58a to your computer and use it in GitHub Desktop.
Save piEsposito/921394de01ab9e2b8b3b81f50991f58a to your computer and use it in GitHub Desktop.
def init_weights(self):
stdv = 1.0 / math.sqrt(self.hidden_size)
for weight in self.parameters():
weight.data.uniform_(-stdv, stdv)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment