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

Class WSLinear

StyleGAN/net/model.py:49–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47 return out
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
63 return out
64
65
66#摆脱输入向量z受输入数据集分布的影响,更好的实现属性解耦合

Callers 2

__init__Method · 0.85
__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected