No variable when backpropagating with custom loss function

Hi,

When implementing a custom loss function and backpropagating I get the following error:

ConvNdBackward: expected Variable at argument 0 (got None)

Custom loss function code (all inputs are Variables):

# Implement loss
def custom_loss(S, C, S_prime, C_prime, B):

    
    loss_cover = torch.nn.functional.mse_loss(C, C_prime)
    loss_secret = torch.nn.functional.mse_loss(S, S_prime)
    loss_all = loss_cover + B * loss_secret
    return loss_all

What does this mean and how can I solve it?

Thanks in advance!

What version of pytorch are you using?

This looks like a bug that I think we fixed. Could you please try building pytorch from source and seeing if this goes away?