kwotsin / mimicry

[CVPR 2020 Workshop] A PyTorch GAN library that reproduces research results for popular GANs.
MIT License
602 stars 62 forks source link

Difference of spectral norm conv2d in Dblock/DBlockOptimized #32

Open Leiwx52 opened 4 years ago

Leiwx52 commented 4 years ago

Hi~ thanks for your great contribution!

I have a question for the implementation of Dblock and DBlockOptimized. When I was trying to visualize the spectral norm of some layers, I noticed that you have two version of implementation of SN: class SNConv2d in torch_mimicry/modules/spectral_norm.py and function SNConv2d in torch_mimicry/modules/layers.py. If it is true, in Dblock and DBlockOptimized, class SNConv2d with spectral_norm=True by default. However, I feel little confused when i run the following code:

Since class SNConv2d has a more convenient way to inspect the spectral norm(it has related function to do this directly), I wonder what caused this difference. Also when I call SNGANDiscriminator32 and print its modules, results show that all the SN conv2d is implemented by pytorch official SN function/wrapper. If you've already figured it out, plz tell me how to switch to class SNConv2d .

THANKS!