{"action":"created","comment":{"url":"https://api.github.com/repos/cmssnu/dolphin/pulls/comments/45307134","id":45307134,"diff_hunk":"@@ -0,0 +1,75 @@\n+/*\n+ * Copyright (C) 2015 Seoul National University\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ *         http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package edu.snu.dolphin.dnn.conf;\n+\n+import edu.snu.dolphin.dnn.layerparam.initializer.DefaultLayerParameterInitializer;\n+import edu.snu.dolphin.dnn.layerparam.initializer.LayerParameterInitializer;\n+import edu.snu.dolphin.dnn.layers.ActivationLayer;\n+import edu.snu.dolphin.dnn.layers.LayerBase;\n+import edu.snu.dolphin.dnn.proto.NeuralNetworkProtos;\n+import org.apache.reef.tang.Configuration;\n+import org.apache.reef.tang.Tang;\n+import org.apache.reef.util.Builder;\n+\n+/**\n+ * Configuration builder for activation layer.\n+ *\n+ * The configuration that this builder generates is used to create an activation layer instance.\n+ */\n+public final class ActivationLayerConfigurationBuilder implements Builder<Configuration> {\n+\n+  public static ActivationLayerConfigurationBuilder newConfigurationBuilder() {\n+    return new ActivationLayerConfigurationBuilder();\n+  }\n+\n+  private int numInput;\n+  private int numOutput;\n+  private String activationFunction;\n+\n+  public synchronized ActivationLayerConfigurationBuilder setNumInput(final int numInput) {\n+    this.numInput = numInput;\n+    return this;\n+  }\n+\n+  public synchronized ActivationLayerConfigurationBuilder setNumOutput(final int numOutput) {\n+    this.numOutput = numOutput;\n+    return this;\n+  }\n+\n+  public synchronized ActivationLayerConfigurationBuilder setActivationFunction(final String activationFunction) {\n+    this.activationFunction = activationFunction;\n+    return this;\n+  }\n+\n+  public synchronized ActivationLayerConfigurationBuilder fromProtoConfiguration(\n+      final NeuralNetworkProtos.LayerConfiguration protoConf) {\n+    numInput = protoConf.getNumInput();\n+    numOutput = protoConf.getNumOutput();\n+    activationFunction = protoConf.getActivationParam().getActivationFunction();\n+    return this;\n+  }\n+\n+  @Override\n+  public synchronized Configuration build() {\n+    return Tang.Factory.getTang().newConfigurationBuilder()\n+        .bindNamedParameter(LayerConfigurationParameters.NumberOfInput.class, String.valueOf(numInput))\n+        .bindNamedParameter(LayerConfigurationParameters.NumberOfOutput.class, String.valueOf(numOutput))\n+        .bindNamedParameter(LayerConfigurationParameters.ActivationFunction.class, String.valueOf(activationFunction))\n+        .bindImplementation(LayerBase.class, ActivationLayer.class)\n+        .bindImplementation(LayerParameterInitializer.class, DefaultLayerParameterInitializer.class)","path":"dolphin-dnn/src/main/java/edu/snu/dolphin/dnn/conf/ActivationLayerConfigurationBuilder.java","position":72,"original_position":72,"commit_id":"05b4439cd3bb75ed302af57eac8ab27872a82a01","original_commit_id":"05b4439cd3bb75ed302af57eac8ab27872a82a01","user":{"login":"jsjason","id":5705789,"avatar_url":"https://avatars.githubusercontent.com/u/5705789?v=3","gravatar_id":"","url":"https://api.github.com/users/jsjason","html_url":"https://github.com/jsjason","followers_url":"https://api.github.com/users/jsjason/followers","following_url":"https://api.github.com/users/jsjason/following{/other_user}","gists_url":"https://api.github.com/users/jsjason/gists{/gist_id}","starred_url":"https://api.github.com/users/jsjason/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jsjason/subscriptions","organizations_url":"https://api.github.com/users/jsjason/orgs","repos_url":"https://api.github.com/users/jsjason/repos","events_url":"https://api.github.com/users/jsjason/events{/privacy}","received_events_url":"https://api.github.com/users/jsjason/received_events","type":"User","site_admin":false},"body":"Can we make `DefaultLayerParameterInitializer` as the default implementation of `LayerParameterInitializer` and remove this line?","created_at":"2015-11-19T06:43:44Z","updated_at":"2015-11-19T06:43:44Z","html_url":"https://github.com/cmssnu/dolphin/pull/145#discussion_r45307134","pull_request_url":"https://api.github.com/repos/cmssnu/dolphin/pulls/145","_links":{"self":{"href":"https://api.github.com/repos/cmssnu/dolphin/pulls/comments/45307134"},"html":{"href":"https://github.com/cmssnu/dolphin/pull/145#discussion_r45307134"},"pull_request":{"href":"https://api.github.com/repos/cmssnu/dolphin/pulls/145"}}},"pull_request":{"url":"https://api.github.com/repos/cmssnu/dolphin/pulls/145","id":50742302,"html_url":"https://github.com/cmssnu/dolphin/pull/145","diff_url":"https://github.com/cmssnu/dolphin/pull/145.diff","patch_url":"https://github.com/cmssnu/dolphin/pull/145.patch","issue_url":"https://api.github.com/repos/cmssnu/dolphin/issues/145","number":145,"state":"open","locked":false,"title":"Separates activation functions from fully connected layers and Introduces activation layers","user":{"login":"beomyeol","id":7035999,"avatar_url":"https://avatars.githubusercontent.com/u/7035999?v=3","gravatar_id":"","url":"https://api.github.com/users/beomyeol","html_url":"https://github.com/beomyeol","followers_url":"https://api.github.com/users/beomyeol/followers","following_url":"https://api.github.com/users/beomyeol/following{/other_user}","gists_url":"https://api.github.com/users/beomyeol/gists{/gist_id}","starred_url":"https://api.github.com/users/beomyeol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beomyeol/subscriptions","organizations_url":"https://api.github.com/users/beomyeol/orgs","repos_url":"https://api.github.com/users/beomyeol/repos","events_url":"https://api.github.com/users/beomyeol/events{/privacy}","received_events_url":"https://api.github.com/users/beomyeol/received_events","type":"User","site_admin":false},"body":"This pull request removes activation functions from fully connected layers and introduces activation layers. The activation layer applies the activation function specified by the configuration file to its input value.\r\n\r\nThis pull request includes the following changes\r\n* Changes API of `LayerBase`'s '`backPropagate()` method.\r\n* Introduces `DefaultLayerParameterInitializer` and an empty layer parameter `EMPTY` for layers which are not learnable.\r\n* Changes the type of exceptions related to invalid indices from `RuntimeException` to `IllegalArgumentException`.\r\n* Fixes bugs related to indices in `backPropagateFromTo()`.\r\n* Fixes typo `isForward`.\r\n* Adds test for activation layers.\r\n\r\nThe change of `LayerBase`'s `backPropagate()` method API includes the removal of `nextParameter` and the introduction of `input`. The introduction of activation layers makes `nextParameter` unnecessary in `backPropagate()`. Also, although the input value is not needed now, it will be needed for computing gradients of some functions such as absolute value and power functions.\r\n\r\nThis closes #144.","created_at":"2015-11-15T08:25:19Z","updated_at":"2015-11-19T06:43:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d5d0c9444ba107ac3273bac02b42b11775a48559","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/cmssnu/dolphin/pulls/145/commits","review_comments_url":"https://api.github.com/repos/cmssnu/dolphin/pulls/145/comments","review_comment_url":"https://api.github.com/repos/cmssnu/dolphin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cmssnu/dolphin/issues/145/comments","statuses_url":"https://api.github.com/repos/cmssnu/dolphin/statuses/05b4439cd3bb75ed302af57eac8ab27872a82a01","head":{"label":"cmssnu:feature-144-separate_activation_function","ref":"feature-144-separate_activation_function","sha":"05b4439cd3bb75ed302af57eac8ab27872a82a01","user":{"login":"cmssnu","id":6446990,"avatar_url":"https://avatars.githubusercontent.com/u/6446990?v=3","gravatar_id":"","url":"https://api.github.com/users/cmssnu","html_url":"https://github.com/cmssnu","followers_url":"https://api.github.com/users/cmssnu/followers","following_url":"https://api.github.com/users/cmssnu/following{/other_user}","gists_url":"https://api.github.com/users/cmssnu/gists{/gist_id}","starred_url":"https://api.github.com/users/cmssnu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmssnu/subscriptions","organizations_url":"https://api.github.com/users/cmssnu/orgs","repos_url":"https://api.github.com/users/cmssnu/repos","events_url":"https://api.github.com/users/cmssnu/events{/privacy}","received_events_url":"https://api.github.com/users/cmssnu/received_events","type":"Organization","site_admin":false},"repo":{"id":24580061,"name":"dolphin","full_name":"cmssnu/dolphin","owner":{"login":"cmssnu","id":6446990,"avatar_url":"https://avatars.githubusercontent.com/u/6446990?v=3","gravatar_id":"","url":"https://api.github.com/users/cmssnu","html_url":"https://github.com/cmssnu","followers_url":"https://api.github.com/users/cmssnu/followers","following_url":"https://api.github.com/users/cmssnu/following{/other_user}","gists_url":"https://api.github.com/users/cmssnu/gists{/gist_id}","starred_url":"https://api.github.com/users/cmssnu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmssnu/subscriptions","organizations_url":"https://api.github.com/users/cmssnu/orgs","repos_url":"https://api.github.com/users/cmssnu/repos","events_url":"https://api.github.com/users/cmssnu/events{/privacy}","received_events_url":"https://api.github.com/users/cmssnu/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cmssnu/dolphin","description":"","fork":false,"url":"https://api.github.com/repos/cmssnu/dolphin","forks_url":"https://api.github.com/repos/cmssnu/dolphin/forks","keys_url":"https://api.github.com/repos/cmssnu/dolphin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cmssnu/dolphin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cmssnu/dolphin/teams","hooks_url":"https://api.github.com/repos/cmssnu/dolphin/hooks","issue_events_url":"https://api.github.com/repos/cmssnu/dolphin/issues/events{/number}","events_url":"https://api.github.com/repos/cmssnu/dolphin/events","assignees_url":"https://api.github.com/repos/cmssnu/dolphin/assignees{/user}","branches_url":"https://api.github.com/repos/cmssnu/dolphin/branches{/branch}","tags_url":"https://api.github.com/repos/cmssnu/dolphin/tags","blobs_url":"https://api.github.com/repos/cmssnu/dolphin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cmssnu/dolphin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cmssnu/dolphin/git/refs{/sha}","trees_url":"https://api.github.com/repos/cmssnu/dolphin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cmssnu/dolphin/statuses/{sha}","languages_url":"https://api.github.com/repos/cmssnu/dolphin/languages","stargazers_url":"https://api.github.com/repos/cmssnu/dolphin/stargazers","contributors_url":"https://api.github.com/repos/cmssnu/dolphin/contributors","subscribers_url":"https://api.github.com/repos/cmssnu/dolphin/subscribers","subscription_url":"https://api.github.com/repos/cmssnu/dolphin/subscription","commits_url":"https://api.github.com/repos/cmssnu/dolphin/commits{/sha}","git_commits_url":"https://api.github.com/repos/cmssnu/dolphin/git/commits{/sha}","comments_url":"https://api.github.com/repos/cmssnu/dolphin/comments{/number}","issue_comment_url":"https://api.github.com/repos/cmssnu/dolphin/issues/comments{/number}","contents_url":"https://api.github.com/repos/cmssnu/dolphin/contents/{+path}","compare_url":"https://api.github.com/repos/cmssnu/dolphin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cmssnu/dolphin/merges","archive_url":"https://api.github.com/repos/cmssnu/dolphin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cmssnu/dolphin/downloads","issues_url":"https://api.github.com/repos/cmssnu/dolphin/issues{/number}","pulls_url":"https://api.github.com/repos/cmssnu/dolphin/pulls{/number}","milestones_url":"https://api.github.com/repos/cmssnu/dolphin/milestones{/number}","notifications_url":"https://api.github.com/repos/cmssnu/dolphin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cmssnu/dolphin/labels{/name}","releases_url":"https://api.github.com/repos/cmssnu/dolphin/releases{/id}","created_at":"2014-09-29T04:33:24Z","updated_at":"2015-11-10T10:28:23Z","pushed_at":"2015-11-19T06:31:20Z","git_url":"git://github.com/cmssnu/dolphin.git","ssh_url":"git@github.com:cmssnu/dolphin.git","clone_url":"https://github.com/cmssnu/dolphin.git","svn_url":"https://github.com/cmssnu/dolphin","homepage":null,"size":2486,"stargazers_count":10,"watchers_count":10,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":41,"forks":3,"open_issues":41,"watchers":10,"default_branch":"master"}},"base":{"label":"cmssnu:master","ref":"master","sha":"92f5714c2206e4bd59ac7e0bae8e071fe8324f08","user":{"login":"cmssnu","id":6446990,"avatar_url":"https://avatars.githubusercontent.com/u/6446990?v=3","gravatar_id":"","url":"https://api.github.com/users/cmssnu","html_url":"https://github.com/cmssnu","followers_url":"https://api.github.com/users/cmssnu/followers","following_url":"https://api.github.com/users/cmssnu/following{/other_user}","gists_url":"https://api.github.com/users/cmssnu/gists{/gist_id}","starred_url":"https://api.github.com/users/cmssnu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmssnu/subscriptions","organizations_url":"https://api.github.com/users/cmssnu/orgs","repos_url":"https://api.github.com/users/cmssnu/repos","events_url":"https://api.github.com/users/cmssnu/events{/privacy}","received_events_url":"https://api.github.com/users/cmssnu/received_events","type":"Organization","site_admin":false},"repo":{"id":24580061,"name":"dolphin","full_name":"cmssnu/dolphin","owner":{"login":"cmssnu","id":6446990,"avatar_url":"https://avatars.githubusercontent.com/u/6446990?v=3","gravatar_id":"","url":"https://api.github.com/users/cmssnu","html_url":"https://github.com/cmssnu","followers_url":"https://api.github.com/users/cmssnu/followers","following_url":"https://api.github.com/users/cmssnu/following{/other_user}","gists_url":"https://api.github.com/users/cmssnu/gists{/gist_id}","starred_url":"https://api.github.com/users/cmssnu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmssnu/subscriptions","organizations_url":"https://api.github.com/users/cmssnu/orgs","repos_url":"https://api.github.com/users/cmssnu/repos","events_url":"https://api.github.com/users/cmssnu/events{/privacy}","received_events_url":"https://api.github.com/users/cmssnu/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cmssnu/dolphin","description":"","fork":false,"url":"https://api.github.com/repos/cmssnu/dolphin","forks_url":"https://api.github.com/repos/cmssnu/dolphin/forks","keys_url":"https://api.github.com/repos/cmssnu/dolphin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cmssnu/dolphin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cmssnu/dolphin/teams","hooks_url":"https://api.github.com/repos/cmssnu/dolphin/hooks","issue_events_url":"https://api.github.com/repos/cmssnu/dolphin/issues/events{/number}","events_url":"https://api.github.com/repos/cmssnu/dolphin/events","assignees_url":"https://api.github.com/repos/cmssnu/dolphin/assignees{/user}","branches_url":"https://api.github.com/repos/cmssnu/dolphin/branches{/branch}","tags_url":"https://api.github.com/repos/cmssnu/dolphin/tags","blobs_url":"https://api.github.com/repos/cmssnu/dolphin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cmssnu/dolphin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cmssnu/dolphin/git/refs{/sha}","trees_url":"https://api.github.com/repos/cmssnu/dolphin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cmssnu/dolphin/statuses/{sha}","languages_url":"https://api.github.com/repos/cmssnu/dolphin/languages","stargazers_url":"https://api.github.com/repos/cmssnu/dolphin/stargazers","contributors_url":"https://api.github.com/repos/cmssnu/dolphin/contributors","subscribers_url":"https://api.github.com/repos/cmssnu/dolphin/subscribers","subscription_url":"https://api.github.com/repos/cmssnu/dolphin/subscription","commits_url":"https://api.github.com/repos/cmssnu/dolphin/commits{/sha}","git_commits_url":"https://api.github.com/repos/cmssnu/dolphin/git/commits{/sha}","comments_url":"https://api.github.com/repos/cmssnu/dolphin/comments{/number}","issue_comment_url":"https://api.github.com/repos/cmssnu/dolphin/issues/comments{/number}","contents_url":"https://api.github.com/repos/cmssnu/dolphin/contents/{+path}","compare_url":"https://api.github.com/repos/cmssnu/dolphin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cmssnu/dolphin/merges","archive_url":"https://api.github.com/repos/cmssnu/dolphin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cmssnu/dolphin/downloads","issues_url":"https://api.github.com/repos/cmssnu/dolphin/issues{/number}","pulls_url":"https://api.github.com/repos/cmssnu/dolphin/pulls{/number}","milestones_url":"https://api.github.com/repos/cmssnu/dolphin/milestones{/number}","notifications_url":"https://api.github.com/repos/cmssnu/dolphin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cmssnu/dolphin/labels{/name}","releases_url":"https://api.github.com/repos/cmssnu/dolphin/releases{/id}","created_at":"2014-09-29T04:33:24Z","updated_at":"2015-11-10T10:28:23Z","pushed_at":"2015-11-19T06:31:20Z","git_url":"git://github.com/cmssnu/dolphin.git","ssh_url":"git@github.com:cmssnu/dolphin.git","clone_url":"https://github.com/cmssnu/dolphin.git","svn_url":"https://github.com/cmssnu/dolphin","homepage":null,"size":2486,"stargazers_count":10,"watchers_count":10,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":41,"forks":3,"open_issues":41,"watchers":10,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cmssnu/dolphin/pulls/145"},"html":{"href":"https://github.com/cmssnu/dolphin/pull/145"},"issue":{"href":"https://api.github.com/repos/cmssnu/dolphin/issues/145"},"comments":{"href":"https://api.github.com/repos/cmssnu/dolphin/issues/145/comments"},"review_comments":{"href":"https://api.github.com/repos/cmssnu/dolphin/pulls/145/comments"},"review_comment":{"href":"https://api.github.com/repos/cmssnu/dolphin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cmssnu/dolphin/pulls/145/commits"},"statuses":{"href":"https://api.github.com/repos/cmssnu/dolphin/statuses/05b4439cd3bb75ed302af57eac8ab27872a82a01"}}}}