Created
August 19, 2020 09:06
-
-
Save BloodAxe/396010353909fc4e6342009c8d40b7b7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch | |
def main(): | |
torch.autograd.detect_anomaly() | |
... | |
# Rest of the training code | |
# OR | |
class MyNumericallyUnstableLoss(nn.Module): | |
def forward(self, input, target): | |
with torch.autograd.set_detect_anomaly(True): | |
loss = input * target | |
return loss |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment