{"action":"created","comment":{"url":"https://api.github.com/repos/dmlc/tvm/pulls/comments/193822211","pull_request_review_id":126873221,"id":193822211,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5MzgyMjIxMQ==","diff_hunk":"@@ -233,6 +255,40 @@ NNVM_REGISTER_REDUCE_OP(min)\n     };\n });\n \n+NNVM_REGISTER_COLLAPSE_OP(sum)\n+.describe(R\"code(Reduces lhs to the shape of rhs via sum)code\" NNVM_ADD_FILELINE)\n+.set_attr<FTVMCompute>(\n+  \"FTVMCompute\", [](const NodeAttrs& attrs,\n+                    const Array<Tensor>& inputs,\n+                    const Array<Tensor>& out_info) {\n+    auto ishape = topi::detail::GetConstIntValues(inputs[0]->shape, \"ishape\");\n+    auto oshape = topi::detail::GetConstIntValues(inputs[1]->shape, \"oshape\");\n+    CHECK_GE(ishape.size(), oshape.size()) << attrs.name;\n+    std::vector<dim_t> r_axes;\n+    bool keepdims = false;\n+    std::vector<dim_t> squeeze_axes;\n+    for (int i = ishape.size() - 1, j = oshape.size() - 1; i >= 0; --i) {\n+      if (j < 0 || ishape[i] != oshape[j]) {\n+        r_axes.push_back(i);\n+        if (j < 0) {\n+          squeeze_axes.push_back(i);\n+        } else {\n+          keepdims |= oshape[j] == 1;\n+          j -= oshape[j] == 1;\n+        }\n+      } else {\n+        --j;\n+      }","path":"nnvm/src/top/tensor/reduce.cc","position":null,"original_position":221,"commit_id":"7a9922e2befab40c5c5e39430d7eca7b06f76cbf","original_commit_id":"b2469a5423d90b0e11b8de319c9f46df7dc47856","user":{"login":"nhynes","id":2353785,"node_id":"MDQ6VXNlcjIzNTM3ODU=","avatar_url":"https://avatars2.githubusercontent.com/u/2353785?v=4","gravatar_id":"","url":"https://api.github.com/users/nhynes","html_url":"https://github.com/nhynes","followers_url":"https://api.github.com/users/nhynes/followers","following_url":"https://api.github.com/users/nhynes/following{/other_user}","gists_url":"https://api.github.com/users/nhynes/gists{/gist_id}","starred_url":"https://api.github.com/users/nhynes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nhynes/subscriptions","organizations_url":"https://api.github.com/users/nhynes/orgs","repos_url":"https://api.github.com/users/nhynes/repos","events_url":"https://api.github.com/users/nhynes/events{/privacy}","received_events_url":"https://api.github.com/users/nhynes/received_events","type":"User","site_admin":false},"body":"Just a bit. I changed the index variable names and added some comments to help make it clearer.","created_at":"2018-06-07T17:04:06Z","updated_at":"2018-06-07T17:04:06Z","html_url":"https://github.com/dmlc/tvm/pull/1234#discussion_r193822211","pull_request_url":"https://api.github.com/repos/dmlc/tvm/pulls/1234","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/dmlc/tvm/pulls/comments/193822211"},"html":{"href":"https://github.com/dmlc/tvm/pull/1234#discussion_r193822211"},"pull_request":{"href":"https://api.github.com/repos/dmlc/tvm/pulls/1234"}},"in_reply_to_id":193640450},"pull_request":{"url":"https://api.github.com/repos/dmlc/tvm/pulls/1234","id":192863242,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkyODYzMjQy","html_url":"https://github.com/dmlc/tvm/pull/1234","diff_url":"https://github.com/dmlc/tvm/pull/1234.diff","patch_url":"https://github.com/dmlc/tvm/pull/1234.patch","issue_url":"https://api.github.com/repos/dmlc/tvm/issues/1234","number":1234,"state":"open","locked":false,"title":"[NNVM][TOPI] Add gradients for broadcast_* ops","user":{"login":"nhynes","id":2353785,"node_id":"MDQ6VXNlcjIzNTM3ODU=","avatar_url":"https://avatars2.githubusercontent.com/u/2353785?v=4","gravatar_id":"","url":"https://api.github.com/users/nhynes","html_url":"https://github.com/nhynes","followers_url":"https://api.github.com/users/nhynes/followers","following_url":"https://api.github.com/users/nhynes/following{/other_user}","gists_url":"https://api.github.com/users/nhynes/gists{/gist_id}","starred_url":"https://api.github.com/users/nhynes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nhynes/subscriptions","organizations_url":"https://api.github.com/users/nhynes/orgs","repos_url":"https://api.github.com/users/nhynes/repos","events_url":"https://api.github.com/users/nhynes/events{/privacy}","received_events_url":"https://api.github.com/users/nhynes/received_events","type":"User","site_admin":false},"body":"This PR\r\n* adds gradient operators for `broadcast_*` ops by adding a `collapse_sum` op\r\n* fixes a bug in reduce ops which didn't correctly apply excluded reduce axes","created_at":"2018-06-05T23:29:21Z","updated_at":"2018-06-07T17:04:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ec84e58c523f090931141316e310c739ea26cde3","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/dmlc/tvm/pulls/1234/commits","review_comments_url":"https://api.github.com/repos/dmlc/tvm/pulls/1234/comments","review_comment_url":"https://api.github.com/repos/dmlc/tvm/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dmlc/tvm/issues/1234/comments","statuses_url":"https://api.github.com/repos/dmlc/tvm/statuses/7a9922e2befab40c5c5e39430d7eca7b06f76cbf","head":{"label":"myelin-ml:bc-grads","ref":"bc-grads","sha":"7a9922e2befab40c5c5e39430d7eca7b06f76cbf","user":{"login":"myelin-ml","id":37816471,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM3ODE2NDcx","avatar_url":"https://avatars0.githubusercontent.com/u/37816471?v=4","gravatar_id":"","url":"https://api.github.com/users/myelin-ml","html_url":"https://github.com/myelin-ml","followers_url":"https://api.github.com/users/myelin-ml/followers","following_url":"https://api.github.com/users/myelin-ml/following{/other_user}","gists_url":"https://api.github.com/users/myelin-ml/gists{/gist_id}","starred_url":"https://api.github.com/users/myelin-ml/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/myelin-ml/subscriptions","organizations_url":"https://api.github.com/users/myelin-ml/orgs","repos_url":"https://api.github.com/users/myelin-ml/repos","events_url":"https://api.github.com/users/myelin-ml/events{/privacy}","received_events_url":"https://api.github.com/users/myelin-ml/received_events","type":"Organization","site_admin":false},"repo":{"id":122412898,"node_id":"MDEwOlJlcG9zaXRvcnkxMjI0MTI4OTg=","name":"tvm","full_name":"myelin-ml/tvm","owner":{"login":"myelin-ml","id":37816471,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM3ODE2NDcx","avatar_url":"https://avatars0.githubusercontent.com/u/37816471?v=4","gravatar_id":"","url":"https://api.github.com/users/myelin-ml","html_url":"https://github.com/myelin-ml","followers_url":"https://api.github.com/users/myelin-ml/followers","following_url":"https://api.github.com/users/myelin-ml/following{/other_user}","gists_url":"https://api.github.com/users/myelin-ml/gists{/gist_id}","starred_url":"https://api.github.com/users/myelin-ml/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/myelin-ml/subscriptions","organizations_url":"https://api.github.com/users/myelin-ml/orgs","repos_url":"https://api.github.com/users/myelin-ml/repos","events_url":"https://api.github.com/users/myelin-ml/events{/privacy}","received_events_url":"https://api.github.com/users/myelin-ml/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/myelin-ml/tvm","description":"bring deep learning workloads to bare metal","fork":true,"url":"https://api.github.com/repos/myelin-ml/tvm","forks_url":"https://api.github.com/repos/myelin-ml/tvm/forks","keys_url":"https://api.github.com/repos/myelin-ml/tvm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/myelin-ml/tvm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/myelin-ml/tvm/teams","hooks_url":"https://api.github.com/repos/myelin-ml/tvm/hooks","issue_events_url":"https://api.github.com/repos/myelin-ml/tvm/issues/events{/number}","events_url":"https://api.github.com/repos/myelin-ml/tvm/events","assignees_url":"https://api.github.com/repos/myelin-ml/tvm/assignees{/user}","branches_url":"https://api.github.com/repos/myelin-ml/tvm/branches{/branch}","tags_url":"https://api.github.com/repos/myelin-ml/tvm/tags","blobs_url":"https://api.github.com/repos/myelin-ml/tvm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/myelin-ml/tvm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/myelin-ml/tvm/git/refs{/sha}","trees_url":"https://api.github.com/repos/myelin-ml/tvm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/myelin-ml/tvm/statuses/{sha}","languages_url":"https://api.github.com/repos/myelin-ml/tvm/languages","stargazers_url":"https://api.github.com/repos/myelin-ml/tvm/stargazers","contributors_url":"https://api.github.com/repos/myelin-ml/tvm/contributors","subscribers_url":"https://api.github.com/repos/myelin-ml/tvm/subscribers","subscription_url":"https://api.github.com/repos/myelin-ml/tvm/subscription","commits_url":"https://api.github.com/repos/myelin-ml/tvm/commits{/sha}","git_commits_url":"https://api.github.com/repos/myelin-ml/tvm/git/commits{/sha}","comments_url":"https://api.github.com/repos/myelin-ml/tvm/comments{/number}","issue_comment_url":"https://api.github.com/repos/myelin-ml/tvm/issues/comments{/number}","contents_url":"https://api.github.com/repos/myelin-ml/tvm/contents/{+path}","compare_url":"https://api.github.com/repos/myelin-ml/tvm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/myelin-ml/tvm/merges","archive_url":"https://api.github.com/repos/myelin-ml/tvm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/myelin-ml/tvm/downloads","issues_url":"https://api.github.com/repos/myelin-ml/tvm/issues{/number}","pulls_url":"https://api.github.com/repos/myelin-ml/tvm/pulls{/number}","milestones_url":"https://api.github.com/repos/myelin-ml/tvm/milestones{/number}","notifications_url":"https://api.github.com/repos/myelin-ml/tvm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/myelin-ml/tvm/labels{/name}","releases_url":"https://api.github.com/repos/myelin-ml/tvm/releases{/id}","deployments_url":"https://api.github.com/repos/myelin-ml/tvm/deployments","created_at":"2018-02-22T00:50:41Z","updated_at":"2018-06-06T19:21:18Z","pushed_at":"2018-06-07T17:03:23Z","git_url":"git://github.com/myelin-ml/tvm.git","ssh_url":"git@github.com:myelin-ml/tvm.git","clone_url":"https://github.com/myelin-ml/tvm.git","svn_url":"https://github.com/myelin-ml/tvm","homepage":"","size":5264,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dmlc:master","ref":"master","sha":"04c756237b89bafdab63936756a7668ecdc90883","user":{"login":"dmlc","id":11508361,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExNTA4MzYx","avatar_url":"https://avatars2.githubusercontent.com/u/11508361?v=4","gravatar_id":"","url":"https://api.github.com/users/dmlc","html_url":"https://github.com/dmlc","followers_url":"https://api.github.com/users/dmlc/followers","following_url":"https://api.github.com/users/dmlc/following{/other_user}","gists_url":"https://api.github.com/users/dmlc/gists{/gist_id}","starred_url":"https://api.github.com/users/dmlc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmlc/subscriptions","organizations_url":"https://api.github.com/users/dmlc/orgs","repos_url":"https://api.github.com/users/dmlc/repos","events_url":"https://api.github.com/users/dmlc/events{/privacy}","received_events_url":"https://api.github.com/users/dmlc/received_events","type":"Organization","site_admin":false},"repo":{"id":70746484,"node_id":"MDEwOlJlcG9zaXRvcnk3MDc0NjQ4NA==","name":"tvm","full_name":"dmlc/tvm","owner":{"login":"dmlc","id":11508361,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExNTA4MzYx","avatar_url":"https://avatars2.githubusercontent.com/u/11508361?v=4","gravatar_id":"","url":"https://api.github.com/users/dmlc","html_url":"https://github.com/dmlc","followers_url":"https://api.github.com/users/dmlc/followers","following_url":"https://api.github.com/users/dmlc/following{/other_user}","gists_url":"https://api.github.com/users/dmlc/gists{/gist_id}","starred_url":"https://api.github.com/users/dmlc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmlc/subscriptions","organizations_url":"https://api.github.com/users/dmlc/orgs","repos_url":"https://api.github.com/users/dmlc/repos","events_url":"https://api.github.com/users/dmlc/events{/privacy}","received_events_url":"https://api.github.com/users/dmlc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dmlc/tvm","description":"Open deep learning compiler stack for cpu, gpu and specialized accelerators","fork":false,"url":"https://api.github.com/repos/dmlc/tvm","forks_url":"https://api.github.com/repos/dmlc/tvm/forks","keys_url":"https://api.github.com/repos/dmlc/tvm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dmlc/tvm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dmlc/tvm/teams","hooks_url":"https://api.github.com/repos/dmlc/tvm/hooks","issue_events_url":"https://api.github.com/repos/dmlc/tvm/issues/events{/number}","events_url":"https://api.github.com/repos/dmlc/tvm/events","assignees_url":"https://api.github.com/repos/dmlc/tvm/assignees{/user}","branches_url":"https://api.github.com/repos/dmlc/tvm/branches{/branch}","tags_url":"https://api.github.com/repos/dmlc/tvm/tags","blobs_url":"https://api.github.com/repos/dmlc/tvm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dmlc/tvm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dmlc/tvm/git/refs{/sha}","trees_url":"https://api.github.com/repos/dmlc/tvm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dmlc/tvm/statuses/{sha}","languages_url":"https://api.github.com/repos/dmlc/tvm/languages","stargazers_url":"https://api.github.com/repos/dmlc/tvm/stargazers","contributors_url":"https://api.github.com/repos/dmlc/tvm/contributors","subscribers_url":"https://api.github.com/repos/dmlc/tvm/subscribers","subscription_url":"https://api.github.com/repos/dmlc/tvm/subscription","commits_url":"https://api.github.com/repos/dmlc/tvm/commits{/sha}","git_commits_url":"https://api.github.com/repos/dmlc/tvm/git/commits{/sha}","comments_url":"https://api.github.com/repos/dmlc/tvm/comments{/number}","issue_comment_url":"https://api.github.com/repos/dmlc/tvm/issues/comments{/number}","contents_url":"https://api.github.com/repos/dmlc/tvm/contents/{+path}","compare_url":"https://api.github.com/repos/dmlc/tvm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dmlc/tvm/merges","archive_url":"https://api.github.com/repos/dmlc/tvm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dmlc/tvm/downloads","issues_url":"https://api.github.com/repos/dmlc/tvm/issues{/number}","pulls_url":"https://api.github.com/repos/dmlc/tvm/pulls{/number}","milestones_url":"https://api.github.com/repos/dmlc/tvm/milestones{/number}","notifications_url":"https://api.github.com/repos/dmlc/tvm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dmlc/tvm/labels{/name}","releases_url":"https://api.github.com/repos/dmlc/tvm/releases{/id}","deployments_url":"https://api.github.com/repos/dmlc/tvm/deployments","created_at":"2016-10-12T22:20:28Z","updated_at":"2018-06-07T16:35:35Z","pushed_at":"2018-06-07T17:03:24Z","git_url":"git://github.com/dmlc/tvm.git","ssh_url":"git@github.com:dmlc/tvm.git","clone_url":"https://github.com/dmlc/tvm.git","svn_url":"https://github.com/dmlc/tvm","homepage":"https://tvm.ai","size":5113,"stargazers_count":1510,"watchers_count":1510,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":317,"mirror_url":null,"archived":false,"open_issues_count":40,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":317,"open_issues":40,"watchers":1510,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dmlc/tvm/pulls/1234"},"html":{"href":"https://github.com/dmlc/tvm/pull/1234"},"issue":{"href":"https://api.github.com/repos/dmlc/tvm/issues/1234"},"comments":{"href":"https://api.github.com/repos/dmlc/tvm/issues/1234/comments"},"review_comments":{"href":"https://api.github.com/repos/dmlc/tvm/pulls/1234/comments"},"review_comment":{"href":"https://api.github.com/repos/dmlc/tvm/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dmlc/tvm/pulls/1234/commits"},"statuses":{"href":"https://api.github.com/repos/dmlc/tvm/statuses/7a9922e2befab40c5c5e39430d7eca7b06f76cbf"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"nhynes"}}