Skip to content
DeepForgeby svx
All problems
MediumDeep Learningdl-165

Diffusion MSE Loss

Problem

Compute the diffusion training loss: mean squared error between the true noise and the predicted noise, mean((eps - eps_pred)^2).

The signature is diffusion_mse_loss(eps, eps_pred).

Hint

Predicting the noise is equivalent to predicting the score, up to scaling.

Test cases

case 1
in: [[1,2],[1,2]]
expected: 0
case 2
in: [[1,2],[2,4]]
expected: 2.5
case 3
in: [[0.5],[1]]
expected: 0.25
case 4
in: [[-1,0,1],[0,0,0]]
expected: 0.6666666667
Starter codePython
def diffusion_mse_loss(eps, eps_pred):
    # Your code here
    pass

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