Created
July 15, 2017 03:34
-
-
Save bartvm/0048f85603a4f4ae209a38ec7be70c50 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
from torch import Tensor | |
from torch.autograd import Function, Variable | |
class Foo(Function): | |
def forward(self, x): | |
return x | |
def backward(self, dz_star): | |
dphidz = Variable(Tensor(1), requires_grad=True) | |
dphidz.backward() | |
return None | |
x = Variable(Tensor(1), requires_grad=True) | |
Foo()(x).backward() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment