{"action":"created","comment":{"url":"https://api.github.com/repos/pfnet/chainer/pulls/comments/48395167","id":48395167,"diff_hunk":"@@ -0,0 +1,72 @@\n+import numpy\n+\n+from chainer import cuda\n+from chainer import function\n+from chainer.utils import type_check\n+\n+\n+class ELU(function.Function):\n+\n+    \"\"\"Exponential Linear Unit.\"\"\"\n+\n+    def __init__(self, alpha=1.0):\n+        self.alpha = numpy.float32(alpha)\n+\n+    def check_type_forward(self, in_types):\n+        type_check.expect(in_types.size() == 1)\n+        x_type, = in_types\n+\n+        type_check.expect(\n+            x_type.dtype == numpy.float32,\n+        )\n+\n+    def forward_cpu(self, x):\n+        y = x[0].copy()\n+        neg_indices = x[0] < 0\n+        y[neg_indices] = self.alpha * (numpy.exp(y[neg_indices]) - 1)\n+        return y,\n+\n+    def forward_gpu(self, x):\n+        y = cuda.elementwise(\n+            'T x, T alpha', 'T y',\n+            'y = x >= 0 ? x : alpha * (exp(x) - 1)', 'elu_fwd')(\n+                x[0], self.alpha)\n+        return y,\n+\n+    def backward_cpu(self, x, gy):\n+        gx = gy[0].copy()\n+        neg_indices = x[0] < 0\n+        gx[neg_indices] *= self.alpha * numpy.exp(x[0][neg_indices])\n+        return gx,\n+\n+    def backward_gpu(self, x, gy):\n+        gx = cuda.elementwise(\n+            'T x, T gy, T alpha', 'T gx',\n+            'gx = x >= 0 ? gy : gy * alpha * exp(x)', 'elu_bwd')(\n+                x[0], gy[0], self.alpha)\n+        return gx,\n+\n+\n+def elu(x, alpha=1.0):\n+    \"\"\"Exponential Linear Unit function.\n+","path":"chainer/functions/activation/elu.py","position":52,"original_position":52,"commit_id":"5babc8563348f7f8f169b97a186bf4ce624de6b0","original_commit_id":"5babc8563348f7f8f169b97a186bf4ce624de6b0","user":{"login":"delta2323","id":407052,"avatar_url":"https://avatars.githubusercontent.com/u/407052?v=3","gravatar_id":"","url":"https://api.github.com/users/delta2323","html_url":"https://github.com/delta2323","followers_url":"https://api.github.com/users/delta2323/followers","following_url":"https://api.github.com/users/delta2323/following{/other_user}","gists_url":"https://api.github.com/users/delta2323/gists{/gist_id}","starred_url":"https://api.github.com/users/delta2323/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/delta2323/subscriptions","organizations_url":"https://api.github.com/users/delta2323/orgs","repos_url":"https://api.github.com/users/delta2323/repos","events_url":"https://api.github.com/users/delta2323/events{/privacy}","received_events_url":"https://api.github.com/users/delta2323/received_events","type":"User","site_admin":false},"body":"Could you add the reference to ELU?","created_at":"2015-12-24T04:15:58Z","updated_at":"2015-12-24T04:15:58Z","html_url":"https://github.com/pfnet/chainer/pull/754#discussion_r48395167","pull_request_url":"https://api.github.com/repos/pfnet/chainer/pulls/754","_links":{"self":{"href":"https://api.github.com/repos/pfnet/chainer/pulls/comments/48395167"},"html":{"href":"https://github.com/pfnet/chainer/pull/754#discussion_r48395167"},"pull_request":{"href":"https://api.github.com/repos/pfnet/chainer/pulls/754"}}},"pull_request":{"url":"https://api.github.com/repos/pfnet/chainer/pulls/754","id":53480795,"html_url":"https://github.com/pfnet/chainer/pull/754","diff_url":"https://github.com/pfnet/chainer/pull/754.diff","patch_url":"https://github.com/pfnet/chainer/pull/754.patch","issue_url":"https://api.github.com/repos/pfnet/chainer/issues/754","number":754,"state":"open","locked":false,"title":"Implement ELU","user":{"login":"muupan","id":815970,"avatar_url":"https://avatars.githubusercontent.com/u/815970?v=3","gravatar_id":"","url":"https://api.github.com/users/muupan","html_url":"https://github.com/muupan","followers_url":"https://api.github.com/users/muupan/followers","following_url":"https://api.github.com/users/muupan/following{/other_user}","gists_url":"https://api.github.com/users/muupan/gists{/gist_id}","starred_url":"https://api.github.com/users/muupan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/muupan/subscriptions","organizations_url":"https://api.github.com/users/muupan/orgs","repos_url":"https://api.github.com/users/muupan/repos","events_url":"https://api.github.com/users/muupan/events{/privacy}","received_events_url":"https://api.github.com/users/muupan/received_events","type":"User","site_admin":false},"body":"This PR fixes #694.","created_at":"2015-12-12T17:23:39Z","updated_at":"2015-12-24T04:15:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0134e578982a34877b8dcfacf3fefd57f464613c","assignee":null,"milestone":{"url":"https://api.github.com/repos/pfnet/chainer/milestones/13","html_url":"https://github.com/pfnet/chainer/milestones/v1.6.0","labels_url":"https://api.github.com/repos/pfnet/chainer/milestones/13/labels","id":1438988,"number":13,"title":"v1.6.0","description":"","creator":{"login":"unnonouno","id":740680,"avatar_url":"https://avatars.githubusercontent.com/u/740680?v=3","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},"open_issues":17,"closed_issues":14,"state":"open","created_at":"2015-12-02T06:53:51Z","updated_at":"2015-12-24T01:25:05Z","due_on":"2016-01-19T15:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/pfnet/chainer/pulls/754/commits","review_comments_url":"https://api.github.com/repos/pfnet/chainer/pulls/754/comments","review_comment_url":"https://api.github.com/repos/pfnet/chainer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pfnet/chainer/issues/754/comments","statuses_url":"https://api.github.com/repos/pfnet/chainer/statuses/5babc8563348f7f8f169b97a186bf4ce624de6b0","head":{"label":"muupan:elu","ref":"elu","sha":"5babc8563348f7f8f169b97a186bf4ce624de6b0","user":{"login":"muupan","id":815970,"avatar_url":"https://avatars.githubusercontent.com/u/815970?v=3","gravatar_id":"","url":"https://api.github.com/users/muupan","html_url":"https://github.com/muupan","followers_url":"https://api.github.com/users/muupan/followers","following_url":"https://api.github.com/users/muupan/following{/other_user}","gists_url":"https://api.github.com/users/muupan/gists{/gist_id}","starred_url":"https://api.github.com/users/muupan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/muupan/subscriptions","organizations_url":"https://api.github.com/users/muupan/orgs","repos_url":"https://api.github.com/users/muupan/repos","events_url":"https://api.github.com/users/muupan/events{/privacy}","received_events_url":"https://api.github.com/users/muupan/received_events","type":"User","site_admin":false},"repo":{"id":37308816,"name":"chainer","full_name":"muupan/chainer","owner":{"login":"muupan","id":815970,"avatar_url":"https://avatars.githubusercontent.com/u/815970?v=3","gravatar_id":"","url":"https://api.github.com/users/muupan","html_url":"https://github.com/muupan","followers_url":"https://api.github.com/users/muupan/followers","following_url":"https://api.github.com/users/muupan/following{/other_user}","gists_url":"https://api.github.com/users/muupan/gists{/gist_id}","starred_url":"https://api.github.com/users/muupan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/muupan/subscriptions","organizations_url":"https://api.github.com/users/muupan/orgs","repos_url":"https://api.github.com/users/muupan/repos","events_url":"https://api.github.com/users/muupan/events{/privacy}","received_events_url":"https://api.github.com/users/muupan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/muupan/chainer","description":"A flexible framework of neural networks for deep learning","fork":true,"url":"https://api.github.com/repos/muupan/chainer","forks_url":"https://api.github.com/repos/muupan/chainer/forks","keys_url":"https://api.github.com/repos/muupan/chainer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/muupan/chainer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/muupan/chainer/teams","hooks_url":"https://api.github.com/repos/muupan/chainer/hooks","issue_events_url":"https://api.github.com/repos/muupan/chainer/issues/events{/number}","events_url":"https://api.github.com/repos/muupan/chainer/events","assignees_url":"https://api.github.com/repos/muupan/chainer/assignees{/user}","branches_url":"https://api.github.com/repos/muupan/chainer/branches{/branch}","tags_url":"https://api.github.com/repos/muupan/chainer/tags","blobs_url":"https://api.github.com/repos/muupan/chainer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/muupan/chainer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/muupan/chainer/git/refs{/sha}","trees_url":"https://api.github.com/repos/muupan/chainer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/muupan/chainer/statuses/{sha}","languages_url":"https://api.github.com/repos/muupan/chainer/languages","stargazers_url":"https://api.github.com/repos/muupan/chainer/stargazers","contributors_url":"https://api.github.com/repos/muupan/chainer/contributors","subscribers_url":"https://api.github.com/repos/muupan/chainer/subscribers","subscription_url":"https://api.github.com/repos/muupan/chainer/subscription","commits_url":"https://api.github.com/repos/muupan/chainer/commits{/sha}","git_commits_url":"https://api.github.com/repos/muupan/chainer/git/commits{/sha}","comments_url":"https://api.github.com/repos/muupan/chainer/comments{/number}","issue_comment_url":"https://api.github.com/repos/muupan/chainer/issues/comments{/number}","contents_url":"https://api.github.com/repos/muupan/chainer/contents/{+path}","compare_url":"https://api.github.com/repos/muupan/chainer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/muupan/chainer/merges","archive_url":"https://api.github.com/repos/muupan/chainer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/muupan/chainer/downloads","issues_url":"https://api.github.com/repos/muupan/chainer/issues{/number}","pulls_url":"https://api.github.com/repos/muupan/chainer/pulls{/number}","milestones_url":"https://api.github.com/repos/muupan/chainer/milestones{/number}","notifications_url":"https://api.github.com/repos/muupan/chainer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/muupan/chainer/labels{/name}","releases_url":"https://api.github.com/repos/muupan/chainer/releases{/id}","created_at":"2015-06-12T07:38:13Z","updated_at":"2015-06-12T07:38:13Z","pushed_at":"2015-12-12T17:26:07Z","git_url":"git://github.com/muupan/chainer.git","ssh_url":"git@github.com:muupan/chainer.git","clone_url":"https://github.com/muupan/chainer.git","svn_url":"https://github.com/muupan/chainer","homepage":"http://chainer.org","size":8779,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"pfnet:master","ref":"master","sha":"fbf7ea3a270f5e63cb06c9da9a1c610a68516d9f","user":{"login":"pfnet","id":9739572,"avatar_url":"https://avatars.githubusercontent.com/u/9739572?v=3","gravatar_id":"","url":"https://api.github.com/users/pfnet","html_url":"https://github.com/pfnet","followers_url":"https://api.github.com/users/pfnet/followers","following_url":"https://api.github.com/users/pfnet/following{/other_user}","gists_url":"https://api.github.com/users/pfnet/gists{/gist_id}","starred_url":"https://api.github.com/users/pfnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pfnet/subscriptions","organizations_url":"https://api.github.com/users/pfnet/orgs","repos_url":"https://api.github.com/users/pfnet/repos","events_url":"https://api.github.com/users/pfnet/events{/privacy}","received_events_url":"https://api.github.com/users/pfnet/received_events","type":"Organization","site_admin":false},"repo":{"id":36914478,"name":"chainer","full_name":"pfnet/chainer","owner":{"login":"pfnet","id":9739572,"avatar_url":"https://avatars.githubusercontent.com/u/9739572?v=3","gravatar_id":"","url":"https://api.github.com/users/pfnet","html_url":"https://github.com/pfnet","followers_url":"https://api.github.com/users/pfnet/followers","following_url":"https://api.github.com/users/pfnet/following{/other_user}","gists_url":"https://api.github.com/users/pfnet/gists{/gist_id}","starred_url":"https://api.github.com/users/pfnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pfnet/subscriptions","organizations_url":"https://api.github.com/users/pfnet/orgs","repos_url":"https://api.github.com/users/pfnet/repos","events_url":"https://api.github.com/users/pfnet/events{/privacy}","received_events_url":"https://api.github.com/users/pfnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pfnet/chainer","description":"A flexible framework of neural networks for deep learning","fork":false,"url":"https://api.github.com/repos/pfnet/chainer","forks_url":"https://api.github.com/repos/pfnet/chainer/forks","keys_url":"https://api.github.com/repos/pfnet/chainer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pfnet/chainer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pfnet/chainer/teams","hooks_url":"https://api.github.com/repos/pfnet/chainer/hooks","issue_events_url":"https://api.github.com/repos/pfnet/chainer/issues/events{/number}","events_url":"https://api.github.com/repos/pfnet/chainer/events","assignees_url":"https://api.github.com/repos/pfnet/chainer/assignees{/user}","branches_url":"https://api.github.com/repos/pfnet/chainer/branches{/branch}","tags_url":"https://api.github.com/repos/pfnet/chainer/tags","blobs_url":"https://api.github.com/repos/pfnet/chainer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pfnet/chainer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pfnet/chainer/git/refs{/sha}","trees_url":"https://api.github.com/repos/pfnet/chainer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pfnet/chainer/statuses/{sha}","languages_url":"https://api.github.com/repos/pfnet/chainer/languages","stargazers_url":"https://api.github.com/repos/pfnet/chainer/stargazers","contributors_url":"https://api.github.com/repos/pfnet/chainer/contributors","subscribers_url":"https://api.github.com/repos/pfnet/chainer/subscribers","subscription_url":"https://api.github.com/repos/pfnet/chainer/subscription","commits_url":"https://api.github.com/repos/pfnet/chainer/commits{/sha}","git_commits_url":"https://api.github.com/repos/pfnet/chainer/git/commits{/sha}","comments_url":"https://api.github.com/repos/pfnet/chainer/comments{/number}","issue_comment_url":"https://api.github.com/repos/pfnet/chainer/issues/comments{/number}","contents_url":"https://api.github.com/repos/pfnet/chainer/contents/{+path}","compare_url":"https://api.github.com/repos/pfnet/chainer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pfnet/chainer/merges","archive_url":"https://api.github.com/repos/pfnet/chainer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pfnet/chainer/downloads","issues_url":"https://api.github.com/repos/pfnet/chainer/issues{/number}","pulls_url":"https://api.github.com/repos/pfnet/chainer/pulls{/number}","milestones_url":"https://api.github.com/repos/pfnet/chainer/milestones{/number}","notifications_url":"https://api.github.com/repos/pfnet/chainer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pfnet/chainer/labels{/name}","releases_url":"https://api.github.com/repos/pfnet/chainer/releases{/id}","created_at":"2015-06-05T05:50:37Z","updated_at":"2015-12-23T15:57:59Z","pushed_at":"2015-12-24T01:25:05Z","git_url":"git://github.com/pfnet/chainer.git","ssh_url":"git@github.com:pfnet/chainer.git","clone_url":"https://github.com/pfnet/chainer.git","svn_url":"https://github.com/pfnet/chainer","homepage":"http://chainer.org","size":12080,"stargazers_count":1032,"watchers_count":1032,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":179,"mirror_url":null,"open_issues_count":133,"forks":179,"open_issues":133,"watchers":1032,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pfnet/chainer/pulls/754"},"html":{"href":"https://github.com/pfnet/chainer/pull/754"},"issue":{"href":"https://api.github.com/repos/pfnet/chainer/issues/754"},"comments":{"href":"https://api.github.com/repos/pfnet/chainer/issues/754/comments"},"review_comments":{"href":"https://api.github.com/repos/pfnet/chainer/pulls/754/comments"},"review_comment":{"href":"https://api.github.com/repos/pfnet/chainer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pfnet/chainer/pulls/754/commits"},"statuses":{"href":"https://api.github.com/repos/pfnet/chainer/statuses/5babc8563348f7f8f169b97a186bf4ce624de6b0"}}}}