Skip to content

Instantly share code, notes, and snippets.

@wanchaol
Created July 17, 2019 18:13
Show Gist options
  • Save wanchaol/5d7fce6805ec405b1be993e17662deba to your computer and use it in GitHub Desktop.
Save wanchaol/5d7fce6805ec405b1be993e17662deba to your computer and use it in GitHub Desktop.
## first use case
inp = torch.randn(3, 3)
a = torch.jit.script(F.dropout)
a(inp)
## error:
# RuntimeError:
# undefined value _VF:
# at /scratch/wanchaol/local/pytorch/torch/nn/functional.py:800:13
# second use case
class Test(nn.Module):
def __init__(self):
super(Test, self).__init__()
def forward(self, input):
return F.dropout(input)
b = torch.jit.script(Test())
b(inp)
## works well
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment