Skip to content
DeepForgeby svx
All problems
MediumDeep Learningdl-162

WGAN Critic Loss

Problem

Compute the Wasserstein critic loss: mean(critic(fake)) - mean(critic(real)). Minimizing it pushes fake scores below real scores.

The signature is wgan_critic_loss(real_scores, fake_scores).

Hint

The critic outputs unbounded scores, not probabilities.

Test cases

case 1
in: [[1,2],[3,4]]
expected: 2
case 2
in: [[0],[0]]
expected: 0
case 3
in: [[5],[1]]
expected: -4
case 4
in: [[-1,-3],[0,2]]
expected: 3
Starter codePython
def wgan_critic_loss(real_scores, fake_scores):
    # Your code here
    pass

4 test cases · run your code against them in the editor