Skip to content

Instantly share code, notes, and snippets.

@InnovArul
Created December 24, 2020 06:45
Show Gist options
  • Save InnovArul/400daff04f825b71be1c01591697ceb8 to your computer and use it in GitHub Desktop.
Save InnovArul/400daff04f825b71be1c01591697ceb8 to your computer and use it in GitHub Desktop.
import torch
with torch.autograd.set_detect_anomaly(True):
x = torch.randn(5,6, requires_grad=True)
z = x.sum(-1)
z += z * z
z.sum().backward()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment