Hello @ptrblck sorry this maybe out of thread, but if we implement a loos function in new pytorch 1.0 or 0.4 is that necessary to have backward() function?
Suppose I want to implement dice coefficient loss like this:
def dice_loss(pred, target):
    smooth = 1.
    iflat = pred.contiguous().view(-1)
    tflat = target.contiguous().view(-1)
    intersection = (iflat * tflat).sum()
    A_sum = torch.sum(tflat * iflat)
    B_sum = torch.sum(tflat * tflat)    
    return 1 - ((2. * intersection + smooth) / (A_sum + B_sum + smooth) )

During the running time it run smoothly with no error, however I just don’t understand is that really do backpropagation and calculating gradient?, how can we check it?
I work in segmentation so I need to sum the loss like loss = entrophy + dice coeff is that really do backpropagation or it just calculate the entrophy loss not the dice since it is not implementing backward() function.