All problems
GAN Generator Loss
Problem
Compute the non-saturating generator loss: -mean(log(D(fake))), where D(fake) are the discriminator probabilities assigned to generated samples.
The signature is gan_generator_loss(fake_probs).
Hint
This is the -log D variant that gives useful gradients when the generator is losing.
Test cases
case 1
in: [[0.5,0.5]]
expected: 0.6931471806
case 2
in: [[0.9]]
expected: 0.1053605157
case 3
in: [[0.1]]
expected: 2.302585093
case 4
in: [[1]]
expected: 0
Starter codePython
import math
def gan_generator_loss(fake_probs):
# Your code here
pass4 test cases · run your code against them in the editor