I just checked, the gradients are becoming nan and the refine loss is 0. due to nan gradient, weights are nan and hence results in nan output. Why are gradients ‘nan’ when using refine loss because when I don’t use it, the gradients are fine.