Learning to Validate Generative Models: a Goodness-of-Fit Approach