i have a multi class problem and i want to use MSE loss
i have weights, so the loss is:
def weighted_mse_loss(input,target,weights):
    out = (input-target)**2
    out = out * weights.expand_as(out)
    loss = out.sum(0)
    return loss

but now the loss is a tensor with 61 length (i have 61 classes)
and i get error:
“grad can be implicitly created only for scalar outputs”