{"action":"created","comment":{"url":"https://api.github.com/repos/apache/incubator-mxnet/pulls/comments/175332450","pull_request_review_id":104841740,"id":175332450,"diff_hunk":"@@ -185,6 +227,75 @@ void BinaryBroadcastCompute(const nnvm::NodeAttrs& attrs,\n   }\n }\n \n+template<typename xpu, typename OP>\n+void BinaryBroadCastCsrDnsCsrImpl(const OpContext& ctx,\n+                                  const NDArray& csr,\n+                                  const NDArray& dns,\n+                                  const OpReqType req,\n+                                  const NDArray& output) {\n+  using namespace mshadow;\n+  using namespace mxnet_op;\n+  using namespace csr;\n+  CHECK_EQ(dns.shape().ndim(), 1) << \"input dense should be a vector\";\n+  mshadow::Stream<xpu> *s = ctx.get_stream<xpu>();\n+  bool col_vec = (dns.shape()[0] == csr.shape()[0])? true : false;\n+  if (!csr.storage_initialized()) {\n+    FillZerosCsrImpl(s, output);\n+    return;\n+  }\n+  const nnvm::dim_t nnz = csr.storage_shape()[0];\n+  const nnvm::dim_t num_rows = output.shape()[0];\n+  output.CheckAndAlloc({Shape1(num_rows + 1), Shape1(nnz)});\n+\n+  MSHADOW_TYPE_SWITCH(output.dtype(), DType, {\n+    MSHADOW_IDX_TYPE_SWITCH(output.aux_type(kIdx), CType, {\n+      MSHADOW_IDX_TYPE_SWITCH(output.aux_type(kIndPtr), RType, {\n+        MXNET_ASSIGN_REQ_SWITCH(req, req_type, {\n+          Kernel<csr_dns_csr_broadcast_kernel<DType, CType, RType, req_type, OP>, xpu>::Launch(","path":"src/operator/tensor/elemwise_binary_broadcast_op.h","position":91,"original_position":91,"commit_id":"20ba3d02df095d8574dcb4e1e6e6d6657017f2dc","original_commit_id":"20ba3d02df095d8574dcb4e1e6e6d6657017f2dc","user":{"login":"cjolivier01","id":11234557,"avatar_url":"https://avatars1.githubusercontent.com/u/11234557?v=4","gravatar_id":"","url":"https://api.github.com/users/cjolivier01","html_url":"https://github.com/cjolivier01","followers_url":"https://api.github.com/users/cjolivier01/followers","following_url":"https://api.github.com/users/cjolivier01/following{/other_user}","gists_url":"https://api.github.com/users/cjolivier01/gists{/gist_id}","starred_url":"https://api.github.com/users/cjolivier01/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cjolivier01/subscriptions","organizations_url":"https://api.github.com/users/cjolivier01/orgs","repos_url":"https://api.github.com/users/cjolivier01/repos","events_url":"https://api.github.com/users/cjolivier01/events{/privacy}","received_events_url":"https://api.github.com/users/cjolivier01/received_events","type":"User","site_admin":false},"body":"yeah, you can probably get by without passing all of these template parameters ","created_at":"2018-03-19T05:05:13Z","updated_at":"2018-03-19T05:07:56Z","html_url":"https://github.com/apache/incubator-mxnet/pull/10150#discussion_r175332450","pull_request_url":"https://api.github.com/repos/apache/incubator-mxnet/pulls/10150","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/apache/incubator-mxnet/pulls/comments/175332450"},"html":{"href":"https://github.com/apache/incubator-mxnet/pull/10150#discussion_r175332450"},"pull_request":{"href":"https://api.github.com/repos/apache/incubator-mxnet/pulls/10150"}}},"pull_request":{"url":"https://api.github.com/repos/apache/incubator-mxnet/pulls/10150","id":175763542,"html_url":"https://github.com/apache/incubator-mxnet/pull/10150","diff_url":"https://github.com/apache/incubator-mxnet/pull/10150.diff","patch_url":"https://github.com/apache/incubator-mxnet/pull/10150.patch","issue_url":"https://api.github.com/repos/apache/incubator-mxnet/issues/10150","number":10150,"state":"open","locked":false,"title":"[WIP] [DO NOT MERGE] Sparse operator broadcast_mul/div(csr, dense) = csr","user":{"login":"haojin2","id":11465736,"avatar_url":"https://avatars3.githubusercontent.com/u/11465736?v=4","gravatar_id":"","url":"https://api.github.com/users/haojin2","html_url":"https://github.com/haojin2","followers_url":"https://api.github.com/users/haojin2/followers","following_url":"https://api.github.com/users/haojin2/following{/other_user}","gists_url":"https://api.github.com/users/haojin2/gists{/gist_id}","starred_url":"https://api.github.com/users/haojin2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haojin2/subscriptions","organizations_url":"https://api.github.com/users/haojin2/orgs","repos_url":"https://api.github.com/users/haojin2/repos","events_url":"https://api.github.com/users/haojin2/events{/privacy}","received_events_url":"https://api.github.com/users/haojin2/received_events","type":"User","site_admin":false},"body":"## Description ##\r\nAdd a sparse operator on CPU that supports broadcast_mul/div(csr, dense) = csr operations.\r\n\r\n## Checklist ##\r\n### Essentials ###\r\n- [ ] The PR title starts with [MXNET-$JIRA_ID], where $JIRA_ID refers to the relevant [JIRA issue](https://issues.apache.org/jira/projects/MXNET/issues) created (except PRs with tiny changes)\r\n- [ ] Changes are complete (i.e. I finished coding on this PR)\r\n- [ ] All changes have test coverage:\r\n- Unit tests are added for small changes to verify correctness (e.g. adding a new operator)\r\n- Nightly tests are added for complicated/long-running ones (e.g. changing distributed kvstore)\r\n- Build tests will be added for build configuration changes (e.g. adding a new build option with NCCL)\r\n- [ ] Code is well-documented: \r\n- For user-facing API changes, API doc string has been updated. \r\n- For new C++ functions in header files, their functionalities and arguments are documented. \r\n- For new examples, README.md is added to explain the what the example does, the source of the dataset, expected performance on test set and reference to the original paper if applicable\r\n- Check the API doc at http://mxnet-ci-doc.s3-accelerate.dualstack.amazonaws.com/PR-$PR_ID/$BUILD_ID/index.html\r\n- [ ] To the my best knowledge, examples are either not affected by this change, or have been fixed to be compatible with this change\r\n\r\n### Changes ###\r\n- [x] Add support for broadcast_mul/div(csr, 1Ddense) = csr\r\n- [ ] Add support for broadcast_mul/div(csr, 2Ddense) = csr\r\n\r\n## Comments ##\r\nExample for broadcast_mul/div(csr, 1Ddense) = csr\r\nimport mxnet as mx\r\na = mx.nd.array([[0,0,3],[0,2,0],[1,0,0]]).tostype('csr')\r\nb = mx.nd.array([1,2,3])\r\nmx.nd.broadcast_mul(a,b).asnumpy()\r\narray([[ 0.,  0.,  3.],\r\n           [ 0.,  4.,  0.],\r\n           [ 3.,  0.,  0.]], dtype=float32)\r\n\r\n","created_at":"2018-03-18T17:42:44Z","updated_at":"2018-03-19T05:07:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bc0498fbabdfb53068934614c37237adf4a671d4","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/apache/incubator-mxnet/pulls/10150/commits","review_comments_url":"https://api.github.com/repos/apache/incubator-mxnet/pulls/10150/comments","review_comment_url":"https://api.github.com/repos/apache/incubator-mxnet/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/incubator-mxnet/issues/10150/comments","statuses_url":"https://api.github.com/repos/apache/incubator-mxnet/statuses/20ba3d02df095d8574dcb4e1e6e6d6657017f2dc","head":{"label":"haojin2:broadcast_1D_mul","ref":"broadcast_1D_mul","sha":"20ba3d02df095d8574dcb4e1e6e6d6657017f2dc","user":{"login":"haojin2","id":11465736,"avatar_url":"https://avatars3.githubusercontent.com/u/11465736?v=4","gravatar_id":"","url":"https://api.github.com/users/haojin2","html_url":"https://github.com/haojin2","followers_url":"https://api.github.com/users/haojin2/followers","following_url":"https://api.github.com/users/haojin2/following{/other_user}","gists_url":"https://api.github.com/users/haojin2/gists{/gist_id}","starred_url":"https://api.github.com/users/haojin2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haojin2/subscriptions","organizations_url":"https://api.github.com/users/haojin2/orgs","repos_url":"https://api.github.com/users/haojin2/repos","events_url":"https://api.github.com/users/haojin2/events{/privacy}","received_events_url":"https://api.github.com/users/haojin2/received_events","type":"User","site_admin":false},"repo":{"id":114436356,"name":"incubator-mxnet","full_name":"haojin2/incubator-mxnet","owner":{"login":"haojin2","id":11465736,"avatar_url":"https://avatars3.githubusercontent.com/u/11465736?v=4","gravatar_id":"","url":"https://api.github.com/users/haojin2","html_url":"https://github.com/haojin2","followers_url":"https://api.github.com/users/haojin2/followers","following_url":"https://api.github.com/users/haojin2/following{/other_user}","gists_url":"https://api.github.com/users/haojin2/gists{/gist_id}","starred_url":"https://api.github.com/users/haojin2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haojin2/subscriptions","organizations_url":"https://api.github.com/users/haojin2/orgs","repos_url":"https://api.github.com/users/haojin2/repos","events_url":"https://api.github.com/users/haojin2/events{/privacy}","received_events_url":"https://api.github.com/users/haojin2/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/haojin2/incubator-mxnet","description":"Lightweight, Portable, Flexible Distributed/Mobile Deep Learning with Dynamic, Mutation-aware Dataflow Dep Scheduler; for Python, R, Julia, Scala, Go, Javascript and more","fork":true,"url":"https://api.github.com/repos/haojin2/incubator-mxnet","forks_url":"https://api.github.com/repos/haojin2/incubator-mxnet/forks","keys_url":"https://api.github.com/repos/haojin2/incubator-mxnet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/haojin2/incubator-mxnet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/haojin2/incubator-mxnet/teams","hooks_url":"https://api.github.com/repos/haojin2/incubator-mxnet/hooks","issue_events_url":"https://api.github.com/repos/haojin2/incubator-mxnet/issues/events{/number}","events_url":"https://api.github.com/repos/haojin2/incubator-mxnet/events","assignees_url":"https://api.github.com/repos/haojin2/incubator-mxnet/assignees{/user}","branches_url":"https://api.github.com/repos/haojin2/incubator-mxnet/branches{/branch}","tags_url":"https://api.github.com/repos/haojin2/incubator-mxnet/tags","blobs_url":"https://api.github.com/repos/haojin2/incubator-mxnet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/haojin2/incubator-mxnet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/haojin2/incubator-mxnet/git/refs{/sha}","trees_url":"https://api.github.com/repos/haojin2/incubator-mxnet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/haojin2/incubator-mxnet/statuses/{sha}","languages_url":"https://api.github.com/repos/haojin2/incubator-mxnet/languages","stargazers_url":"https://api.github.com/repos/haojin2/incubator-mxnet/stargazers","contributors_url":"https://api.github.com/repos/haojin2/incubator-mxnet/contributors","subscribers_url":"https://api.github.com/repos/haojin2/incubator-mxnet/subscribers","subscription_url":"https://api.github.com/repos/haojin2/incubator-mxnet/subscription","commits_url":"https://api.github.com/repos/haojin2/incubator-mxnet/commits{/sha}","git_commits_url":"https://api.github.com/repos/haojin2/incubator-mxnet/git/commits{/sha}","comments_url":"https://api.github.com/repos/haojin2/incubator-mxnet/comments{/number}","issue_comment_url":"https://api.github.com/repos/haojin2/incubator-mxnet/issues/comments{/number}","contents_url":"https://api.github.com/repos/haojin2/incubator-mxnet/contents/{+path}","compare_url":"https://api.github.com/repos/haojin2/incubator-mxnet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/haojin2/incubator-mxnet/merges","archive_url":"https://api.github.com/repos/haojin2/incubator-mxnet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/haojin2/incubator-mxnet/downloads","issues_url":"https://api.github.com/repos/haojin2/incubator-mxnet/issues{/number}","pulls_url":"https://api.github.com/repos/haojin2/incubator-mxnet/pulls{/number}","milestones_url":"https://api.github.com/repos/haojin2/incubator-mxnet/milestones{/number}","notifications_url":"https://api.github.com/repos/haojin2/incubator-mxnet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/haojin2/incubator-mxnet/labels{/name}","releases_url":"https://api.github.com/repos/haojin2/incubator-mxnet/releases{/id}","deployments_url":"https://api.github.com/repos/haojin2/incubator-mxnet/deployments","created_at":"2017-12-16T05:29:32Z","updated_at":"2018-03-16T19:55:36Z","pushed_at":"2018-03-18T17:55:56Z","git_url":"git://github.com/haojin2/incubator-mxnet.git","ssh_url":"git@github.com:haojin2/incubator-mxnet.git","clone_url":"https://github.com/haojin2/incubator-mxnet.git","svn_url":"https://github.com/haojin2/incubator-mxnet","homepage":"http://mxnet.io","size":34097,"stargazers_count":0,"watchers_count":0,"language":"Python","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"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"67af47c889fb5f54cc2b512ab8b453ff5070a1cc","user":{"login":"apache","id":47359,"avatar_url":"https://avatars0.githubusercontent.com/u/47359?v=4","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":34864402,"name":"incubator-mxnet","full_name":"apache/incubator-mxnet","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars0.githubusercontent.com/u/47359?v=4","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/incubator-mxnet","description":"Lightweight, Portable, Flexible Distributed/Mobile Deep Learning with Dynamic, Mutation-aware Dataflow Dep Scheduler; for Python, R, Julia, Scala, Go, Javascript and more","fork":false,"url":"https://api.github.com/repos/apache/incubator-mxnet","forks_url":"https://api.github.com/repos/apache/incubator-mxnet/forks","keys_url":"https://api.github.com/repos/apache/incubator-mxnet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/incubator-mxnet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/incubator-mxnet/teams","hooks_url":"https://api.github.com/repos/apache/incubator-mxnet/hooks","issue_events_url":"https://api.github.com/repos/apache/incubator-mxnet/issues/events{/number}","events_url":"https://api.github.com/repos/apache/incubator-mxnet/events","assignees_url":"https://api.github.com/repos/apache/incubator-mxnet/assignees{/user}","branches_url":"https://api.github.com/repos/apache/incubator-mxnet/branches{/branch}","tags_url":"https://api.github.com/repos/apache/incubator-mxnet/tags","blobs_url":"https://api.github.com/repos/apache/incubator-mxnet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/incubator-mxnet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/incubator-mxnet/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/incubator-mxnet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/incubator-mxnet/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/incubator-mxnet/languages","stargazers_url":"https://api.github.com/repos/apache/incubator-mxnet/stargazers","contributors_url":"https://api.github.com/repos/apache/incubator-mxnet/contributors","subscribers_url":"https://api.github.com/repos/apache/incubator-mxnet/subscribers","subscription_url":"https://api.github.com/repos/apache/incubator-mxnet/subscription","commits_url":"https://api.github.com/repos/apache/incubator-mxnet/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/incubator-mxnet/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/incubator-mxnet/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/incubator-mxnet/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/incubator-mxnet/contents/{+path}","compare_url":"https://api.github.com/repos/apache/incubator-mxnet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/incubator-mxnet/merges","archive_url":"https://api.github.com/repos/apache/incubator-mxnet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/incubator-mxnet/downloads","issues_url":"https://api.github.com/repos/apache/incubator-mxnet/issues{/number}","pulls_url":"https://api.github.com/repos/apache/incubator-mxnet/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/incubator-mxnet/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/incubator-mxnet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/incubator-mxnet/labels{/name}","releases_url":"https://api.github.com/repos/apache/incubator-mxnet/releases{/id}","deployments_url":"https://api.github.com/repos/apache/incubator-mxnet/deployments","created_at":"2015-04-30T16:21:15Z","updated_at":"2018-03-19T04:29:09Z","pushed_at":"2018-03-19T02:20:35Z","git_url":"git://github.com/apache/incubator-mxnet.git","ssh_url":"git@github.com:apache/incubator-mxnet.git","clone_url":"https://github.com/apache/incubator-mxnet.git","svn_url":"https://github.com/apache/incubator-mxnet","homepage":"http://mxnet.io","size":34107,"stargazers_count":13394,"watchers_count":13394,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4937,"mirror_url":null,"archived":false,"open_issues_count":844,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":4937,"open_issues":844,"watchers":13394,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/incubator-mxnet/pulls/10150"},"html":{"href":"https://github.com/apache/incubator-mxnet/pull/10150"},"issue":{"href":"https://api.github.com/repos/apache/incubator-mxnet/issues/10150"},"comments":{"href":"https://api.github.com/repos/apache/incubator-mxnet/issues/10150/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/incubator-mxnet/pulls/10150/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/incubator-mxnet/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/incubator-mxnet/pulls/10150/commits"},"statuses":{"href":"https://api.github.com/repos/apache/incubator-mxnet/statuses/20ba3d02df095d8574dcb4e1e6e6d6657017f2dc"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"cjolivier01"}}