# If the goal of training of a GAN is to have $P_g=P_{data}$, shouldn't this produce the exact same images?

Referring to the blog, Image Completion with Deep Learning in TensorFlow, it clearly says that we would want a generator $$g$$ whose modeled distribution fits our dataset $$data$$, in other words, $$P_{data}=P_g$$.

But, as described earlier in the blog, the space $$P_{data}$$ is in is a higher-dimensional space, where a dimension represents a particular pixel in an image, making it a $$64*64*3$$ dimensional space (in this case). I have a few questions regarding this

1. Since each pixel here will have an intensity value, will the pdf try to encapsulate a unique pdf for each pixel?
2. If we sample the most likely pixel value for each pixel, considering the distributions need not be the same for each pixel, is it not quite likely that the most probabilistic generated image is just noise apart from things like a common background or so?
3. If $$P_g$$ is trying to replicate $$P_{data}$$ only, does that mean a GAN only tries to learn lower level features that are common in the training set? Are GANs clueless about what its doing?
• Addition to Q2 - If not noise should it not produce the exact same image if that image with highest probabilities happens to exist? – ashenoy Jul 19 '19 at 11:24
• General Addition - Is my understanding even in the right direction in the first place? – ashenoy Jul 19 '19 at 11:25
• Hi. Please, next time ask one question per post! – nbro Jul 20 '19 at 13:40

## 1 Answer

Answers:

1. No, generally GANs model the joint distribution of pixel space. The space is so entangled that it would be very difficult to model a singular pixels PDF.
2. This question doesn't make sense given the first question's answer. You do NOT sample singular pixels, you sample the joint.
3. $$P_g$$ is trying to model $$P_{data}$$, so that's your goal, so yes it will find features in the training set. Ideally, though it can extrapolate usage of the features to generate new images. But, yes depending on your setup you can end up with overfitting or mode-collapse where you really only generate a small subset of images that trick the discriminator. So I would say, no, the GAN doesn't know what its doing (since its just a minimax optimization of a loss you setup), so your goal is to tell it what to do in a way to achieve your best result.