Skip to content

Commit

Permalink
Update dualstylegan.py
Browse files Browse the repository at this point in the history
  • Loading branch information
williamyang1991 authored Mar 6, 2023
1 parent 6d4660e commit b3f0cf8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions model/dualstylegan.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def __init__(self, size, style_dim, n_mlp, channel_multiplier=2, twoRes=True, re
layers = [PixelNorm()]
for i in range(n_mlp-6):
layers.append(EqualLinear(512, 512, lr_mul=0.01, activation="fused_lrelu"))
# color transform blocks T_c
# structure transform blocks T_s
self.style = nn.Sequential(*layers)
# StyleGAN2
self.generator = Generator(size, style_dim, n_mlp, channel_multiplier)
Expand All @@ -66,7 +66,7 @@ def __init__(self, size, style_dim, n_mlp, channel_multiplier=2, twoRes=True, re
self.res.append(AdaResBlock(out_channel))
self.res.append(AdaResBlock(out_channel))
else:
# structure transform block T_s
# color transform block T_c
self.res.append(EqualLinear(512, 512))
# FC layer is initialized with identity matrices, meaning no changes to the input latent code
self.res[-1].weight.data = torch.eye(512) * 512.0**0.5 + torch.randn(512, 512) * 0.01
Expand Down Expand Up @@ -200,4 +200,4 @@ def mean_latent(self, n_latent):
return self.generator.mean_latent(n_latent)

def get_latent(self, input):
return self.generator.style(input)
return self.generator.style(input)

0 comments on commit b3f0cf8

Please sign in to comment.