Ive implemented a new loss function that tries to measure the circularity of a segmentation based on image moments. Ive combined this with the dice loss so my new loss is:
L = dice_loss + log10(circ_loss)/3 + 1
When printing the variables L, dice_loss and circ_loss in the above I noticed that the circ_loss term had no grad_fn attribute.
I’ve got very little knowledge as to what this means, but I am worried this means backward prop is not taking into account the circ loss term. There is no error during training and the overall loss seems to be decreasing, but I’m just wondering what the lack of a grad fn attribute means.
Can provide any code that could be helpful.
Adding requires_grad = true during initalisation of leaf tensors worked to bring the grad_fn attribute. So code does not have the issue detailed in the question. Not sure how to close question.