{"action":"created","comment":{"url":"https://api.github.com/repos/pytorch/pytorch/pulls/comments/199572219","pull_request_review_id":133717959,"id":199572219,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5OTU3MjIxOQ==","diff_hunk":"@@ -142,28 +135,34 @@ THStorage* THStorage_(newWithDataAndAllocator)(real* data, ptrdiff_t size,\n                                                THAllocator* allocator,\n                                                void* allocatorContext) {\n   THStorage *storage = static_cast<THStorage*>(THAlloc(sizeof(THStorage)));\n+  storage->backend = at::kCPU;\n   storage->scalar_type = at::CTypeToScalarType<th::from_type<real>>::to();\n   storage->data_ptr = data;\n   storage->size = size;\n   storage->refcount = 1;\n   storage->flag = TH_STORAGE_REFCOUNTED | TH_STORAGE_RESIZABLE | TH_STORAGE_FREEMEM;\n-  storage->allocator = allocator;\n+  storage->allocatorVoidPtr = allocator;\n   storage->allocatorContext = allocatorContext;\n+  storage->device = 0;\n   return storage;\n }\n \n void THStorage_(resize)(THStorage *storage, ptrdiff_t size)\n {\n+  AT_ASSERT(storage->backend == at::kCPU);","path":"aten/src/TH/generic/THStorage.cpp","position":53,"original_position":53,"commit_id":"79142a0ec0a31353b7bfb07863ae1b6fda24c39c","original_commit_id":"79142a0ec0a31353b7bfb07863ae1b6fda24c39c","user":{"login":"gchanan","id":3768583,"node_id":"MDQ6VXNlcjM3Njg1ODM=","avatar_url":"https://avatars2.githubusercontent.com/u/3768583?v=4","gravatar_id":"","url":"https://api.github.com/users/gchanan","html_url":"https://github.com/gchanan","followers_url":"https://api.github.com/users/gchanan/followers","following_url":"https://api.github.com/users/gchanan/following{/other_user}","gists_url":"https://api.github.com/users/gchanan/gists{/gist_id}","starred_url":"https://api.github.com/users/gchanan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gchanan/subscriptions","organizations_url":"https://api.github.com/users/gchanan/orgs","repos_url":"https://api.github.com/users/gchanan/repos","events_url":"https://api.github.com/users/gchanan/events{/privacy}","received_events_url":"https://api.github.com/users/gchanan/received_events","type":"User","site_admin":false},"body":"sounds fine.","created_at":"2018-07-02T17:44:11Z","updated_at":"2018-07-02T17:44:11Z","html_url":"https://github.com/pytorch/pytorch/pull/9087#discussion_r199572219","pull_request_url":"https://api.github.com/repos/pytorch/pytorch/pulls/9087","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/pytorch/pytorch/pulls/comments/199572219"},"html":{"href":"https://github.com/pytorch/pytorch/pull/9087#discussion_r199572219"},"pull_request":{"href":"https://api.github.com/repos/pytorch/pytorch/pulls/9087"}},"in_reply_to_id":199534893},"pull_request":{"url":"https://api.github.com/repos/pytorch/pytorch/pulls/9087","id":198555406,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk4NTU1NDA2","html_url":"https://github.com/pytorch/pytorch/pull/9087","diff_url":"https://github.com/pytorch/pytorch/pull/9087.diff","patch_url":"https://github.com/pytorch/pytorch/pull/9087.patch","issue_url":"https://api.github.com/repos/pytorch/pytorch/issues/9087","number":9087,"state":"open","locked":false,"title":"Unify THStorage and THCStorage structs.","user":{"login":"ezyang","id":13564,"node_id":"MDQ6VXNlcjEzNTY0","avatar_url":"https://avatars0.githubusercontent.com/u/13564?v=4","gravatar_id":"","url":"https://api.github.com/users/ezyang","html_url":"https://github.com/ezyang","followers_url":"https://api.github.com/users/ezyang/followers","following_url":"https://api.github.com/users/ezyang/following{/other_user}","gists_url":"https://api.github.com/users/ezyang/gists{/gist_id}","starred_url":"https://api.github.com/users/ezyang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ezyang/subscriptions","organizations_url":"https://api.github.com/users/ezyang/orgs","repos_url":"https://api.github.com/users/ezyang/repos","events_url":"https://api.github.com/users/ezyang/events{/privacy}","received_events_url":"https://api.github.com/users/ezyang/received_events","type":"User","site_admin":false},"body":"Some details about how this was done:\r\n\r\n- For now, the allocators for CPU and CUDA are different (unifying\r\n  the allocators is a bigger change to make, I'll contribute this in\r\n  a later patch).  To smooth this over, the allocator field now\r\n  stores a void* instead of THAllocator* or THCDeviceAllocator*; to\r\n  make this clear the field is renamed to allocatorVoidPtr.\r\n\r\n- Some THStorage functions which were generated per-scalar are now\r\n  generalized, and thus moved out of the generic/ library.  This way\r\n  they can be called directly from a non-code-generated at::Storage\r\n\r\n- THCState is moved into a C++ header.  This is actually not really\r\n  related to this particular diff, but I'll need it soon to replace\r\n  THAllocator/THCDeviceAllocator with at::Allocator (C++, so I can't\r\n  mention it in a C header file.)\r\n\r\n- THPPointer needs to be adjusted, since there is no more type refinement\r\n  between THStorage/THCStorage for it to template match over.  This\r\n  is a little tricky, because I can't refer to THCStorage_free unless\r\n  we actually compile with CUDA.  So there's two copies of the function\r\n  now: one for the CPU build, one for the CUDA build.  If we ever split\r\n  CUDA/non-CUDA Python builds, you will have to indirect this through some\r\n  dynamic dispatch.\r\n\r\nI want to soon replace the THCDeviceAllocator pointers in\r\nTHCState with at::Allocator, but I can't reference a C++ namespaced type\r\nfrom C code, so THCState needs to move.\r\n\r\nSigned-off-by: Edward Z. Yang <ezyang@fb.com>\r\n\r\n","created_at":"2018-07-02T01:41:57Z","updated_at":"2018-07-02T17:44:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"889cdfd23e12d07acf3fbc20d13ba9552faf8c0d","assignee":null,"assignees":[],"requested_reviewers":[{"login":"zdevito","id":370202,"node_id":"MDQ6VXNlcjM3MDIwMg==","avatar_url":"https://avatars0.githubusercontent.com/u/370202?v=4","gravatar_id":"","url":"https://api.github.com/users/zdevito","html_url":"https://github.com/zdevito","followers_url":"https://api.github.com/users/zdevito/followers","following_url":"https://api.github.com/users/zdevito/following{/other_user}","gists_url":"https://api.github.com/users/zdevito/gists{/gist_id}","starred_url":"https://api.github.com/users/zdevito/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zdevito/subscriptions","organizations_url":"https://api.github.com/users/zdevito/orgs","repos_url":"https://api.github.com/users/zdevito/repos","events_url":"https://api.github.com/users/zdevito/events{/privacy}","received_events_url":"https://api.github.com/users/zdevito/received_events","type":"User","site_admin":false},{"login":"colesbury","id":655866,"node_id":"MDQ6VXNlcjY1NTg2Ng==","avatar_url":"https://avatars1.githubusercontent.com/u/655866?v=4","gravatar_id":"","url":"https://api.github.com/users/colesbury","html_url":"https://github.com/colesbury","followers_url":"https://api.github.com/users/colesbury/followers","following_url":"https://api.github.com/users/colesbury/following{/other_user}","gists_url":"https://api.github.com/users/colesbury/gists{/gist_id}","starred_url":"https://api.github.com/users/colesbury/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/colesbury/subscriptions","organizations_url":"https://api.github.com/users/colesbury/orgs","repos_url":"https://api.github.com/users/colesbury/repos","events_url":"https://api.github.com/users/colesbury/events{/privacy}","received_events_url":"https://api.github.com/users/colesbury/received_events","type":"User","site_admin":false},{"login":"soumith","id":1310570,"node_id":"MDQ6VXNlcjEzMTA1NzA=","avatar_url":"https://avatars0.githubusercontent.com/u/1310570?v=4","gravatar_id":"","url":"https://api.github.com/users/soumith","html_url":"https://github.com/soumith","followers_url":"https://api.github.com/users/soumith/followers","following_url":"https://api.github.com/users/soumith/following{/other_user}","gists_url":"https://api.github.com/users/soumith/gists{/gist_id}","starred_url":"https://api.github.com/users/soumith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/soumith/subscriptions","organizations_url":"https://api.github.com/users/soumith/orgs","repos_url":"https://api.github.com/users/soumith/repos","events_url":"https://api.github.com/users/soumith/events{/privacy}","received_events_url":"https://api.github.com/users/soumith/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/pytorch/pytorch/pulls/9087/commits","review_comments_url":"https://api.github.com/repos/pytorch/pytorch/pulls/9087/comments","review_comment_url":"https://api.github.com/repos/pytorch/pytorch/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pytorch/pytorch/issues/9087/comments","statuses_url":"https://api.github.com/repos/pytorch/pytorch/statuses/79142a0ec0a31353b7bfb07863ae1b6fda24c39c","head":{"label":"ezyang:pr/unify-th-thc-storage","ref":"pr/unify-th-thc-storage","sha":"79142a0ec0a31353b7bfb07863ae1b6fda24c39c","user":{"login":"ezyang","id":13564,"node_id":"MDQ6VXNlcjEzNTY0","avatar_url":"https://avatars0.githubusercontent.com/u/13564?v=4","gravatar_id":"","url":"https://api.github.com/users/ezyang","html_url":"https://github.com/ezyang","followers_url":"https://api.github.com/users/ezyang/followers","following_url":"https://api.github.com/users/ezyang/following{/other_user}","gists_url":"https://api.github.com/users/ezyang/gists{/gist_id}","starred_url":"https://api.github.com/users/ezyang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ezyang/subscriptions","organizations_url":"https://api.github.com/users/ezyang/orgs","repos_url":"https://api.github.com/users/ezyang/repos","events_url":"https://api.github.com/users/ezyang/events{/privacy}","received_events_url":"https://api.github.com/users/ezyang/received_events","type":"User","site_admin":false},"repo":{"id":101798885,"node_id":"MDEwOlJlcG9zaXRvcnkxMDE3OTg4ODU=","name":"pytorch-1","full_name":"ezyang/pytorch-1","owner":{"login":"ezyang","id":13564,"node_id":"MDQ6VXNlcjEzNTY0","avatar_url":"https://avatars0.githubusercontent.com/u/13564?v=4","gravatar_id":"","url":"https://api.github.com/users/ezyang","html_url":"https://github.com/ezyang","followers_url":"https://api.github.com/users/ezyang/followers","following_url":"https://api.github.com/users/ezyang/following{/other_user}","gists_url":"https://api.github.com/users/ezyang/gists{/gist_id}","starred_url":"https://api.github.com/users/ezyang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ezyang/subscriptions","organizations_url":"https://api.github.com/users/ezyang/orgs","repos_url":"https://api.github.com/users/ezyang/repos","events_url":"https://api.github.com/users/ezyang/events{/privacy}","received_events_url":"https://api.github.com/users/ezyang/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ezyang/pytorch-1","description":"Tensors and Dynamic neural networks in Python  with strong GPU acceleration","fork":true,"url":"https://api.github.com/repos/ezyang/pytorch-1","forks_url":"https://api.github.com/repos/ezyang/pytorch-1/forks","keys_url":"https://api.github.com/repos/ezyang/pytorch-1/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ezyang/pytorch-1/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ezyang/pytorch-1/teams","hooks_url":"https://api.github.com/repos/ezyang/pytorch-1/hooks","issue_events_url":"https://api.github.com/repos/ezyang/pytorch-1/issues/events{/number}","events_url":"https://api.github.com/repos/ezyang/pytorch-1/events","assignees_url":"https://api.github.com/repos/ezyang/pytorch-1/assignees{/user}","branches_url":"https://api.github.com/repos/ezyang/pytorch-1/branches{/branch}","tags_url":"https://api.github.com/repos/ezyang/pytorch-1/tags","blobs_url":"https://api.github.com/repos/ezyang/pytorch-1/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ezyang/pytorch-1/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ezyang/pytorch-1/git/refs{/sha}","trees_url":"https://api.github.com/repos/ezyang/pytorch-1/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ezyang/pytorch-1/statuses/{sha}","languages_url":"https://api.github.com/repos/ezyang/pytorch-1/languages","stargazers_url":"https://api.github.com/repos/ezyang/pytorch-1/stargazers","contributors_url":"https://api.github.com/repos/ezyang/pytorch-1/contributors","subscribers_url":"https://api.github.com/repos/ezyang/pytorch-1/subscribers","subscription_url":"https://api.github.com/repos/ezyang/pytorch-1/subscription","commits_url":"https://api.github.com/repos/ezyang/pytorch-1/commits{/sha}","git_commits_url":"https://api.github.com/repos/ezyang/pytorch-1/git/commits{/sha}","comments_url":"https://api.github.com/repos/ezyang/pytorch-1/comments{/number}","issue_comment_url":"https://api.github.com/repos/ezyang/pytorch-1/issues/comments{/number}","contents_url":"https://api.github.com/repos/ezyang/pytorch-1/contents/{+path}","compare_url":"https://api.github.com/repos/ezyang/pytorch-1/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ezyang/pytorch-1/merges","archive_url":"https://api.github.com/repos/ezyang/pytorch-1/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ezyang/pytorch-1/downloads","issues_url":"https://api.github.com/repos/ezyang/pytorch-1/issues{/number}","pulls_url":"https://api.github.com/repos/ezyang/pytorch-1/pulls{/number}","milestones_url":"https://api.github.com/repos/ezyang/pytorch-1/milestones{/number}","notifications_url":"https://api.github.com/repos/ezyang/pytorch-1/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ezyang/pytorch-1/labels{/name}","releases_url":"https://api.github.com/repos/ezyang/pytorch-1/releases{/id}","deployments_url":"https://api.github.com/repos/ezyang/pytorch-1/deployments","created_at":"2017-08-29T19:28:39Z","updated_at":"2018-06-20T19:44:23Z","pushed_at":"2018-07-02T02:58:10Z","git_url":"git://github.com/ezyang/pytorch-1.git","ssh_url":"git@github.com:ezyang/pytorch-1.git","clone_url":"https://github.com/ezyang/pytorch-1.git","svn_url":"https://github.com/ezyang/pytorch-1","homepage":"http://pytorch.org","size":62058,"stargazers_count":1,"watchers_count":1,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"pytorch:master","ref":"master","sha":"8364470e5c8bbe93a7ad196320192e4492d8ec9e","user":{"login":"pytorch","id":21003710,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIxMDAzNzEw","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,"node_id":"MDEwOlJlcG9zaXRvcnk2NTYwMDk3NQ==","name":"pytorch","full_name":"pytorch/pytorch","owner":{"login":"pytorch","id":21003710,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIxMDAzNzEw","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-07-02T17:42:07Z","pushed_at":"2018-07-02T17:41:17Z","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":61466,"stargazers_count":16802,"watchers_count":16802,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3875,"mirror_url":null,"archived":false,"open_issues_count":1360,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":3875,"open_issues":1360,"watchers":16802,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pytorch/pytorch/pulls/9087"},"html":{"href":"https://github.com/pytorch/pytorch/pull/9087"},"issue":{"href":"https://api.github.com/repos/pytorch/pytorch/issues/9087"},"comments":{"href":"https://api.github.com/repos/pytorch/pytorch/issues/9087/comments"},"review_comments":{"href":"https://api.github.com/repos/pytorch/pytorch/pulls/9087/comments"},"review_comment":{"href":"https://api.github.com/repos/pytorch/pytorch/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pytorch/pytorch/pulls/9087/commits"},"statuses":{"href":"https://api.github.com/repos/pytorch/pytorch/statuses/79142a0ec0a31353b7bfb07863ae1b6fda24c39c"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"gchanan"}}