{"action":"closed","number":776,"pull_request":{"url":"https://api.github.com/repos/clab/dynet/pulls/776","id":135480318,"html_url":"https://github.com/clab/dynet/pull/776","diff_url":"https://github.com/clab/dynet/pull/776.diff","patch_url":"https://github.com/clab/dynet/pull/776.patch","issue_url":"https://api.github.com/repos/clab/dynet/issues/776","number":776,"state":"closed","locked":false,"title":"Multidim operations & speed-improvements","user":{"login":"msperber","id":1821303,"avatar_url":"https://avatars2.githubusercontent.com/u/1821303?v=4","gravatar_id":"","url":"https://api.github.com/users/msperber","html_url":"https://github.com/msperber","followers_url":"https://api.github.com/users/msperber/followers","following_url":"https://api.github.com/users/msperber/following{/other_user}","gists_url":"https://api.github.com/users/msperber/gists{/gist_id}","starred_url":"https://api.github.com/users/msperber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/msperber/subscriptions","organizations_url":"https://api.github.com/users/msperber/orgs","repos_url":"https://api.github.com/users/msperber/repos","events_url":"https://api.github.com/users/msperber/events{/privacy}","received_events_url":"https://api.github.com/users/msperber/received_events","type":"User","site_admin":false},"body":"New features:\r\n- change ```+``` operator to broadcast among arbitrary dimensions, including batch dimension\r\n- extend ```cmul``` and ```cdiv``` to broadcast among arbitrary dimensions, including batch dimension\r\n- broadcasting works as follows (similar to numpy):\r\n  - When number of dimensions differ, we add dimensions of size 1 to make the number of dimensions match\r\n  - Now, every dimensions is required to have matching size, or one of the dimensions must equal 1 (in which case it will be broadcasted)\r\n  - In the same way, the batch dimension must match, or equal 1 in which case it will be broadcasted\r\n  - The resulting tensor's dimensionality is thus determined as the max of both inputs at every position\r\n- ```mean_dim```, ```std_dim```, ```moment_dim``` can now reduce along multiple dimensions at once, including the batch dimension; this makes the following redundant: ```mean_elems```, ```moment_elems```, ```std_elems```, ```moment_batches```, ```mean_batches```, ```std_batches```; they are kept in the code though and simple link to the new code\r\n  - Speed up +, cmult, cdiv by avoiding Eigen broadcast when inputs only differ in batch dimension\r\n\r\nThings I'll leave for a future commit:\r\n  - Note that currently, CwiseQuotient only supports broadcasting the second expression; I would leave the other way for someone else to implement in a future PR if needed\r\n  - Remove ```sum_elems``` and ```sum_batches```, change```sum_dim``` to also reduce along multiple dimensions\r\n  - similar broadcasting behavior for pow() operator\r\n\r\nSpeed improvements:\r\n- ```std_dim```\r\n- ```weight_norm```\r\n- ```cdiv``` (backward pass)\r\nPreviously operations performed before a broadcast were recomputed for every value duplicated via the broadcast; instead, we now precompute them using temporary memory. This can improve speed several orders of magnitude in some cases, depending on how much is broadcasted.\r\n\r\nTODO:\r\n- [X] make broadcasting more flexible\r\n- [X] deprecate redundant operators\r\n- [X] have the plus operator use CwiseSum; remove ScalarAdd, ScalarMultiply, ScalarQuotient nodes from the code, as these are now redundant.\r\n- [x] fix errors","created_at":"2017-08-13T03:13:09Z","updated_at":"2017-09-30T18:17:10Z","closed_at":"2017-09-30T18:17:10Z","merged_at":"2017-09-30T18:17:10Z","merge_commit_sha":"11963baead216509cc89dd43002a5fb6db5b1cfa","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/clab/dynet/pulls/776/commits","review_comments_url":"https://api.github.com/repos/clab/dynet/pulls/776/comments","review_comment_url":"https://api.github.com/repos/clab/dynet/pulls/comments{/number}","comments_url":"https://api.github.com/repos/clab/dynet/issues/776/comments","statuses_url":"https://api.github.com/repos/clab/dynet/statuses/e641cc0c555641803e238e31ef48c7de6ec74c66","head":{"label":"msperber:multidim","ref":"multidim","sha":"e641cc0c555641803e238e31ef48c7de6ec74c66","user":{"login":"msperber","id":1821303,"avatar_url":"https://avatars2.githubusercontent.com/u/1821303?v=4","gravatar_id":"","url":"https://api.github.com/users/msperber","html_url":"https://github.com/msperber","followers_url":"https://api.github.com/users/msperber/followers","following_url":"https://api.github.com/users/msperber/following{/other_user}","gists_url":"https://api.github.com/users/msperber/gists{/gist_id}","starred_url":"https://api.github.com/users/msperber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/msperber/subscriptions","organizations_url":"https://api.github.com/users/msperber/orgs","repos_url":"https://api.github.com/users/msperber/repos","events_url":"https://api.github.com/users/msperber/events{/privacy}","received_events_url":"https://api.github.com/users/msperber/received_events","type":"User","site_admin":false},"repo":{"id":91664434,"name":"dynet","full_name":"msperber/dynet","owner":{"login":"msperber","id":1821303,"avatar_url":"https://avatars2.githubusercontent.com/u/1821303?v=4","gravatar_id":"","url":"https://api.github.com/users/msperber","html_url":"https://github.com/msperber","followers_url":"https://api.github.com/users/msperber/followers","following_url":"https://api.github.com/users/msperber/following{/other_user}","gists_url":"https://api.github.com/users/msperber/gists{/gist_id}","starred_url":"https://api.github.com/users/msperber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/msperber/subscriptions","organizations_url":"https://api.github.com/users/msperber/orgs","repos_url":"https://api.github.com/users/msperber/repos","events_url":"https://api.github.com/users/msperber/events{/privacy}","received_events_url":"https://api.github.com/users/msperber/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/msperber/dynet","description":"DyNet: The Dynamic Neural Network Toolkit","fork":true,"url":"https://api.github.com/repos/msperber/dynet","forks_url":"https://api.github.com/repos/msperber/dynet/forks","keys_url":"https://api.github.com/repos/msperber/dynet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/msperber/dynet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/msperber/dynet/teams","hooks_url":"https://api.github.com/repos/msperber/dynet/hooks","issue_events_url":"https://api.github.com/repos/msperber/dynet/issues/events{/number}","events_url":"https://api.github.com/repos/msperber/dynet/events","assignees_url":"https://api.github.com/repos/msperber/dynet/assignees{/user}","branches_url":"https://api.github.com/repos/msperber/dynet/branches{/branch}","tags_url":"https://api.github.com/repos/msperber/dynet/tags","blobs_url":"https://api.github.com/repos/msperber/dynet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/msperber/dynet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/msperber/dynet/git/refs{/sha}","trees_url":"https://api.github.com/repos/msperber/dynet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/msperber/dynet/statuses/{sha}","languages_url":"https://api.github.com/repos/msperber/dynet/languages","stargazers_url":"https://api.github.com/repos/msperber/dynet/stargazers","contributors_url":"https://api.github.com/repos/msperber/dynet/contributors","subscribers_url":"https://api.github.com/repos/msperber/dynet/subscribers","subscription_url":"https://api.github.com/repos/msperber/dynet/subscription","commits_url":"https://api.github.com/repos/msperber/dynet/commits{/sha}","git_commits_url":"https://api.github.com/repos/msperber/dynet/git/commits{/sha}","comments_url":"https://api.github.com/repos/msperber/dynet/comments{/number}","issue_comment_url":"https://api.github.com/repos/msperber/dynet/issues/comments{/number}","contents_url":"https://api.github.com/repos/msperber/dynet/contents/{+path}","compare_url":"https://api.github.com/repos/msperber/dynet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/msperber/dynet/merges","archive_url":"https://api.github.com/repos/msperber/dynet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/msperber/dynet/downloads","issues_url":"https://api.github.com/repos/msperber/dynet/issues{/number}","pulls_url":"https://api.github.com/repos/msperber/dynet/pulls{/number}","milestones_url":"https://api.github.com/repos/msperber/dynet/milestones{/number}","notifications_url":"https://api.github.com/repos/msperber/dynet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/msperber/dynet/labels{/name}","releases_url":"https://api.github.com/repos/msperber/dynet/releases{/id}","deployments_url":"https://api.github.com/repos/msperber/dynet/deployments","created_at":"2017-05-18T07:48:36Z","updated_at":"2017-05-18T07:48:38Z","pushed_at":"2017-09-29T15:53:58Z","git_url":"git://github.com/msperber/dynet.git","ssh_url":"git@github.com:msperber/dynet.git","clone_url":"https://github.com/msperber/dynet.git","svn_url":"https://github.com/msperber/dynet","homepage":"","size":26039,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"clab:master","ref":"master","sha":"6e1e9f496973c7f77d85aea44481e9a50c654249","user":{"login":"clab","id":2374376,"avatar_url":"https://avatars3.githubusercontent.com/u/2374376?v=4","gravatar_id":"","url":"https://api.github.com/users/clab","html_url":"https://github.com/clab","followers_url":"https://api.github.com/users/clab/followers","following_url":"https://api.github.com/users/clab/following{/other_user}","gists_url":"https://api.github.com/users/clab/gists{/gist_id}","starred_url":"https://api.github.com/users/clab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clab/subscriptions","organizations_url":"https://api.github.com/users/clab/orgs","repos_url":"https://api.github.com/users/clab/repos","events_url":"https://api.github.com/users/clab/events{/privacy}","received_events_url":"https://api.github.com/users/clab/received_events","type":"Organization","site_admin":false},"repo":{"id":30509483,"name":"dynet","full_name":"clab/dynet","owner":{"login":"clab","id":2374376,"avatar_url":"https://avatars3.githubusercontent.com/u/2374376?v=4","gravatar_id":"","url":"https://api.github.com/users/clab","html_url":"https://github.com/clab","followers_url":"https://api.github.com/users/clab/followers","following_url":"https://api.github.com/users/clab/following{/other_user}","gists_url":"https://api.github.com/users/clab/gists{/gist_id}","starred_url":"https://api.github.com/users/clab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clab/subscriptions","organizations_url":"https://api.github.com/users/clab/orgs","repos_url":"https://api.github.com/users/clab/repos","events_url":"https://api.github.com/users/clab/events{/privacy}","received_events_url":"https://api.github.com/users/clab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/clab/dynet","description":"DyNet: The Dynamic Neural Network Toolkit","fork":false,"url":"https://api.github.com/repos/clab/dynet","forks_url":"https://api.github.com/repos/clab/dynet/forks","keys_url":"https://api.github.com/repos/clab/dynet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/clab/dynet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/clab/dynet/teams","hooks_url":"https://api.github.com/repos/clab/dynet/hooks","issue_events_url":"https://api.github.com/repos/clab/dynet/issues/events{/number}","events_url":"https://api.github.com/repos/clab/dynet/events","assignees_url":"https://api.github.com/repos/clab/dynet/assignees{/user}","branches_url":"https://api.github.com/repos/clab/dynet/branches{/branch}","tags_url":"https://api.github.com/repos/clab/dynet/tags","blobs_url":"https://api.github.com/repos/clab/dynet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/clab/dynet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/clab/dynet/git/refs{/sha}","trees_url":"https://api.github.com/repos/clab/dynet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/clab/dynet/statuses/{sha}","languages_url":"https://api.github.com/repos/clab/dynet/languages","stargazers_url":"https://api.github.com/repos/clab/dynet/stargazers","contributors_url":"https://api.github.com/repos/clab/dynet/contributors","subscribers_url":"https://api.github.com/repos/clab/dynet/subscribers","subscription_url":"https://api.github.com/repos/clab/dynet/subscription","commits_url":"https://api.github.com/repos/clab/dynet/commits{/sha}","git_commits_url":"https://api.github.com/repos/clab/dynet/git/commits{/sha}","comments_url":"https://api.github.com/repos/clab/dynet/comments{/number}","issue_comment_url":"https://api.github.com/repos/clab/dynet/issues/comments{/number}","contents_url":"https://api.github.com/repos/clab/dynet/contents/{+path}","compare_url":"https://api.github.com/repos/clab/dynet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/clab/dynet/merges","archive_url":"https://api.github.com/repos/clab/dynet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/clab/dynet/downloads","issues_url":"https://api.github.com/repos/clab/dynet/issues{/number}","pulls_url":"https://api.github.com/repos/clab/dynet/pulls{/number}","milestones_url":"https://api.github.com/repos/clab/dynet/milestones{/number}","notifications_url":"https://api.github.com/repos/clab/dynet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/clab/dynet/labels{/name}","releases_url":"https://api.github.com/repos/clab/dynet/releases{/id}","deployments_url":"https://api.github.com/repos/clab/dynet/deployments","created_at":"2015-02-08T23:09:21Z","updated_at":"2017-09-30T03:16:16Z","pushed_at":"2017-09-30T18:17:10Z","git_url":"git://github.com/clab/dynet.git","ssh_url":"git@github.com:clab/dynet.git","clone_url":"https://github.com/clab/dynet.git","svn_url":"https://github.com/clab/dynet","homepage":"","size":25755,"stargazers_count":1763,"watchers_count":1763,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":444,"mirror_url":null,"open_issues_count":116,"forks":444,"open_issues":116,"watchers":1763,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/clab/dynet/pulls/776"},"html":{"href":"https://github.com/clab/dynet/pull/776"},"issue":{"href":"https://api.github.com/repos/clab/dynet/issues/776"},"comments":{"href":"https://api.github.com/repos/clab/dynet/issues/776/comments"},"review_comments":{"href":"https://api.github.com/repos/clab/dynet/pulls/776/comments"},"review_comment":{"href":"https://api.github.com/repos/clab/dynet/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/clab/dynet/pulls/776/commits"},"statuses":{"href":"https://api.github.com/repos/clab/dynet/statuses/e641cc0c555641803e238e31ef48c7de6ec74c66"}},"author_association":"COLLABORATOR","merged":true,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":{"login":"neubig","id":398875,"avatar_url":"https://avatars1.githubusercontent.com/u/398875?v=4","gravatar_id":"","url":"https://api.github.com/users/neubig","html_url":"https://github.com/neubig","followers_url":"https://api.github.com/users/neubig/followers","following_url":"https://api.github.com/users/neubig/following{/other_user}","gists_url":"https://api.github.com/users/neubig/gists{/gist_id}","starred_url":"https://api.github.com/users/neubig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neubig/subscriptions","organizations_url":"https://api.github.com/users/neubig/orgs","repos_url":"https://api.github.com/users/neubig/repos","events_url":"https://api.github.com/users/neubig/events{/privacy}","received_events_url":"https://api.github.com/users/neubig/received_events","type":"User","site_admin":false},"comments":15,"review_comments":1,"maintainer_can_modify":false,"commits":106,"additions":870,"deletions":397,"changed_files":17}}
{"actor":{"display_login":"neubig"}}