Compute the Wasserstein critic loss from raw critic scores:
L=Nf1i=1∑NfD(xifake)−Nr1i=1∑NrD(xireal)Here, D(x) is a raw critic score, Nf is the number of fake samples, and Nr is the number of real samples. The two score arrays may have different lengths. Return the difference of their means as a Python float.
Input: real_scores = [2.0, 1.5, 3.0], fake_scores = [-1.0, 0.0, 0.5]
Output: -2.333333
Explanation: The fake-score mean is -0.166667 and the real-score mean is 2.166667.
Input: real_scores = [1.0, 2.0, 3.0], fake_scores = [2.0, 2.0, 2.0]
Output: 0.0
Input: real_scores = [0.0, 0.0], fake_scores = [1.0, 2.0, 3.0]
Output: 2.0
Use np.mean separately on the real and fake arrays.
Return float(mean_fake - mean_real).
Sign in to take notes on this problem
Accepts: array
Accepts: array
Compute the Wasserstein critic loss from raw critic scores:
L=Nf1i=1∑NfD(xifake)−Nr1i=1∑NrD(xireal)Here, D(x) is a raw critic score, Nf is the number of fake samples, and Nr is the number of real samples. The two score arrays may have different lengths. Return the difference of their means as a Python float.
Input: real_scores = [2.0, 1.5, 3.0], fake_scores = [-1.0, 0.0, 0.5]
Output: -2.333333
Explanation: The fake-score mean is -0.166667 and the real-score mean is 2.166667.
Input: real_scores = [1.0, 2.0, 3.0], fake_scores = [2.0, 2.0, 2.0]
Output: 0.0
Input: real_scores = [0.0, 0.0], fake_scores = [1.0, 2.0, 3.0]
Output: 2.0
Use np.mean separately on the real and fake arrays.
Return float(mean_fake - mean_real).
Sign in to take notes on this problem
Accepts: array
Accepts: array