{"action":"created","issue":{"url":"https://api.github.com/repos/pytorch/pytorch/issues/12502","repository_url":"https://api.github.com/repos/pytorch/pytorch","labels_url":"https://api.github.com/repos/pytorch/pytorch/issues/12502/labels{/name}","comments_url":"https://api.github.com/repos/pytorch/pytorch/issues/12502/comments","events_url":"https://api.github.com/repos/pytorch/pytorch/issues/12502/events","html_url":"https://github.com/pytorch/pytorch/pull/12502","id":368408116,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIxNTkzNjA3","number":12502,"title":"Differentiable and Non-differentiable Views","user":{"login":"SsnL","id":5674597,"node_id":"MDQ6VXNlcjU2NzQ1OTc=","avatar_url":"https://avatars2.githubusercontent.com/u/5674597?v=4","gravatar_id":"","url":"https://api.github.com/users/SsnL","html_url":"https://github.com/SsnL","followers_url":"https://api.github.com/users/SsnL/followers","following_url":"https://api.github.com/users/SsnL/following{/other_user}","gists_url":"https://api.github.com/users/SsnL/gists{/gist_id}","starred_url":"https://api.github.com/users/SsnL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SsnL/subscriptions","organizations_url":"https://api.github.com/users/SsnL/orgs","repos_url":"https://api.github.com/users/SsnL/repos","events_url":"https://api.github.com/users/SsnL/events{/privacy}","received_events_url":"https://api.github.com/users/SsnL/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2018-10-09T21:36:01Z","updated_at":"2018-10-14T19:56:32Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/pytorch/pytorch/pulls/12502","html_url":"https://github.com/pytorch/pytorch/pull/12502","diff_url":"https://github.com/pytorch/pytorch/pull/12502.diff","patch_url":"https://github.com/pytorch/pytorch/pull/12502.patch"},"body":"Fixes https://github.com/pytorch/pytorch/issues/11390. \r\n\r\nThis PR introduces the idea of non-differentiable views. A non-differentiable is a view that shares storage with the base variable, but gradient should never flow through the view relation. This includes:\r\n1. .detach()\r\n2. Views created when GradMode is disabled\r\n3. Views that are non-differentiable by nature, e.g., `sparse_tensor.indices()` (This is being added in #11253. I base #11253 on this and update the note in that PR.)\r\n\r\nSee the note in this PR for details.\r\n\r\n\r\ncc @colesbury @apaszke @gchanan "},"comment":{"url":"https://api.github.com/repos/pytorch/pytorch/issues/comments/429657130","html_url":"https://github.com/pytorch/pytorch/pull/12502#issuecomment-429657130","issue_url":"https://api.github.com/repos/pytorch/pytorch/issues/12502","id":429657130,"node_id":"MDEyOklzc3VlQ29tbWVudDQyOTY1NzEzMA==","user":{"login":"apaszke","id":4583066,"node_id":"MDQ6VXNlcjQ1ODMwNjY=","avatar_url":"https://avatars3.githubusercontent.com/u/4583066?v=4","gravatar_id":"","url":"https://api.github.com/users/apaszke","html_url":"https://github.com/apaszke","followers_url":"https://api.github.com/users/apaszke/followers","following_url":"https://api.github.com/users/apaszke/following{/other_user}","gists_url":"https://api.github.com/users/apaszke/gists{/gist_id}","starred_url":"https://api.github.com/users/apaszke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apaszke/subscriptions","organizations_url":"https://api.github.com/users/apaszke/orgs","repos_url":"https://api.github.com/users/apaszke/repos","events_url":"https://api.github.com/users/apaszke/events{/privacy}","received_events_url":"https://api.github.com/users/apaszke/received_events","type":"User","site_admin":false},"created_at":"2018-10-14T19:56:32Z","updated_at":"2018-10-14T19:56:32Z","author_association":"MEMBER","body":"I agree that the view should not start tracking gradient, but the problem is that the fact that it's a view and aliases other values that live entirely in `with_grad` regions might cause us to miss some differentiable connections. I don't think it's very intuitive.\r\n\r\n@colesbury when you argued for introducing gradient context managers, your main argument was that \"whether you want to differentiate is a property of the code region and not data that's flowing inside it\". That's very reasonable and I agreed. In this case however, we're pushing this \"should you differentiate\" decision back to the data part (to the fact how Variables are wired), which outlives the context managers. I'm still unconvinced that this is how this should work."}}
{"actor":{"display_login":"apaszke"}}