{"action":"created","comment":{"url":"https://api.github.com/repos/pytorch/pytorch/pulls/comments/167452678","pull_request_review_id":95672569,"id":167452678,"diff_hunk":"@@ -72,8 +72,9 @@ def sample(self, sample_shape=torch.Size()):\n         Generates a sample_shape shaped sample or sample_shape shaped batch of\n         samples if the distribution parameters are batched.\n         \"\"\"\n-        z = self.rsample(sample_shape)\n-        return z.detach() if hasattr(z, 'detach') else z\n+        with torch.no_grad():\n+            x = self.rsample(sample_shape)\n+        return x.detach() if hasattr(x, 'detach') else x","path":"torch/distributions/distribution.py","position":8,"original_position":8,"commit_id":"f2f6cddcccaece3575b8fb544b65d0f698eca14c","original_commit_id":"f2f6cddcccaece3575b8fb544b65d0f698eca14c","user":{"login":"apaszke","id":4583066,"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},"body":"Do you know which distributions had this problem? `x` should never require grad in here","created_at":"2018-02-11T22:31:42Z","updated_at":"2018-02-11T22:31:45Z","html_url":"https://github.com/pytorch/pytorch/pull/5086#discussion_r167452678","pull_request_url":"https://api.github.com/repos/pytorch/pytorch/pulls/5086","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/pytorch/pytorch/pulls/comments/167452678"},"html":{"href":"https://github.com/pytorch/pytorch/pull/5086#discussion_r167452678"},"pull_request":{"href":"https://api.github.com/repos/pytorch/pytorch/pulls/5086"}},"in_reply_to_id":166458372},"pull_request":{"url":"https://api.github.com/repos/pytorch/pytorch/pulls/5086","id":167516563,"html_url":"https://github.com/pytorch/pytorch/pull/5086","diff_url":"https://github.com/pytorch/pytorch/pull/5086.diff","patch_url":"https://github.com/pytorch/pytorch/pull/5086.patch","issue_url":"https://api.github.com/repos/pytorch/pytorch/issues/5086","number":5086,"state":"open","locked":false,"title":"Ensure Distribution.sample() result is detached","user":{"login":"fritzo","id":648532,"avatar_url":"https://avatars0.githubusercontent.com/u/648532?v=4","gravatar_id":"","url":"https://api.github.com/users/fritzo","html_url":"https://github.com/fritzo","followers_url":"https://api.github.com/users/fritzo/followers","following_url":"https://api.github.com/users/fritzo/following{/other_user}","gists_url":"https://api.github.com/users/fritzo/gists{/gist_id}","starred_url":"https://api.github.com/users/fritzo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fritzo/subscriptions","organizations_url":"https://api.github.com/users/fritzo/orgs","repos_url":"https://api.github.com/users/fritzo/repos","events_url":"https://api.github.com/users/fritzo/events{/privacy}","received_events_url":"https://api.github.com/users/fritzo/received_events","type":"User","site_admin":false},"body":"This fixes a bug in `TransformedDistribution` whereby `.sample()` was accidentally reparameterized. It also fixes a couple other minor `.sample()` bugs and adds two tests to distinguish the behavior of `.sample()` and `.rsample()`.\r\n\r\nPrevious review by @alicanb at https://github.com/probtorch/pytorch/pull/125","created_at":"2018-02-06T20:06:33Z","updated_at":"2018-02-11T22:31:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b709781e7c8a9f6270b3e4a9faf0a275a2dade81","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":819357941,"url":"https://api.github.com/repos/pytorch/pytorch/labels/distributions","name":"distributions","color":"39d651","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/pytorch/pytorch/pulls/5086/commits","review_comments_url":"https://api.github.com/repos/pytorch/pytorch/pulls/5086/comments","review_comment_url":"https://api.github.com/repos/pytorch/pytorch/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pytorch/pytorch/issues/5086/comments","statuses_url":"https://api.github.com/repos/pytorch/pytorch/statuses/f2f6cddcccaece3575b8fb544b65d0f698eca14c","head":{"label":"probtorch:detach-sample","ref":"detach-sample","sha":"f2f6cddcccaece3575b8fb544b65d0f698eca14c","user":{"login":"probtorch","id":32777003,"avatar_url":"https://avatars0.githubusercontent.com/u/32777003?v=4","gravatar_id":"","url":"https://api.github.com/users/probtorch","html_url":"https://github.com/probtorch","followers_url":"https://api.github.com/users/probtorch/followers","following_url":"https://api.github.com/users/probtorch/following{/other_user}","gists_url":"https://api.github.com/users/probtorch/gists{/gist_id}","starred_url":"https://api.github.com/users/probtorch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/probtorch/subscriptions","organizations_url":"https://api.github.com/users/probtorch/orgs","repos_url":"https://api.github.com/users/probtorch/repos","events_url":"https://api.github.com/users/probtorch/events{/privacy}","received_events_url":"https://api.github.com/users/probtorch/received_events","type":"Organization","site_admin":false},"repo":{"id":109045956,"name":"pytorch","full_name":"probtorch/pytorch","owner":{"login":"probtorch","id":32777003,"avatar_url":"https://avatars0.githubusercontent.com/u/32777003?v=4","gravatar_id":"","url":"https://api.github.com/users/probtorch","html_url":"https://github.com/probtorch","followers_url":"https://api.github.com/users/probtorch/followers","following_url":"https://api.github.com/users/probtorch/following{/other_user}","gists_url":"https://api.github.com/users/probtorch/gists{/gist_id}","starred_url":"https://api.github.com/users/probtorch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/probtorch/subscriptions","organizations_url":"https://api.github.com/users/probtorch/orgs","repos_url":"https://api.github.com/users/probtorch/repos","events_url":"https://api.github.com/users/probtorch/events{/privacy}","received_events_url":"https://api.github.com/users/probtorch/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/probtorch/pytorch","description":"Tensors and Dynamic neural networks in Python  with strong GPU acceleration","fork":true,"url":"https://api.github.com/repos/probtorch/pytorch","forks_url":"https://api.github.com/repos/probtorch/pytorch/forks","keys_url":"https://api.github.com/repos/probtorch/pytorch/keys{/key_id}","collaborators_url":"https://api.github.com/repos/probtorch/pytorch/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/probtorch/pytorch/teams","hooks_url":"https://api.github.com/repos/probtorch/pytorch/hooks","issue_events_url":"https://api.github.com/repos/probtorch/pytorch/issues/events{/number}","events_url":"https://api.github.com/repos/probtorch/pytorch/events","assignees_url":"https://api.github.com/repos/probtorch/pytorch/assignees{/user}","branches_url":"https://api.github.com/repos/probtorch/pytorch/branches{/branch}","tags_url":"https://api.github.com/repos/probtorch/pytorch/tags","blobs_url":"https://api.github.com/repos/probtorch/pytorch/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/probtorch/pytorch/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/probtorch/pytorch/git/refs{/sha}","trees_url":"https://api.github.com/repos/probtorch/pytorch/git/trees{/sha}","statuses_url":"https://api.github.com/repos/probtorch/pytorch/statuses/{sha}","languages_url":"https://api.github.com/repos/probtorch/pytorch/languages","stargazers_url":"https://api.github.com/repos/probtorch/pytorch/stargazers","contributors_url":"https://api.github.com/repos/probtorch/pytorch/contributors","subscribers_url":"https://api.github.com/repos/probtorch/pytorch/subscribers","subscription_url":"https://api.github.com/repos/probtorch/pytorch/subscription","commits_url":"https://api.github.com/repos/probtorch/pytorch/commits{/sha}","git_commits_url":"https://api.github.com/repos/probtorch/pytorch/git/commits{/sha}","comments_url":"https://api.github.com/repos/probtorch/pytorch/comments{/number}","issue_comment_url":"https://api.github.com/repos/probtorch/pytorch/issues/comments{/number}","contents_url":"https://api.github.com/repos/probtorch/pytorch/contents/{+path}","compare_url":"https://api.github.com/repos/probtorch/pytorch/compare/{base}...{head}","merges_url":"https://api.github.com/repos/probtorch/pytorch/merges","archive_url":"https://api.github.com/repos/probtorch/pytorch/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/probtorch/pytorch/downloads","issues_url":"https://api.github.com/repos/probtorch/pytorch/issues{/number}","pulls_url":"https://api.github.com/repos/probtorch/pytorch/pulls{/number}","milestones_url":"https://api.github.com/repos/probtorch/pytorch/milestones{/number}","notifications_url":"https://api.github.com/repos/probtorch/pytorch/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/probtorch/pytorch/labels{/name}","releases_url":"https://api.github.com/repos/probtorch/pytorch/releases{/id}","deployments_url":"https://api.github.com/repos/probtorch/pytorch/deployments","created_at":"2017-10-31T19:57:13Z","updated_at":"2017-12-13T15:29:39Z","pushed_at":"2018-02-11T02:05:09Z","git_url":"git://github.com/probtorch/pytorch.git","ssh_url":"git@github.com:probtorch/pytorch.git","clone_url":"https://github.com/probtorch/pytorch.git","svn_url":"https://github.com/probtorch/pytorch","homepage":"http://pytorch.org","size":22841,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":30,"license":null,"forks":2,"open_issues":30,"watchers":2,"default_branch":"master"}},"base":{"label":"pytorch:master","ref":"master","sha":"4ad7fab16e814dc8077210a127317ec3ac620967","user":{"login":"pytorch","id":21003710,"avatar_url":"https://avatars3.githubusercontent.com/u/21003710?v=4","gravatar_id":"","url":"https://api.github.com/users/pytorch","html_url":"https://github.com/pytorch","followers_url":"https://api.github.com/users/pytorch/followers","following_url":"https://api.github.com/users/pytorch/following{/other_user}","gists_url":"https://api.github.com/users/pytorch/gists{/gist_id}","starred_url":"https://api.github.com/users/pytorch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pytorch/subscriptions","organizations_url":"https://api.github.com/users/pytorch/orgs","repos_url":"https://api.github.com/users/pytorch/repos","events_url":"https://api.github.com/users/pytorch/events{/privacy}","received_events_url":"https://api.github.com/users/pytorch/received_events","type":"Organization","site_admin":false},"repo":{"id":65600975,"name":"pytorch","full_name":"pytorch/pytorch","owner":{"login":"pytorch","id":21003710,"avatar_url":"https://avatars3.githubusercontent.com/u/21003710?v=4","gravatar_id":"","url":"https://api.github.com/users/pytorch","html_url":"https://github.com/pytorch","followers_url":"https://api.github.com/users/pytorch/followers","following_url":"https://api.github.com/users/pytorch/following{/other_user}","gists_url":"https://api.github.com/users/pytorch/gists{/gist_id}","starred_url":"https://api.github.com/users/pytorch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pytorch/subscriptions","organizations_url":"https://api.github.com/users/pytorch/orgs","repos_url":"https://api.github.com/users/pytorch/repos","events_url":"https://api.github.com/users/pytorch/events{/privacy}","received_events_url":"https://api.github.com/users/pytorch/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pytorch/pytorch","description":"Tensors and Dynamic neural networks in Python  with strong GPU acceleration","fork":false,"url":"https://api.github.com/repos/pytorch/pytorch","forks_url":"https://api.github.com/repos/pytorch/pytorch/forks","keys_url":"https://api.github.com/repos/pytorch/pytorch/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pytorch/pytorch/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pytorch/pytorch/teams","hooks_url":"https://api.github.com/repos/pytorch/pytorch/hooks","issue_events_url":"https://api.github.com/repos/pytorch/pytorch/issues/events{/number}","events_url":"https://api.github.com/repos/pytorch/pytorch/events","assignees_url":"https://api.github.com/repos/pytorch/pytorch/assignees{/user}","branches_url":"https://api.github.com/repos/pytorch/pytorch/branches{/branch}","tags_url":"https://api.github.com/repos/pytorch/pytorch/tags","blobs_url":"https://api.github.com/repos/pytorch/pytorch/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pytorch/pytorch/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pytorch/pytorch/git/refs{/sha}","trees_url":"https://api.github.com/repos/pytorch/pytorch/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pytorch/pytorch/statuses/{sha}","languages_url":"https://api.github.com/repos/pytorch/pytorch/languages","stargazers_url":"https://api.github.com/repos/pytorch/pytorch/stargazers","contributors_url":"https://api.github.com/repos/pytorch/pytorch/contributors","subscribers_url":"https://api.github.com/repos/pytorch/pytorch/subscribers","subscription_url":"https://api.github.com/repos/pytorch/pytorch/subscription","commits_url":"https://api.github.com/repos/pytorch/pytorch/commits{/sha}","git_commits_url":"https://api.github.com/repos/pytorch/pytorch/git/commits{/sha}","comments_url":"https://api.github.com/repos/pytorch/pytorch/comments{/number}","issue_comment_url":"https://api.github.com/repos/pytorch/pytorch/issues/comments{/number}","contents_url":"https://api.github.com/repos/pytorch/pytorch/contents/{+path}","compare_url":"https://api.github.com/repos/pytorch/pytorch/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pytorch/pytorch/merges","archive_url":"https://api.github.com/repos/pytorch/pytorch/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pytorch/pytorch/downloads","issues_url":"https://api.github.com/repos/pytorch/pytorch/issues{/number}","pulls_url":"https://api.github.com/repos/pytorch/pytorch/pulls{/number}","milestones_url":"https://api.github.com/repos/pytorch/pytorch/milestones{/number}","notifications_url":"https://api.github.com/repos/pytorch/pytorch/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pytorch/pytorch/labels{/name}","releases_url":"https://api.github.com/repos/pytorch/pytorch/releases{/id}","deployments_url":"https://api.github.com/repos/pytorch/pytorch/deployments","created_at":"2016-08-13T05:26:41Z","updated_at":"2018-02-11T22:31:07Z","pushed_at":"2018-02-11T21:59:30Z","git_url":"git://github.com/pytorch/pytorch.git","ssh_url":"git@github.com:pytorch/pytorch.git","clone_url":"https://github.com/pytorch/pytorch.git","svn_url":"https://github.com/pytorch/pytorch","homepage":"http://pytorch.org","size":22456,"stargazers_count":12181,"watchers_count":12181,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2538,"mirror_url":null,"archived":false,"open_issues_count":721,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":2538,"open_issues":721,"watchers":12181,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pytorch/pytorch/pulls/5086"},"html":{"href":"https://github.com/pytorch/pytorch/pull/5086"},"issue":{"href":"https://api.github.com/repos/pytorch/pytorch/issues/5086"},"comments":{"href":"https://api.github.com/repos/pytorch/pytorch/issues/5086/comments"},"review_comments":{"href":"https://api.github.com/repos/pytorch/pytorch/pulls/5086/comments"},"review_comment":{"href":"https://api.github.com/repos/pytorch/pytorch/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pytorch/pytorch/pulls/5086/commits"},"statuses":{"href":"https://api.github.com/repos/pytorch/pytorch/statuses/f2f6cddcccaece3575b8fb544b65d0f698eca14c"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"apaszke"}}