{"action":"created","comment":{"url":"https://api.github.com/repos/pytorch/xla/pulls/comments/268373503","pull_request_review_id":218017250,"id":268373503,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI2ODM3MzUwMw==","diff_hunk":"@@ -87,6 +87,44 @@ xla::XlaComputation MakeScatterComputation(\n   return cb.Build().ConsumeValueOrDie();\n }\n \n+xla::XlaOp CreateIndexAlongDim(\n+    const xla::XlaOp& buffer, xla::int64 dim, const xla::XlaOp& index,\n+    const xla::XlaOp& value, bool broadcast_value_to_index,\n+    const std::function<xla::XlaOp(xla::XlaOp, xla::XlaOp, xla::XlaBuilder*)>&\n+        combiner) {\n+  xla::Shape buffer_shape = XlaHelpers::ShapeOfXlaOp(buffer);\n+  xla::ScatterDimensionNumbers dim_numbers;\n+  dim_numbers.set_index_vector_dim(1);\n+  for (xla::int64 window_dim = 0; window_dim < buffer_shape.rank();\n+       ++window_dim) {\n+    if (window_dim != dim) {\n+      dim_numbers.add_update_window_dims(window_dim);\n+    } else {\n+      dim_numbers.add_inserted_window_dims(window_dim);\n+      dim_numbers.add_scatter_dims_to_operand_dims(window_dim);\n+    }\n+  }\n+\n+  // Create a combiner computation for the scatter.\n+  xla::XlaComputation combiner_computation =\n+      MakeScatterComputation(combiner, buffer_shape.element_type());\n+  // Broadcast the value to the right shape required by scatter.\n+  xla::XlaOp updates;\n+  if (broadcast_value_to_index) {\n+    xla::Shape index_shape = XlaHelpers::ShapeOfXlaOp(index);\n+    std::vector<xla::int64> update_dimensions =\n+        xla::util::ToVector<xla::int64>(buffer_shape.dimensions());\n+    update_dimensions[dim] = index_shape.dimensions(0);\n+    updates = xla::Broadcast(\n+        xla::ConvertElementType(value, buffer_shape.element_type()),\n+        update_dimensions);\n+  } else {\n+    updates = value;","path":"torch_xla/csrc/xla_lower_util.cpp","position":null,"original_position":36,"commit_id":"b87e885d60e2c77a5d8024f67c6002185c45fb15","original_commit_id":"83e45caccde6ca5147de17aba1643933c7867473","user":{"login":"asuhan","id":246815,"node_id":"MDQ6VXNlcjI0NjgxNQ==","avatar_url":"https://avatars3.githubusercontent.com/u/246815?v=4","gravatar_id":"","url":"https://api.github.com/users/asuhan","html_url":"https://github.com/asuhan","followers_url":"https://api.github.com/users/asuhan/followers","following_url":"https://api.github.com/users/asuhan/following{/other_user}","gists_url":"https://api.github.com/users/asuhan/gists{/gist_id}","starred_url":"https://api.github.com/users/asuhan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asuhan/subscriptions","organizations_url":"https://api.github.com/users/asuhan/orgs","repos_url":"https://api.github.com/users/asuhan/repos","events_url":"https://api.github.com/users/asuhan/events{/privacy}","received_events_url":"https://api.github.com/users/asuhan/received_events","type":"User","site_admin":false},"body":"Done.","created_at":"2019-03-23T00:38:42Z","updated_at":"2019-03-23T00:38:42Z","html_url":"https://github.com/pytorch/xla/pull/506#discussion_r268373503","pull_request_url":"https://api.github.com/repos/pytorch/xla/pulls/506","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/pytorch/xla/pulls/comments/268373503"},"html":{"href":"https://github.com/pytorch/xla/pull/506#discussion_r268373503"},"pull_request":{"href":"https://api.github.com/repos/pytorch/xla/pulls/506"}},"in_reply_to_id":268372740},"pull_request":{"url":"https://api.github.com/repos/pytorch/xla/pulls/506","id":263767427,"node_id":"MDExOlB1bGxSZXF1ZXN0MjYzNzY3NDI3","html_url":"https://github.com/pytorch/xla/pull/506","diff_url":"https://github.com/pytorch/xla/pull/506.diff","patch_url":"https://github.com/pytorch/xla/pull/506.patch","issue_url":"https://api.github.com/repos/pytorch/xla/issues/506","number":506,"state":"open","locked":false,"title":"Add index_{add, copy} and their inplace versions to ATen XLA tensor","user":{"login":"asuhan","id":246815,"node_id":"MDQ6VXNlcjI0NjgxNQ==","avatar_url":"https://avatars3.githubusercontent.com/u/246815?v=4","gravatar_id":"","url":"https://api.github.com/users/asuhan","html_url":"https://github.com/asuhan","followers_url":"https://api.github.com/users/asuhan/followers","following_url":"https://api.github.com/users/asuhan/following{/other_user}","gists_url":"https://api.github.com/users/asuhan/gists{/gist_id}","starred_url":"https://api.github.com/users/asuhan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asuhan/subscriptions","organizations_url":"https://api.github.com/users/asuhan/orgs","repos_url":"https://api.github.com/users/asuhan/repos","events_url":"https://api.github.com/users/asuhan/events{/privacy}","received_events_url":"https://api.github.com/users/asuhan/received_events","type":"User","site_admin":false},"body":"","created_at":"2019-03-22T21:26:17Z","updated_at":"2019-03-23T00:38:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dd562ced4573e49d8c357710e4d751da04109134","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/pytorch/xla/pulls/506/commits","review_comments_url":"https://api.github.com/repos/pytorch/xla/pulls/506/comments","review_comment_url":"https://api.github.com/repos/pytorch/xla/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pytorch/xla/issues/506/comments","statuses_url":"https://api.github.com/repos/pytorch/xla/statuses/b87e885d60e2c77a5d8024f67c6002185c45fb15","head":{"label":"pytorch:asuhan/index_add","ref":"asuhan/index_add","sha":"b87e885d60e2c77a5d8024f67c6002185c45fb15","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":156293205,"node_id":"MDEwOlJlcG9zaXRvcnkxNTYyOTMyMDU=","name":"xla","full_name":"pytorch/xla","private":false,"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},"html_url":"https://github.com/pytorch/xla","description":null,"fork":false,"url":"https://api.github.com/repos/pytorch/xla","forks_url":"https://api.github.com/repos/pytorch/xla/forks","keys_url":"https://api.github.com/repos/pytorch/xla/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pytorch/xla/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pytorch/xla/teams","hooks_url":"https://api.github.com/repos/pytorch/xla/hooks","issue_events_url":"https://api.github.com/repos/pytorch/xla/issues/events{/number}","events_url":"https://api.github.com/repos/pytorch/xla/events","assignees_url":"https://api.github.com/repos/pytorch/xla/assignees{/user}","branches_url":"https://api.github.com/repos/pytorch/xla/branches{/branch}","tags_url":"https://api.github.com/repos/pytorch/xla/tags","blobs_url":"https://api.github.com/repos/pytorch/xla/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pytorch/xla/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pytorch/xla/git/refs{/sha}","trees_url":"https://api.github.com/repos/pytorch/xla/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pytorch/xla/statuses/{sha}","languages_url":"https://api.github.com/repos/pytorch/xla/languages","stargazers_url":"https://api.github.com/repos/pytorch/xla/stargazers","contributors_url":"https://api.github.com/repos/pytorch/xla/contributors","subscribers_url":"https://api.github.com/repos/pytorch/xla/subscribers","subscription_url":"https://api.github.com/repos/pytorch/xla/subscription","commits_url":"https://api.github.com/repos/pytorch/xla/commits{/sha}","git_commits_url":"https://api.github.com/repos/pytorch/xla/git/commits{/sha}","comments_url":"https://api.github.com/repos/pytorch/xla/comments{/number}","issue_comment_url":"https://api.github.com/repos/pytorch/xla/issues/comments{/number}","contents_url":"https://api.github.com/repos/pytorch/xla/contents/{+path}","compare_url":"https://api.github.com/repos/pytorch/xla/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pytorch/xla/merges","archive_url":"https://api.github.com/repos/pytorch/xla/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pytorch/xla/downloads","issues_url":"https://api.github.com/repos/pytorch/xla/issues{/number}","pulls_url":"https://api.github.com/repos/pytorch/xla/pulls{/number}","milestones_url":"https://api.github.com/repos/pytorch/xla/milestones{/number}","notifications_url":"https://api.github.com/repos/pytorch/xla/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pytorch/xla/labels{/name}","releases_url":"https://api.github.com/repos/pytorch/xla/releases{/id}","deployments_url":"https://api.github.com/repos/pytorch/xla/deployments","created_at":"2018-11-05T22:42:04Z","updated_at":"2019-03-23T00:31:30Z","pushed_at":"2019-03-23T00:38:28Z","git_url":"git://github.com/pytorch/xla.git","ssh_url":"git@github.com:pytorch/xla.git","clone_url":"https://github.com/pytorch/xla.git","svn_url":"https://github.com/pytorch/xla","homepage":null,"size":2452,"stargazers_count":162,"watchers_count":162,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":14,"mirror_url":null,"archived":false,"open_issues_count":9,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":14,"open_issues":9,"watchers":162,"default_branch":"master"}},"base":{"label":"pytorch:master","ref":"master","sha":"5686da1dc5c083fb10180a9827883c6be9862a01","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":156293205,"node_id":"MDEwOlJlcG9zaXRvcnkxNTYyOTMyMDU=","name":"xla","full_name":"pytorch/xla","private":false,"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},"html_url":"https://github.com/pytorch/xla","description":null,"fork":false,"url":"https://api.github.com/repos/pytorch/xla","forks_url":"https://api.github.com/repos/pytorch/xla/forks","keys_url":"https://api.github.com/repos/pytorch/xla/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pytorch/xla/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pytorch/xla/teams","hooks_url":"https://api.github.com/repos/pytorch/xla/hooks","issue_events_url":"https://api.github.com/repos/pytorch/xla/issues/events{/number}","events_url":"https://api.github.com/repos/pytorch/xla/events","assignees_url":"https://api.github.com/repos/pytorch/xla/assignees{/user}","branches_url":"https://api.github.com/repos/pytorch/xla/branches{/branch}","tags_url":"https://api.github.com/repos/pytorch/xla/tags","blobs_url":"https://api.github.com/repos/pytorch/xla/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pytorch/xla/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pytorch/xla/git/refs{/sha}","trees_url":"https://api.github.com/repos/pytorch/xla/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pytorch/xla/statuses/{sha}","languages_url":"https://api.github.com/repos/pytorch/xla/languages","stargazers_url":"https://api.github.com/repos/pytorch/xla/stargazers","contributors_url":"https://api.github.com/repos/pytorch/xla/contributors","subscribers_url":"https://api.github.com/repos/pytorch/xla/subscribers","subscription_url":"https://api.github.com/repos/pytorch/xla/subscription","commits_url":"https://api.github.com/repos/pytorch/xla/commits{/sha}","git_commits_url":"https://api.github.com/repos/pytorch/xla/git/commits{/sha}","comments_url":"https://api.github.com/repos/pytorch/xla/comments{/number}","issue_comment_url":"https://api.github.com/repos/pytorch/xla/issues/comments{/number}","contents_url":"https://api.github.com/repos/pytorch/xla/contents/{+path}","compare_url":"https://api.github.com/repos/pytorch/xla/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pytorch/xla/merges","archive_url":"https://api.github.com/repos/pytorch/xla/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pytorch/xla/downloads","issues_url":"https://api.github.com/repos/pytorch/xla/issues{/number}","pulls_url":"https://api.github.com/repos/pytorch/xla/pulls{/number}","milestones_url":"https://api.github.com/repos/pytorch/xla/milestones{/number}","notifications_url":"https://api.github.com/repos/pytorch/xla/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pytorch/xla/labels{/name}","releases_url":"https://api.github.com/repos/pytorch/xla/releases{/id}","deployments_url":"https://api.github.com/repos/pytorch/xla/deployments","created_at":"2018-11-05T22:42:04Z","updated_at":"2019-03-23T00:31:30Z","pushed_at":"2019-03-23T00:38:28Z","git_url":"git://github.com/pytorch/xla.git","ssh_url":"git@github.com:pytorch/xla.git","clone_url":"https://github.com/pytorch/xla.git","svn_url":"https://github.com/pytorch/xla","homepage":null,"size":2452,"stargazers_count":162,"watchers_count":162,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":14,"mirror_url":null,"archived":false,"open_issues_count":9,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":14,"open_issues":9,"watchers":162,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pytorch/xla/pulls/506"},"html":{"href":"https://github.com/pytorch/xla/pull/506"},"issue":{"href":"https://api.github.com/repos/pytorch/xla/issues/506"},"comments":{"href":"https://api.github.com/repos/pytorch/xla/issues/506/comments"},"review_comments":{"href":"https://api.github.com/repos/pytorch/xla/pulls/506/comments"},"review_comment":{"href":"https://api.github.com/repos/pytorch/xla/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pytorch/xla/pulls/506/commits"},"statuses":{"href":"https://api.github.com/repos/pytorch/xla/statuses/b87e885d60e2c77a5d8024f67c6002185c45fb15"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"asuhan"}}