For a fixed generator density pG, the discriminator that minimises the GAN error (17.14) is d*(x) = pdata(x) / (pdata(x) + pG(x)) (17.15). Plugging it back gives the error E(pG, d*) = ln 4 − 2 JS(pdata, pG) (17.16); the generator, which maximises the error, therefore minimises 2 JS − ln 4 (the expression printed as (17.17), whose sign is flipped: see the notes), and the best it can do is pG = pdata. The non-saturating loss (17.10), against the same d*, follows instead the gradient of KL(pG‖pdata) − 2 JS. Here the generator is a Gaussian N(μ, σ²); every integral is computed on a grid of 6001 points.
Descent: (μ, σ) ← (μ, σ) − (rate)·∇, with d = d* recomputed after every step and held fixed while the gradient is taken (the inner loop of Exercise 17.1 solved exactly). Minimax: ∇ EpG[ln(1 − d*)] = ∇ 2 JS. Non-saturating: ∇ EpG[−ln d*] = ∇[KL(pG‖pdata) − 2 JS]. Instance noise τ adds N(0, τ²) to data and samples, i.e. replaces every standard deviation s by (s² + τ²)1/2.
code/ch17_generative_adversarial_networks.py (grid_divergences, ideal_gradients, ideal_descent, Figure 17.S1); the numbers here equal the Python ones.