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

Class AdaIN

StyleGAN/net/model.py:108–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106
107#是一个Batch Normazliation
108class AdaIN(torch.nn.Module):
109 def __init__(self,channel,w_dim):
110 super(AdaIN, self).__init__()
111 #https://blog.csdn.net/OneFlow_Official/article/details/123288435
112 self.instance_norm = torch.nn.InstanceNorm2d(channel)
113 self.style_scale = WSLinear(w_dim,channel)
114 self.style_bias = WSLinear(w_dim,channel)
115
116 def forward(self,x,w):
117 x = self.instance_norm(x)
118 #对dim = 2和dim = 3其进行升维
119 style_scale = self.style_scale(w).unsqueeze(2).unsqueeze(3)
120 style_bias = self.style_bias(w).unsqueeze(2).unsqueeze(3)
121 return style_scale * x + style_bias
122
123
124#对应着Synthesis network的每一个block

Callers 2

__init__Method · 0.85
__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected