znxlwm / pytorch-generative-model-collections

Collection of generative models in Pytorch version.
2.59k stars 546 forks source link

Why do we need to call net.train() in ACGAN? #9

Closed haoyangz closed 6 years ago

haoyangz commented 6 years ago

In many places like here and here, we have D.train() and G.train(). Is there any particular reason that we need to explicitly set them as True (over and over again) ? The official Pytorch GAN example doesn't seem to do net.train() at all. Thanks!

haoyangz commented 6 years ago

Ok it's because In visualize_results function G.eval() is called. So we need to set it back every time we called visualize_results. This is probably the right thing to do when generating images to visualize. It's not clear why the official example missed it.