Getting Nan after first iteration with custom loss

Is there a way to have the anomaly detection on by default? I want to avoid inserting with autograd.detect_anomaly(): in different parts of the code.

2 Likes