{"action":"created","comment":{"url":"https://api.github.com/repos/chainer/chainer/pulls/comments/152904478","pull_request_review_id":78837790,"id":152904478,"diff_hunk":"@@ -323,18 +329,15 @@ def connectionist_temporal_classification(\n         raise TypeError('x must be a list of Variables')\n     if not isinstance(blank_symbol, int):\n         raise TypeError('blank_symbol must be non-negative integer.')\n-    assert blank_symbol >= 0\n-    assert blank_symbol < x[0].shape[1]\n+    assert 0 <= blank_symbol < x[0].shape[1]\n     # This implementation only supports 1-dimensional data.\n     # TODO(jnishi): Support d(>1)-dimentinal inputs.\n-    assert(len(x[0].shape) == 2)\n+    assert(x[0].ndim == 2)\n \n     if input_length is None:\n-        xp = cuda.get_array_module(x[0].data)\n-        input_length = variable.Variable(\n-            xp.full((len(x[0].data),), len(x), dtype=numpy.int32))\n-        label_length = variable.Variable(\n-            xp.full((len(t.data),), len(t.data[0]), dtype=numpy.int32))\n+        xp = cuda.get_array_module(x[0])\n+        input_length = xp.full(len(x[0]), len(x), dtype=numpy.int32)\n+        label_length = xp.full(len(t), t.shape[1], dtype=numpy.int32)","path":"chainer/functions/loss/ctc.py","position":57,"original_position":57,"commit_id":"5ec5be036f9436a08eda55812394ec894f8778c7","original_commit_id":"0446376c7c73ab988e6878d4fcb66bfee6be3b4f","user":{"login":"niboshi","id":635436,"avatar_url":"https://avatars0.githubusercontent.com/u/635436?v=4","gravatar_id":"","url":"https://api.github.com/users/niboshi","html_url":"https://github.com/niboshi","followers_url":"https://api.github.com/users/niboshi/followers","following_url":"https://api.github.com/users/niboshi/following{/other_user}","gists_url":"https://api.github.com/users/niboshi/gists{/gist_id}","starred_url":"https://api.github.com/users/niboshi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/niboshi/subscriptions","organizations_url":"https://api.github.com/users/niboshi/orgs","repos_url":"https://api.github.com/users/niboshi/repos","events_url":"https://api.github.com/users/niboshi/events{/privacy}","received_events_url":"https://api.github.com/users/niboshi/received_events","type":"User","site_admin":false},"body":"For consistency and explicitness.\r\n`len(t)` is inconsistent with `t.shape[1]`.\r\nIn `len(x[0])`, `x[0]` could be a tuple, list, ...etc. But if it's written as `x[0].shape[0]`, it's almost certain that `x[0]` is `ndarray`.\r\n\r\nFrom the Zen of Python: \"*Explicit is better than implicit.*\"\r\n","created_at":"2017-11-24T06:39:44Z","updated_at":"2017-11-24T06:39:44Z","html_url":"https://github.com/chainer/chainer/pull/3842#discussion_r152904478","pull_request_url":"https://api.github.com/repos/chainer/chainer/pulls/3842","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/chainer/chainer/pulls/comments/152904478"},"html":{"href":"https://github.com/chainer/chainer/pull/3842#discussion_r152904478"},"pull_request":{"href":"https://api.github.com/repos/chainer/chainer/pulls/3842"}},"in_reply_to_id":152164132},"pull_request":{"url":"https://api.github.com/repos/chainer/chainer/pulls/3842","id":152064536,"html_url":"https://github.com/chainer/chainer/pull/3842","diff_url":"https://github.com/chainer/chainer/pull/3842.diff","patch_url":"https://github.com/chainer/chainer/pull/3842.patch","issue_url":"https://api.github.com/repos/chainer/chainer/issues/3842","number":3842,"state":"open","locked":false,"title":"Simplify CTC code","user":{"login":"unnonouno","id":740680,"avatar_url":"https://avatars1.githubusercontent.com/u/740680?v=4","gravatar_id":"","url":"https://api.github.com/users/unnonouno","html_url":"https://github.com/unnonouno","followers_url":"https://api.github.com/users/unnonouno/followers","following_url":"https://api.github.com/users/unnonouno/following{/other_user}","gists_url":"https://api.github.com/users/unnonouno/gists{/gist_id}","starred_url":"https://api.github.com/users/unnonouno/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unnonouno/subscriptions","organizations_url":"https://api.github.com/users/unnonouno/orgs","repos_url":"https://api.github.com/users/unnonouno/repos","events_url":"https://api.github.com/users/unnonouno/events{/privacy}","received_events_url":"https://api.github.com/users/unnonouno/received_events","type":"User","site_admin":false},"body":"I simplified CTC. It also support ndarray without Variable wrap.","created_at":"2017-11-11T16:46:36Z","updated_at":"2017-11-24T06:39:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9b29d7e3f5dd8cca1891e5e33bc4b9b74ecd1b1d","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/chainer/chainer/pulls/3842/commits","review_comments_url":"https://api.github.com/repos/chainer/chainer/pulls/3842/comments","review_comment_url":"https://api.github.com/repos/chainer/chainer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/chainer/chainer/issues/3842/comments","statuses_url":"https://api.github.com/repos/chainer/chainer/statuses/5ec5be036f9436a08eda55812394ec894f8778c7","head":{"label":"unnonouno:simplify-ctc","ref":"simplify-ctc","sha":"5ec5be036f9436a08eda55812394ec894f8778c7","user":{"login":"unnonouno","id":740680,"avatar_url":"https://avatars1.githubusercontent.com/u/740680?v=4","gravatar_id":"","url":"https://api.github.com/users/unnonouno","html_url":"https://github.com/unnonouno","followers_url":"https://api.github.com/users/unnonouno/followers","following_url":"https://api.github.com/users/unnonouno/following{/other_user}","gists_url":"https://api.github.com/users/unnonouno/gists{/gist_id}","starred_url":"https://api.github.com/users/unnonouno/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unnonouno/subscriptions","organizations_url":"https://api.github.com/users/unnonouno/orgs","repos_url":"https://api.github.com/users/unnonouno/repos","events_url":"https://api.github.com/users/unnonouno/events{/privacy}","received_events_url":"https://api.github.com/users/unnonouno/received_events","type":"User","site_admin":false},"repo":{"id":37111344,"name":"chainer","full_name":"unnonouno/chainer","owner":{"login":"unnonouno","id":740680,"avatar_url":"https://avatars1.githubusercontent.com/u/740680?v=4","gravatar_id":"","url":"https://api.github.com/users/unnonouno","html_url":"https://github.com/unnonouno","followers_url":"https://api.github.com/users/unnonouno/followers","following_url":"https://api.github.com/users/unnonouno/following{/other_user}","gists_url":"https://api.github.com/users/unnonouno/gists{/gist_id}","starred_url":"https://api.github.com/users/unnonouno/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unnonouno/subscriptions","organizations_url":"https://api.github.com/users/unnonouno/orgs","repos_url":"https://api.github.com/users/unnonouno/repos","events_url":"https://api.github.com/users/unnonouno/events{/privacy}","received_events_url":"https://api.github.com/users/unnonouno/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/unnonouno/chainer","description":"A flexible framework of neural networks","fork":true,"url":"https://api.github.com/repos/unnonouno/chainer","forks_url":"https://api.github.com/repos/unnonouno/chainer/forks","keys_url":"https://api.github.com/repos/unnonouno/chainer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/unnonouno/chainer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/unnonouno/chainer/teams","hooks_url":"https://api.github.com/repos/unnonouno/chainer/hooks","issue_events_url":"https://api.github.com/repos/unnonouno/chainer/issues/events{/number}","events_url":"https://api.github.com/repos/unnonouno/chainer/events","assignees_url":"https://api.github.com/repos/unnonouno/chainer/assignees{/user}","branches_url":"https://api.github.com/repos/unnonouno/chainer/branches{/branch}","tags_url":"https://api.github.com/repos/unnonouno/chainer/tags","blobs_url":"https://api.github.com/repos/unnonouno/chainer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/unnonouno/chainer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/unnonouno/chainer/git/refs{/sha}","trees_url":"https://api.github.com/repos/unnonouno/chainer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/unnonouno/chainer/statuses/{sha}","languages_url":"https://api.github.com/repos/unnonouno/chainer/languages","stargazers_url":"https://api.github.com/repos/unnonouno/chainer/stargazers","contributors_url":"https://api.github.com/repos/unnonouno/chainer/contributors","subscribers_url":"https://api.github.com/repos/unnonouno/chainer/subscribers","subscription_url":"https://api.github.com/repos/unnonouno/chainer/subscription","commits_url":"https://api.github.com/repos/unnonouno/chainer/commits{/sha}","git_commits_url":"https://api.github.com/repos/unnonouno/chainer/git/commits{/sha}","comments_url":"https://api.github.com/repos/unnonouno/chainer/comments{/number}","issue_comment_url":"https://api.github.com/repos/unnonouno/chainer/issues/comments{/number}","contents_url":"https://api.github.com/repos/unnonouno/chainer/contents/{+path}","compare_url":"https://api.github.com/repos/unnonouno/chainer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/unnonouno/chainer/merges","archive_url":"https://api.github.com/repos/unnonouno/chainer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/unnonouno/chainer/downloads","issues_url":"https://api.github.com/repos/unnonouno/chainer/issues{/number}","pulls_url":"https://api.github.com/repos/unnonouno/chainer/pulls{/number}","milestones_url":"https://api.github.com/repos/unnonouno/chainer/milestones{/number}","notifications_url":"https://api.github.com/repos/unnonouno/chainer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/unnonouno/chainer/labels{/name}","releases_url":"https://api.github.com/repos/unnonouno/chainer/releases{/id}","deployments_url":"https://api.github.com/repos/unnonouno/chainer/deployments","created_at":"2015-06-09T05:03:37Z","updated_at":"2017-06-01T06:07:46Z","pushed_at":"2017-11-24T05:35:34Z","git_url":"git://github.com/unnonouno/chainer.git","ssh_url":"git@github.com:unnonouno/chainer.git","clone_url":"https://github.com/unnonouno/chainer.git","svn_url":"https://github.com/unnonouno/chainer","homepage":"http://chainer.org","size":23206,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"chainer:master","ref":"master","sha":"ff3e815bcb2a540dbaab862b5d7efa09a2484a81","user":{"login":"chainer","id":23183003,"avatar_url":"https://avatars3.githubusercontent.com/u/23183003?v=4","gravatar_id":"","url":"https://api.github.com/users/chainer","html_url":"https://github.com/chainer","followers_url":"https://api.github.com/users/chainer/followers","following_url":"https://api.github.com/users/chainer/following{/other_user}","gists_url":"https://api.github.com/users/chainer/gists{/gist_id}","starred_url":"https://api.github.com/users/chainer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chainer/subscriptions","organizations_url":"https://api.github.com/users/chainer/orgs","repos_url":"https://api.github.com/users/chainer/repos","events_url":"https://api.github.com/users/chainer/events{/privacy}","received_events_url":"https://api.github.com/users/chainer/received_events","type":"Organization","site_admin":false},"repo":{"id":36914478,"name":"chainer","full_name":"chainer/chainer","owner":{"login":"chainer","id":23183003,"avatar_url":"https://avatars3.githubusercontent.com/u/23183003?v=4","gravatar_id":"","url":"https://api.github.com/users/chainer","html_url":"https://github.com/chainer","followers_url":"https://api.github.com/users/chainer/followers","following_url":"https://api.github.com/users/chainer/following{/other_user}","gists_url":"https://api.github.com/users/chainer/gists{/gist_id}","starred_url":"https://api.github.com/users/chainer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chainer/subscriptions","organizations_url":"https://api.github.com/users/chainer/orgs","repos_url":"https://api.github.com/users/chainer/repos","events_url":"https://api.github.com/users/chainer/events{/privacy}","received_events_url":"https://api.github.com/users/chainer/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/chainer/chainer","description":"A flexible framework of neural networks for deep learning","fork":false,"url":"https://api.github.com/repos/chainer/chainer","forks_url":"https://api.github.com/repos/chainer/chainer/forks","keys_url":"https://api.github.com/repos/chainer/chainer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chainer/chainer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chainer/chainer/teams","hooks_url":"https://api.github.com/repos/chainer/chainer/hooks","issue_events_url":"https://api.github.com/repos/chainer/chainer/issues/events{/number}","events_url":"https://api.github.com/repos/chainer/chainer/events","assignees_url":"https://api.github.com/repos/chainer/chainer/assignees{/user}","branches_url":"https://api.github.com/repos/chainer/chainer/branches{/branch}","tags_url":"https://api.github.com/repos/chainer/chainer/tags","blobs_url":"https://api.github.com/repos/chainer/chainer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chainer/chainer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chainer/chainer/git/refs{/sha}","trees_url":"https://api.github.com/repos/chainer/chainer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chainer/chainer/statuses/{sha}","languages_url":"https://api.github.com/repos/chainer/chainer/languages","stargazers_url":"https://api.github.com/repos/chainer/chainer/stargazers","contributors_url":"https://api.github.com/repos/chainer/chainer/contributors","subscribers_url":"https://api.github.com/repos/chainer/chainer/subscribers","subscription_url":"https://api.github.com/repos/chainer/chainer/subscription","commits_url":"https://api.github.com/repos/chainer/chainer/commits{/sha}","git_commits_url":"https://api.github.com/repos/chainer/chainer/git/commits{/sha}","comments_url":"https://api.github.com/repos/chainer/chainer/comments{/number}","issue_comment_url":"https://api.github.com/repos/chainer/chainer/issues/comments{/number}","contents_url":"https://api.github.com/repos/chainer/chainer/contents/{+path}","compare_url":"https://api.github.com/repos/chainer/chainer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chainer/chainer/merges","archive_url":"https://api.github.com/repos/chainer/chainer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chainer/chainer/downloads","issues_url":"https://api.github.com/repos/chainer/chainer/issues{/number}","pulls_url":"https://api.github.com/repos/chainer/chainer/pulls{/number}","milestones_url":"https://api.github.com/repos/chainer/chainer/milestones{/number}","notifications_url":"https://api.github.com/repos/chainer/chainer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chainer/chainer/labels{/name}","releases_url":"https://api.github.com/repos/chainer/chainer/releases{/id}","deployments_url":"https://api.github.com/repos/chainer/chainer/deployments","created_at":"2015-06-05T05:50:37Z","updated_at":"2017-11-24T03:58:42Z","pushed_at":"2017-11-24T05:40:14Z","git_url":"git://github.com/chainer/chainer.git","ssh_url":"git@github.com:chainer/chainer.git","clone_url":"https://github.com/chainer/chainer.git","svn_url":"https://github.com/chainer/chainer","homepage":"https://chainer.org","size":19055,"stargazers_count":3174,"watchers_count":3174,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":849,"mirror_url":null,"archived":false,"open_issues_count":244,"forks":849,"open_issues":244,"watchers":3174,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/chainer/chainer/pulls/3842"},"html":{"href":"https://github.com/chainer/chainer/pull/3842"},"issue":{"href":"https://api.github.com/repos/chainer/chainer/issues/3842"},"comments":{"href":"https://api.github.com/repos/chainer/chainer/issues/3842/comments"},"review_comments":{"href":"https://api.github.com/repos/chainer/chainer/pulls/3842/comments"},"review_comment":{"href":"https://api.github.com/repos/chainer/chainer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/chainer/chainer/pulls/3842/commits"},"statuses":{"href":"https://api.github.com/repos/chainer/chainer/statuses/5ec5be036f9436a08eda55812394ec894f8778c7"}},"author_association":"OWNER"}}
{"actor":{"display_login":"niboshi"}}