When using detect_anomoly, I’m getting an nan in the backward pass of a squaring function. This confuses me because both the square and its derivative should not give nans at any point. I’ve checked that the nan arises in the backward pass and not the forward pass. Am I missing something here?
Here’s the full error:
The forward pass call where the error occurs is
y_2 = torch.pow(diff, 2) 

and the specific error is
RuntimeError: Function 'PowBackward0' returned nan values in its 0th output.