{"action":"created","issue":{"url":"https://api.github.com/repos/torch/torch7/issues/619","repository_url":"https://api.github.com/repos/torch/torch7","labels_url":"https://api.github.com/repos/torch/torch7/issues/619/labels{/name}","comments_url":"https://api.github.com/repos/torch/torch7/issues/619/comments","events_url":"https://api.github.com/repos/torch/torch7/issues/619/events","html_url":"https://github.com/torch/torch7/pull/619","id":143799955,"number":619,"title":"Alternate implementation of torch.chunk()","user":{"login":"andreaskoepf","id":9976399,"avatar_url":"https://avatars.githubusercontent.com/u/9976399?v=3","gravatar_id":"","url":"https://api.github.com/users/andreaskoepf","html_url":"https://github.com/andreaskoepf","followers_url":"https://api.github.com/users/andreaskoepf/followers","following_url":"https://api.github.com/users/andreaskoepf/following{/other_user}","gists_url":"https://api.github.com/users/andreaskoepf/gists{/gist_id}","starred_url":"https://api.github.com/users/andreaskoepf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andreaskoepf/subscriptions","organizations_url":"https://api.github.com/users/andreaskoepf/orgs","repos_url":"https://api.github.com/users/andreaskoepf/repos","events_url":"https://api.github.com/users/andreaskoepf/events{/privacy}","received_events_url":"https://api.github.com/users/andreaskoepf/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2016-03-27T11:28:18Z","updated_at":"2016-04-17T14:28:07Z","closed_at":"2016-04-17T14:28:07Z","pull_request":{"url":"https://api.github.com/repos/torch/torch7/pulls/619","html_url":"https://github.com/torch/torch7/pull/619","diff_url":"https://github.com/torch/torch7/pull/619.diff","patch_url":"https://github.com/torch/torch7/pull/619.patch"},"body":"This PR tries to address https://github.com/torch/torch7/issues/617. The new implementation returns a table with nChunk entries, even in the case that the tensor has < nChunk entries in the specified dimension. \r\n\r\nTODO: If new behaviour is as intended the documentation has to be updated since it currently says chunk() would use split().\r\n\r\nOld behaviour:\r\n```\r\nth> torch.rand(11):chunk(5)\r\n{\r\n  1 : DoubleTensor - size: 3\r\n  2 : DoubleTensor - size: 3\r\n  3 : DoubleTensor - size: 3\r\n  4 : DoubleTensor - size: 2\r\n}\r\n\r\nth> torch.rand(10):chunk(7)\r\n{\r\n  1 : DoubleTensor - size: 2\r\n  2 : DoubleTensor - size: 2\r\n  3 : DoubleTensor - size: 2\r\n  4 : DoubleTensor - size: 2\r\n  5 : DoubleTensor - size: 2\r\n}\r\n\r\nth> torch.rand(5):chunk(10)\r\n{\r\n  1 : DoubleTensor - size: 1\r\n  2 : DoubleTensor - size: 1\r\n  3 : DoubleTensor - size: 1\r\n  4 : DoubleTensor - size: 1\r\n  5 : DoubleTensor - size: 1\r\n}\r\n```\r\n\r\nNew behaviour:\r\n```\r\nth> torch.rand(11):chunk(5)\r\n{\r\n  1 : DoubleTensor - size: 3\r\n  2 : DoubleTensor - size: 2\r\n  3 : DoubleTensor - size: 2\r\n  4 : DoubleTensor - size: 2\r\n  5 : DoubleTensor - size: 2\r\n}\r\n\r\nth> torch.rand(10):chunk(7)\r\n{\r\n  1 : DoubleTensor - size: 2\r\n  2 : DoubleTensor - size: 1\r\n  3 : DoubleTensor - size: 2\r\n  4 : DoubleTensor - size: 1\r\n  5 : DoubleTensor - size: 2\r\n  6 : DoubleTensor - size: 1\r\n  7 : DoubleTensor - size: 1\r\n}\r\n\r\nth> torch.rand(5):chunk(10)\r\n{\r\n  1 : DoubleTensor - size: 1\r\n  2 : DoubleTensor - empty\r\n  3 : DoubleTensor - size: 1\r\n  4 : DoubleTensor - empty\r\n  5 : DoubleTensor - size: 1\r\n  6 : DoubleTensor - empty\r\n  7 : DoubleTensor - size: 1\r\n  8 : DoubleTensor - empty\r\n  9 : DoubleTensor - size: 1\r\n  10 : DoubleTensor - empty\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/torch/torch7/issues/comments/211028721","html_url":"https://github.com/torch/torch7/pull/619#issuecomment-211028721","issue_url":"https://api.github.com/repos/torch/torch7/issues/619","id":211028721,"user":{"login":"andreaskoepf","id":9976399,"avatar_url":"https://avatars.githubusercontent.com/u/9976399?v=3","gravatar_id":"","url":"https://api.github.com/users/andreaskoepf","html_url":"https://github.com/andreaskoepf","followers_url":"https://api.github.com/users/andreaskoepf/followers","following_url":"https://api.github.com/users/andreaskoepf/following{/other_user}","gists_url":"https://api.github.com/users/andreaskoepf/gists{/gist_id}","starred_url":"https://api.github.com/users/andreaskoepf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andreaskoepf/subscriptions","organizations_url":"https://api.github.com/users/andreaskoepf/orgs","repos_url":"https://api.github.com/users/andreaskoepf/repos","events_url":"https://api.github.com/users/andreaskoepf/events{/privacy}","received_events_url":"https://api.github.com/users/andreaskoepf/received_events","type":"User","site_admin":false},"created_at":"2016-04-17T14:28:07Z","updated_at":"2016-04-17T14:28:07Z","body":"OK, #617 solved as 'by-design'."}}