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