{"action":"opened","issue":{"url":"https://api.github.com/repos/pytorch/pytorch/issues/7069","repository_url":"https://api.github.com/repos/pytorch/pytorch","labels_url":"https://api.github.com/repos/pytorch/pytorch/issues/7069/labels{/name}","comments_url":"https://api.github.com/repos/pytorch/pytorch/issues/7069/comments","events_url":"https://api.github.com/repos/pytorch/pytorch/issues/7069/events","html_url":"https://github.com/pytorch/pytorch/issues/7069","id":318634945,"number":7069,"title":"JIT error with dropout: Function.apply returned the wrong number of outputs","user":{"login":"deepbrain","id":10003025,"avatar_url":"https://avatars3.githubusercontent.com/u/10003025?v=4","gravatar_id":"","url":"https://api.github.com/users/deepbrain","html_url":"https://github.com/deepbrain","followers_url":"https://api.github.com/users/deepbrain/followers","following_url":"https://api.github.com/users/deepbrain/following{/other_user}","gists_url":"https://api.github.com/users/deepbrain/gists{/gist_id}","starred_url":"https://api.github.com/users/deepbrain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deepbrain/subscriptions","organizations_url":"https://api.github.com/users/deepbrain/orgs","repos_url":"https://api.github.com/users/deepbrain/repos","events_url":"https://api.github.com/users/deepbrain/events{/privacy}","received_events_url":"https://api.github.com/users/deepbrain/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-04-28T13:03:43Z","updated_at":"2018-04-28T13:03:43Z","closed_at":null,"author_association":"NONE","body":"## Issue description\r\n\r\nin a simple test network I get an error when dropout layer is included (error does not happen when the dropout layer is excluded):\r\n\r\nTraceback (most recent call last):\r\n  File \"testnet.py\", line 48, in <module>\r\n    r = net(V)\r\nRuntimeError: \r\nFunction.apply returned the wrong number of outputs.:\r\noperation failed in interpreter:\r\n/home/tester/anaconda3/lib/python3.6/site-packages/torch/nn/functional.py(554): dropout\r\n/home/tester/anaconda3/lib/python3.6/site-packages/torch/nn/modules/dropout.py(53): forward\r\n/home/tester/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py(491): __call__\r\ntestnet.py(25): forward\r\ntestnet.py(48): <module>\r\n\r\n## Code example\r\n\r\n```python\r\nimport torch\r\nfrom torch import jit\r\nimport torch.nn as nn\r\nfrom torch.autograd import Variable\r\nimport torch.optim as optim........\r\n\r\n  \r\n@torch.jit.compile(nderivs=1)\r\nclass TestNet(nn.Module):\r\n    def __init__(self):\r\n        super(TestNet, self).__init__()\r\n        self.net1 = nn.Linear(100, 200)\r\n        self.net2 = nn.Linear(200, 1)\r\n        self.bn = nn.BatchNorm1d(200)\r\n        self.sigmoid = nn.Sigmoid()\r\n        self.ReLU = nn.ReLU(inplace=False)\r\n        self.drop = nn.Dropout(0.5)\r\n    def forward(self, V):\r\n        return self.sigmoid(self.net2(self.drop(self.ReLU(self.bn(self.net1(V)))\r\n#        return self.sigmoid(self.net2(self.ReLU(self.bn(self.net1(V))))).squeez\r\n\r\n\r\nuse_cuda = False\r\nnet = TestNet()\r\ncriterion = nn.BCELoss()\r\nif use_cuda:\r\n    net.cuda()\r\n    criterion.cuda()\r\n    V = Variable(torch.randn(100, 100)).cuda()\r\n    label = Variable(torch.randn(100)).cuda()\r\nelse:\r\n    V = Variable(torch.randn(100, 100))\r\n    label = Variable(torch.randn(100))\r\n\r\noptim_betas = (0.9, 0.999)\r\noptimizer = optim.Adam(filter(lambda p: p.requires_grad, net.parameters()), lr=0.01, betas=optim_betas)\r\ncriterion = nn.BCELoss()\r\n\r\nnet.train()\r\nfor i in range(0,1000000):\r\n    net.zero_grad()\r\n    r = net(V)\r\n    err = criterion(r, label)\r\n    err.backward()...\r\n\r\noptim_betas = (0.9, 0.999)\r\noptimizer = optim.Adam(filter(lambda p: p.requires_grad, net.parameters()), lr=0\r\ncriterion = nn.BCELoss()\r\n```\r\n\r\n## System Info\r\nPyTorch version: 0.5.0a0+59f5f9a\r\nIs debug build: No\r\nCUDA used to build PyTorch: None\r\n\r\nOS: Ubuntu 16.04.4 LTS\r\nGCC version: (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609\r\nCMake version: version 3.9.4\r\n\r\nPython version: 3.6\r\nIs CUDA available: No\r\nCUDA runtime version: No CUDA\r\nGPU models and configuration: No CUDA\r\nNvidia driver version: No CUDA\r\ncuDNN version: No CUDA\r\n\r\nVersions of relevant libraries:\r\n[pip] numpy (1.14.0)\r\n[pip] numpydoc (0.7.0)\r\n[pip] torch (0.5.0a0+59f5f9a)\r\n[conda] magma-cuda80              2.3.0                         1    pytorch\r\n[conda] torch                     0.5.0a0+59f5f9a           <pip>\r\n\r\n"}}
{"actor":{"display_login":"deepbrain"}}