Luisgust commited on
Commit
2d2db19
·
verified ·
1 Parent(s): 081dbbf

Update vtoonify/model/stylegan/model.py

Browse files
Files changed (1) hide show
  1. vtoonify/model/stylegan/model.py +11 -1
vtoonify/model/stylegan/model.py CHANGED
@@ -706,4 +706,14 @@ class Discriminator(nn.Module):
706
  stddev = out.view(
707
  group, -1, self.stddev_feat, channel // self.stddev_feat, height, width
708
  )
709
- stddev = torch.sqrt(stddev.var(0
 
 
 
 
 
 
 
 
 
 
 
706
  stddev = out.view(
707
  group, -1, self.stddev_feat, channel // self.stddev_feat, height, width
708
  )
709
+ stddev = torch.sqrt(stddev.var(0, unbiased=False) + 1e-8)
710
+ stddev = stddev.mean([2, 3, 4], keepdims=True).squeeze(2)
711
+ stddev = stddev.repeat(group, 1, height, width)
712
+ out = torch.cat([out, stddev], 1)
713
+
714
+ out = self.final_conv(out)
715
+
716
+ out = out.view(batch, -1)
717
+ out = self.final_linear(out)
718
+
719
+ return out