Skip to content

Instantly share code, notes, and snippets.

@vaibhavkumar049
Created May 25, 2019 08:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vaibhavkumar049/65ec1a615a445acd86ad2577112d34f9 to your computer and use it in GitHub Desktop.
Save vaibhavkumar049/65ec1a615a445acd86ad2577112d34f9 to your computer and use it in GitHub Desktop.
x = torch.ones([3, 2], requires_grad=True)
y = x + 5
r = 1/(1 + torch.exp(-y))
print(r)
s = torch.sum(r)
s.backward()
print(x.grad)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment