{"action":"created","comment":{"url":"https://api.github.com/repos/torch/torch7/pulls/comments/23544364","id":23544364,"diff_hunk":"@@ -525,6 +525,25 @@ function Tensor.totable(tensor)\n   return result\n end\n \n+function Tensor.permute(tensor, ...)\n+  local perm = {...}\n+  local nDims = tensor:dim()\n+  assert(#perm == nDims, 'Invalid permutation')","path":"Tensor.lua","position":7,"original_position":7,"commit_id":"8ac79a1f7cb31f8f8626e229d433133a6ed5197e","original_commit_id":"8ac79a1f7cb31f8f8626e229d433133a6ed5197e","user":{"login":"GeorgOstrovski","id":6409187,"avatar_url":"https://avatars.githubusercontent.com/u/6409187?v=3","gravatar_id":"","url":"https://api.github.com/users/GeorgOstrovski","html_url":"https://github.com/GeorgOstrovski","followers_url":"https://api.github.com/users/GeorgOstrovski/followers","following_url":"https://api.github.com/users/GeorgOstrovski/following{/other_user}","gists_url":"https://api.github.com/users/GeorgOstrovski/gists{/gist_id}","starred_url":"https://api.github.com/users/GeorgOstrovski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GeorgOstrovski/subscriptions","organizations_url":"https://api.github.com/users/GeorgOstrovski/orgs","repos_url":"https://api.github.com/users/GeorgOstrovski/repos","events_url":"https://api.github.com/users/GeorgOstrovski/events{/privacy}","received_events_url":"https://api.github.com/users/GeorgOstrovski/received_events","type":"User","site_admin":false},"body":"How would an under-specified permutation be interpreted then? E.g., \r\nx = torch.Tensor(1,2,3,4)\r\ny = x:permute(4,3) \r\n-- not really well-defined and possibly mistaken for transpose(4,3)\r\n\r\nFor this to work, it would require that the user specified a full permutation on the first n <= N entries (e.g. in the above example, permute(3,1,2) would actually work).\r\nThis seemed to me a somewhat questionable usecase and not worth encouraging?","created_at":"2015-01-26T16:50:37Z","updated_at":"2015-01-26T16:50:37Z","html_url":"https://github.com/torch/torch7/pull/135#discussion_r23544364","pull_request_url":"https://api.github.com/repos/torch/torch7/pulls/135","_links":{"self":{"href":"https://api.github.com/repos/torch/torch7/pulls/comments/23544364"},"html":{"href":"https://github.com/torch/torch7/pull/135#discussion_r23544364"},"pull_request":{"href":"https://api.github.com/repos/torch/torch7/pulls/135"}}},"pull_request":{"url":"https://api.github.com/repos/torch/torch7/pulls/135","id":28037697,"html_url":"https://github.com/torch/torch7/pull/135","diff_url":"https://github.com/torch/torch7/pull/135.diff","patch_url":"https://github.com/torch/torch7/pull/135.patch","issue_url":"https://api.github.com/repos/torch/torch7/issues/135","number":135,"state":"open","locked":false,"title":"Permute","user":{"login":"GeorgOstrovski","id":6409187,"avatar_url":"https://avatars.githubusercontent.com/u/6409187?v=3","gravatar_id":"","url":"https://api.github.com/users/GeorgOstrovski","html_url":"https://github.com/GeorgOstrovski","followers_url":"https://api.github.com/users/GeorgOstrovski/followers","following_url":"https://api.github.com/users/GeorgOstrovski/following{/other_user}","gists_url":"https://api.github.com/users/GeorgOstrovski/gists{/gist_id}","starred_url":"https://api.github.com/users/GeorgOstrovski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GeorgOstrovski/subscriptions","organizations_url":"https://api.github.com/users/GeorgOstrovski/orgs","repos_url":"https://api.github.com/users/GeorgOstrovski/repos","events_url":"https://api.github.com/users/GeorgOstrovski/events{/privacy}","received_events_url":"https://api.github.com/users/GeorgOstrovski/received_events","type":"User","site_admin":false},"body":"Added Tensor.permute convenience function to replace sequences of transpose() calls by a more succinct and less error-prone notation x:permute(a1, a2, ...), where a full permutation (a1, a2, ... , aN) is specified for the N dimensions of a tensor.\r\n","created_at":"2015-01-26T16:09:54Z","updated_at":"2015-01-26T16:50:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"df2accb9e192ea70dff1ca320e0d89b2d2d9f673","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/torch/torch7/pulls/135/commits","review_comments_url":"https://api.github.com/repos/torch/torch7/pulls/135/comments","review_comment_url":"https://api.github.com/repos/torch/torch7/pulls/comments/{number}","comments_url":"https://api.github.com/repos/torch/torch7/issues/135/comments","statuses_url":"https://api.github.com/repos/torch/torch7/statuses/8ac79a1f7cb31f8f8626e229d433133a6ed5197e","head":{"label":"GeorgOstrovski:permute","ref":"permute","sha":"8ac79a1f7cb31f8f8626e229d433133a6ed5197e","user":{"login":"GeorgOstrovski","id":6409187,"avatar_url":"https://avatars.githubusercontent.com/u/6409187?v=3","gravatar_id":"","url":"https://api.github.com/users/GeorgOstrovski","html_url":"https://github.com/GeorgOstrovski","followers_url":"https://api.github.com/users/GeorgOstrovski/followers","following_url":"https://api.github.com/users/GeorgOstrovski/following{/other_user}","gists_url":"https://api.github.com/users/GeorgOstrovski/gists{/gist_id}","starred_url":"https://api.github.com/users/GeorgOstrovski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GeorgOstrovski/subscriptions","organizations_url":"https://api.github.com/users/GeorgOstrovski/orgs","repos_url":"https://api.github.com/users/GeorgOstrovski/repos","events_url":"https://api.github.com/users/GeorgOstrovski/events{/privacy}","received_events_url":"https://api.github.com/users/GeorgOstrovski/received_events","type":"User","site_admin":false},"repo":{"id":20692800,"name":"torch7","full_name":"GeorgOstrovski/torch7","owner":{"login":"GeorgOstrovski","id":6409187,"avatar_url":"https://avatars.githubusercontent.com/u/6409187?v=3","gravatar_id":"","url":"https://api.github.com/users/GeorgOstrovski","html_url":"https://github.com/GeorgOstrovski","followers_url":"https://api.github.com/users/GeorgOstrovski/followers","following_url":"https://api.github.com/users/GeorgOstrovski/following{/other_user}","gists_url":"https://api.github.com/users/GeorgOstrovski/gists{/gist_id}","starred_url":"https://api.github.com/users/GeorgOstrovski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GeorgOstrovski/subscriptions","organizations_url":"https://api.github.com/users/GeorgOstrovski/orgs","repos_url":"https://api.github.com/users/GeorgOstrovski/repos","events_url":"https://api.github.com/users/GeorgOstrovski/events{/privacy}","received_events_url":"https://api.github.com/users/GeorgOstrovski/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/GeorgOstrovski/torch7","description":"","fork":true,"url":"https://api.github.com/repos/GeorgOstrovski/torch7","forks_url":"https://api.github.com/repos/GeorgOstrovski/torch7/forks","keys_url":"https://api.github.com/repos/GeorgOstrovski/torch7/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GeorgOstrovski/torch7/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GeorgOstrovski/torch7/teams","hooks_url":"https://api.github.com/repos/GeorgOstrovski/torch7/hooks","issue_events_url":"https://api.github.com/repos/GeorgOstrovski/torch7/issues/events{/number}","events_url":"https://api.github.com/repos/GeorgOstrovski/torch7/events","assignees_url":"https://api.github.com/repos/GeorgOstrovski/torch7/assignees{/user}","branches_url":"https://api.github.com/repos/GeorgOstrovski/torch7/branches{/branch}","tags_url":"https://api.github.com/repos/GeorgOstrovski/torch7/tags","blobs_url":"https://api.github.com/repos/GeorgOstrovski/torch7/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GeorgOstrovski/torch7/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GeorgOstrovski/torch7/git/refs{/sha}","trees_url":"https://api.github.com/repos/GeorgOstrovski/torch7/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GeorgOstrovski/torch7/statuses/{sha}","languages_url":"https://api.github.com/repos/GeorgOstrovski/torch7/languages","stargazers_url":"https://api.github.com/repos/GeorgOstrovski/torch7/stargazers","contributors_url":"https://api.github.com/repos/GeorgOstrovski/torch7/contributors","subscribers_url":"https://api.github.com/repos/GeorgOstrovski/torch7/subscribers","subscription_url":"https://api.github.com/repos/GeorgOstrovski/torch7/subscription","commits_url":"https://api.github.com/repos/GeorgOstrovski/torch7/commits{/sha}","git_commits_url":"https://api.github.com/repos/GeorgOstrovski/torch7/git/commits{/sha}","comments_url":"https://api.github.com/repos/GeorgOstrovski/torch7/comments{/number}","issue_comment_url":"https://api.github.com/repos/GeorgOstrovski/torch7/issues/comments/{number}","contents_url":"https://api.github.com/repos/GeorgOstrovski/torch7/contents/{+path}","compare_url":"https://api.github.com/repos/GeorgOstrovski/torch7/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GeorgOstrovski/torch7/merges","archive_url":"https://api.github.com/repos/GeorgOstrovski/torch7/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GeorgOstrovski/torch7/downloads","issues_url":"https://api.github.com/repos/GeorgOstrovski/torch7/issues{/number}","pulls_url":"https://api.github.com/repos/GeorgOstrovski/torch7/pulls{/number}","milestones_url":"https://api.github.com/repos/GeorgOstrovski/torch7/milestones{/number}","notifications_url":"https://api.github.com/repos/GeorgOstrovski/torch7/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GeorgOstrovski/torch7/labels{/name}","releases_url":"https://api.github.com/repos/GeorgOstrovski/torch7/releases{/id}","created_at":"2014-06-10T16:29:19Z","updated_at":"2015-01-26T12:41:06Z","pushed_at":"2015-01-26T16:09:23Z","git_url":"git://github.com/GeorgOstrovski/torch7.git","ssh_url":"git@github.com:GeorgOstrovski/torch7.git","clone_url":"https://github.com/GeorgOstrovski/torch7.git","svn_url":"https://github.com/GeorgOstrovski/torch7","homepage":null,"size":918,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"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":"torch:master","ref":"master","sha":"876d85070a7f2e29aad93363b711ed8f7dd87d6e","user":{"login":"torch","id":4978924,"avatar_url":"https://avatars.githubusercontent.com/u/4978924?v=3","gravatar_id":"","url":"https://api.github.com/users/torch","html_url":"https://github.com/torch","followers_url":"https://api.github.com/users/torch/followers","following_url":"https://api.github.com/users/torch/following{/other_user}","gists_url":"https://api.github.com/users/torch/gists{/gist_id}","starred_url":"https://api.github.com/users/torch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/torch/subscriptions","organizations_url":"https://api.github.com/users/torch/orgs","repos_url":"https://api.github.com/users/torch/repos","events_url":"https://api.github.com/users/torch/events{/privacy}","received_events_url":"https://api.github.com/users/torch/received_events","type":"Organization","site_admin":false},"repo":{"id":13677187,"name":"torch7","full_name":"torch/torch7","owner":{"login":"torch","id":4978924,"avatar_url":"https://avatars.githubusercontent.com/u/4978924?v=3","gravatar_id":"","url":"https://api.github.com/users/torch","html_url":"https://github.com/torch","followers_url":"https://api.github.com/users/torch/followers","following_url":"https://api.github.com/users/torch/following{/other_user}","gists_url":"https://api.github.com/users/torch/gists{/gist_id}","starred_url":"https://api.github.com/users/torch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/torch/subscriptions","organizations_url":"https://api.github.com/users/torch/orgs","repos_url":"https://api.github.com/users/torch/repos","events_url":"https://api.github.com/users/torch/events{/privacy}","received_events_url":"https://api.github.com/users/torch/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/torch/torch7","description":"","fork":false,"url":"https://api.github.com/repos/torch/torch7","forks_url":"https://api.github.com/repos/torch/torch7/forks","keys_url":"https://api.github.com/repos/torch/torch7/keys{/key_id}","collaborators_url":"https://api.github.com/repos/torch/torch7/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/torch/torch7/teams","hooks_url":"https://api.github.com/repos/torch/torch7/hooks","issue_events_url":"https://api.github.com/repos/torch/torch7/issues/events{/number}","events_url":"https://api.github.com/repos/torch/torch7/events","assignees_url":"https://api.github.com/repos/torch/torch7/assignees{/user}","branches_url":"https://api.github.com/repos/torch/torch7/branches{/branch}","tags_url":"https://api.github.com/repos/torch/torch7/tags","blobs_url":"https://api.github.com/repos/torch/torch7/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/torch/torch7/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/torch/torch7/git/refs{/sha}","trees_url":"https://api.github.com/repos/torch/torch7/git/trees{/sha}","statuses_url":"https://api.github.com/repos/torch/torch7/statuses/{sha}","languages_url":"https://api.github.com/repos/torch/torch7/languages","stargazers_url":"https://api.github.com/repos/torch/torch7/stargazers","contributors_url":"https://api.github.com/repos/torch/torch7/contributors","subscribers_url":"https://api.github.com/repos/torch/torch7/subscribers","subscription_url":"https://api.github.com/repos/torch/torch7/subscription","commits_url":"https://api.github.com/repos/torch/torch7/commits{/sha}","git_commits_url":"https://api.github.com/repos/torch/torch7/git/commits{/sha}","comments_url":"https://api.github.com/repos/torch/torch7/comments{/number}","issue_comment_url":"https://api.github.com/repos/torch/torch7/issues/comments/{number}","contents_url":"https://api.github.com/repos/torch/torch7/contents/{+path}","compare_url":"https://api.github.com/repos/torch/torch7/compare/{base}...{head}","merges_url":"https://api.github.com/repos/torch/torch7/merges","archive_url":"https://api.github.com/repos/torch/torch7/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/torch/torch7/downloads","issues_url":"https://api.github.com/repos/torch/torch7/issues{/number}","pulls_url":"https://api.github.com/repos/torch/torch7/pulls{/number}","milestones_url":"https://api.github.com/repos/torch/torch7/milestones{/number}","notifications_url":"https://api.github.com/repos/torch/torch7/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/torch/torch7/labels{/name}","releases_url":"https://api.github.com/repos/torch/torch7/releases{/id}","created_at":"2013-10-18T12:13:58Z","updated_at":"2015-01-26T16:22:22Z","pushed_at":"2015-01-24T06:22:21Z","git_url":"git://github.com/torch/torch7.git","ssh_url":"git@github.com:torch/torch7.git","clone_url":"https://github.com/torch/torch7.git","svn_url":"https://github.com/torch/torch7","homepage":null,"size":2464,"stargazers_count":1422,"watchers_count":1422,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":207,"mirror_url":null,"open_issues_count":11,"forks":207,"open_issues":11,"watchers":1422,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/torch/torch7/pulls/135"},"html":{"href":"https://github.com/torch/torch7/pull/135"},"issue":{"href":"https://api.github.com/repos/torch/torch7/issues/135"},"comments":{"href":"https://api.github.com/repos/torch/torch7/issues/135/comments"},"review_comments":{"href":"https://api.github.com/repos/torch/torch7/pulls/135/comments"},"review_comment":{"href":"https://api.github.com/repos/torch/torch7/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/torch/torch7/pulls/135/commits"},"statuses":{"href":"https://api.github.com/repos/torch/torch7/statuses/8ac79a1f7cb31f8f8626e229d433133a6ed5197e"}}}}