Skip to content

Instantly share code, notes, and snippets.

Last active January 16, 2023 07:20
  • Star 10 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save apaszke/c7257ac04cb8debb82221764f6d117ad to your computer and use it in GitHub Desktop.
def Rop(y, x, v):
"""Computes an Rop.
y (Variable): output of differentiated function
x (Variable): differentiated input
v (Variable): vector to be multiplied with Jacobian from the right
w = torch.ones_like(y, requires_grad=True)
return torch.autograd.grad(torch.autograd.grad(y, x, w), w, v)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment