Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

different update frequencies of different modules #27

Open
Honlan opened this issue May 8, 2020 · 2 comments
Open

different update frequencies of different modules #27

Honlan opened this issue May 8, 2020 · 2 comments

Comments

@Honlan
Copy link

Honlan commented May 8, 2020

Hi~ thanks a lot for your awesome work!

I find that during each iteration, D is optimized for twice:

d_loss, d_losses_latent = compute_d_loss(
    nets, args, x_real, y_org, y_trg, z_trg=z_trg, masks=masks)
self._reset_grad()
d_loss.backward()
optims.discriminator.step()

d_loss, d_losses_ref = compute_d_loss(
    nets, args, x_real, y_org, y_trg, x_ref=x_ref, masks=masks)
self._reset_grad()
d_loss.backward()
optims.discriminator.step()

G is also optimized for twice:

g_loss, g_losses_latent = compute_g_loss(
    nets, args, x_real, y_org, y_trg, z_trgs=[z_trg, z_trg2], masks=masks)
self._reset_grad()
g_loss.backward()
optims.generator.step()
optims.mapping_network.step()
optims.style_encoder.step()

g_loss, g_losses_ref = compute_g_loss(
    nets, args, x_real, y_org, y_trg, x_refs=[x_ref, x_ref2], masks=masks)
self._reset_grad()
g_loss.backward()
optims.generator.step()

However, mapping_network and style_encoder are only optimized for once.

Could you explain it for me? many thanks again.

@yunjey
Copy link
Collaborator

yunjey commented May 10, 2020

@Honlan The first phase is for latent-guided synthesis and the second phase is for reference-guided synthesis. The only difference is whether to use the mapping network or the style encoder to extract target style codes.

@Honlan
Copy link
Author

Honlan commented Jun 8, 2020

So, why mapping_network and style_encoder are optimized during the first phase (optims.mapping_network.step(), optims.style_encoder.step()), but these two modules are not optimized during the second phase?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants