stargan-v2 icon indicating copy to clipboard operation
stargan-v2 copied to clipboard

Why the `detach` in the diversity loss?

Open yohan-pg opened this issue 3 years ago • 0 comments

In the code for the diversity sensitive loss:

# diversity sensitive loss
if z_trgs is not None:
    s_trg2 = nets.mapping_network(z_trg2, y_trg)
else:
    s_trg2 = nets.style_encoder(x_ref2, y_trg)
x_fake2 = nets.generator(x_real, s_trg2, masks=masks)
x_fake2 = x_fake2.detach()
loss_ds = torch.mean(torch.abs(x_fake - x_fake2))

I'm wonder why x_fake2 is detached here? This is not mentioned in the paper and I really don't see any reason why leaving it attached would pose a problem.

yohan-pg avatar Apr 18 '21 00:04 yohan-pg