{"action":"created","issue":{"url":"https://api.github.com/repos/pytorch/pytorch/issues/7329","repository_url":"https://api.github.com/repos/pytorch/pytorch","labels_url":"https://api.github.com/repos/pytorch/pytorch/issues/7329/labels{/name}","comments_url":"https://api.github.com/repos/pytorch/pytorch/issues/7329/comments","events_url":"https://api.github.com/repos/pytorch/pytorch/issues/7329/events","html_url":"https://github.com/pytorch/pytorch/issues/7329","id":320603274,"node_id":"MDU6SXNzdWUzMjA2MDMyNzQ=","number":7329,"title":"pytorch 0.4.  RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation","user":{"login":"ofirlevy","id":15832766,"node_id":"MDQ6VXNlcjE1ODMyNzY2","avatar_url":"https://avatars2.githubusercontent.com/u/15832766?v=4","gravatar_id":"","url":"https://api.github.com/users/ofirlevy","html_url":"https://github.com/ofirlevy","followers_url":"https://api.github.com/users/ofirlevy/followers","following_url":"https://api.github.com/users/ofirlevy/following{/other_user}","gists_url":"https://api.github.com/users/ofirlevy/gists{/gist_id}","starred_url":"https://api.github.com/users/ofirlevy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ofirlevy/subscriptions","organizations_url":"https://api.github.com/users/ofirlevy/orgs","repos_url":"https://api.github.com/users/ofirlevy/repos","events_url":"https://api.github.com/users/ofirlevy/events{/privacy}","received_events_url":"https://api.github.com/users/ofirlevy/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-05-06T15:42:46Z","updated_at":"2018-08-23T05:35:39Z","closed_at":"2018-05-17T21:48:50Z","author_association":"NONE","body":"The MobileNet V2. repo located [here](https://github.com/MG2033/MobileNet-V2) is running flawlessly on pytorch 0.3 but failed on the new 0.4 version with \r\n```\r\nRuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation. \r\n```\r\nwhen it calls backward().\r\n\r\nI followed the migration guide but still couldn't point my finger on the problematic code.  I would highly appreciate your help\r\n\r\nThe train code:\r\n```\r\nfor data, target in tqdm_batch:            \r\n    data, target = data.cuda(), target.cuda()                \r\n    # Forward pass\r\n    output = self.model(data)\r\n    cur_loss= self.loss(output, target)\r\n   # Optimization step\r\n    self.optimizer.zero_grad()\r\n    cur_loss.backward()\r\n    self.optimizer.step()\r\n``` \r\n\r\ninstead of placing the network here It is more convenient to look at it in the github: [network](https://github.com/MG2033/MobileNet-V2/blob/master/model.py) and its [layers](https://github.com/MG2033/MobileNet-V2/blob/master/layers.py)"},"comment":{"url":"https://api.github.com/repos/pytorch/pytorch/issues/comments/415297001","html_url":"https://github.com/pytorch/pytorch/issues/7329#issuecomment-415297001","issue_url":"https://api.github.com/repos/pytorch/pytorch/issues/7329","id":415297001,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNTI5NzAwMQ==","user":{"login":"wenwei202","id":12142066,"node_id":"MDQ6VXNlcjEyMTQyMDY2","avatar_url":"https://avatars0.githubusercontent.com/u/12142066?v=4","gravatar_id":"","url":"https://api.github.com/users/wenwei202","html_url":"https://github.com/wenwei202","followers_url":"https://api.github.com/users/wenwei202/followers","following_url":"https://api.github.com/users/wenwei202/following{/other_user}","gists_url":"https://api.github.com/users/wenwei202/gists{/gist_id}","starred_url":"https://api.github.com/users/wenwei202/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wenwei202/subscriptions","organizations_url":"https://api.github.com/users/wenwei202/orgs","repos_url":"https://api.github.com/users/wenwei202/repos","events_url":"https://api.github.com/users/wenwei202/events{/privacy}","received_events_url":"https://api.github.com/users/wenwei202/received_events","type":"User","site_admin":false},"created_at":"2018-08-23T05:35:39Z","updated_at":"2018-08-23T05:35:39Z","author_association":"MEMBER","body":"Using the same code, when update to 0.4 from 0.3, I popped up this issue. Does it mean 0.3.0 got the wrong gradients because of some bugs?"}}
{"actor":{"display_login":"wenwei202"}}