MCPcopy Create free account
hub / github.com/KeepTryingTo/Pytorch-GAN / __init__

Method __init__

StyleGAN/net/model.py:50–59  ·  view source on GitHub ↗
(self,in_features,out_features,gain = 2)

Source from the content-addressed store, hash-verified

48
49class WSLinear(torch.nn.Module):
50 def __init__(self,in_features,out_features,gain = 2):
51 super(WSLinear, self).__init__()
52 self.linear = torch.nn.Linear(in_features,out_features)
53 self.scale = (gain / in_features)**0.5
54 self.bias = self.linear.bias
55 self.linear.bias = None
56
57 #initialize linear layer
58 torch.nn.init.normal_(self.linear.weight)
59 torch.nn.init.zeros_(self.bias)
60
61 def forward(self,x):
62 out = self.linear(x * self.scale) + self.bias

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected