google / compare_gan

Compare GAN code.
Apache License 2.0
1.82k stars 317 forks source link

Interpolates is different from paper #24

Closed dongrongliang closed 5 years ago

dongrongliang commented 5 years ago

In penalty_lib.py line 75, interpolates = x + alpha (x_fake - x). As for the Algorithm 1 of paper 'Improved Training of Wasserstein GANs', the interpolates equation is wrote as interpolates = alpha x + (1-alpha)*x_fake. Are these two formulation equivalent? Or There were some tricks I missed.

Marvin182 commented 5 years ago

Those two are equivalent. You want to interpolate between x and x_fake and since alpha is a random variable in [0, 1] you might as well compute: interpolates = (1 - alpha) x + alpha x_fake = x - alpha x + alpha x_fake = x + alpha * (x_fake - x)

Thanks for checking our code for bugs :)