eriklindernoren / Keras-GAN

Keras implementations of Generative Adversarial Networks.
MIT License
9.19k stars 3.14k forks source link

Confusing about the multiply operation in cgan #143

Open MmDawN opened 5 years ago

MmDawN commented 5 years ago

Here, I don't understand why we need to multiply the input image by the label. Don't we need to concat the two part in CGAN? I'll be really appreciate if anyone can help me out!

MmDawN commented 5 years ago

model_input = multiply([flat_img, label_embedding])

mrgloom commented 5 years ago

Looks like it's just a way to add label information without increasing input dimension, however I don't know how it's common.

https://stats.stackexchange.com/questions/270546/how-does-keras-embedding-layer-work

mrgloom commented 5 years ago

Looks like using embedding layer is suggested here: https://github.com/soumith/ganhacks#16-discrete-variables-in-conditional-gans

MmDawN commented 5 years ago

@mrgloom Thanks for your reply, but is there any formal inference for doing so?

pranavbudhwant commented 5 years ago

I have the same doubt. In case we have multiple auxiliary inputs, then should we multiply all of their embeddings with the noise or concatenate?