{"action":"created","comment":{"url":"https://api.github.com/repos/mlpack/mlpack/pulls/comments/195505530","pull_request_review_id":128889098,"id":195505530,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5NTUwNTUzMA==","diff_hunk":"@@ -0,0 +1,133 @@\n+/**\n+ * @file subview.hpp\n+ * @author Haritha Nair\n+ *\n+ * Definition of the Subview class, which modifies the input as necessary.\n+ *\n+ * mlpack is free software; you may redistribute it and/or modify it under the\n+ * terms of the 3-clause BSD license.  You should have received a copy of the\n+ * 3-clause BSD license along with mlpack.  If not, see\n+ * http://www.opensource.org/licenses/BSD-3-Clause for more information.\n+ */\n+#ifndef MLPACK_METHODS_ANN_LAYER_SUBVIEW_HPP\n+#define MLPACK_METHODS_ANN_LAYER_SUBVIEW_HPP\n+\n+#include <mlpack/prereqs.hpp>\n+#include <mlpack/methods/ann/activation_functions/identity_function.hpp>\n+\n+namespace mlpack {\n+namespace ann {\n+\n+/**\n+ * Implementation of the subview layer. The subview layer modifies the input to\n+ * a submatrix of required size.\n+ *\n+ *\n+ * @tparam InputDataType Type of the input data (arma::colvec, arma::mat,\n+ *         arma::sp_mat or arma::cube).\n+ * @tparam OutputDataType Type of the output data (arma::colvec, arma::mat,\n+ *         arma::sp_mat or arma::cube).\n+ */\n+template <\n+    typename InputDataType = arma::mat,\n+    typename OutputDataType = arma::mat\n+>\n+class Subview\n+{\n+ public:\n+  /**\n+   * Create the Subview layer object using the specified range of input to accept.\n+   *\n+   * @param begin Start index.\n+   * @param end End index.\n+   */\n+  Subview(const size_t begin = 0, const size_t end = 0):\n+    begin(begin),\n+    end(end)\n+  {\n+    /* Nothing to do here */\n+  }\n+\n+  /**\n+   * Ordinary feed forward pass of a neural network, evaluating the function\n+   * f(x) by propagating the activity forward through f.\n+   *\n+   * @param input Input data used for evaluating the specified function.\n+   * @param output Resulting output activation.\n+   */\n+  template<typename InputType, typename OutputType>\n+  void Forward(InputType&& input, OutputType&& output)\n+  {\n+    // Check if input has been selected as required.\n+    if ((input.n_rows != (end-begin+1)) && (end != 0))\n+    {\n+      output = arma::mat(&input(begin), end - begin + 1, input.n_cols, false);\n+    }\n+    else\n+    {\n+      output = input;\n+    }\n+  }\n+\n+  /**\n+   * Ordinary feed backward pass of a neural network, calculating the function\n+   * f(x) by propagating x backwards trough f. Using the results from the feed\n+   * forward pass.\n+   *\n+   * @param input The propagated input activation.\n+   * @param gy The backpropagated error.\n+   * @param g The calculated gradient.\n+   */\n+  template<typename eT>\n+  void Backward(arma::Mat<eT>&& /* input */,\n+                arma::Mat<eT>&& gy,\n+                arma::Mat<eT>&& g)\n+  {\n+    g = gy;\n+  }\n+\n+  //! Get the input parameter.\n+  InputDataType const& InputParameter() const { return inputParameter; }\n+  //! Modify the input parameter.\n+  InputDataType& InputParameter() { return inputParameter; }\n+\n+  //! Get the output parameter.\n+  OutputDataType const& OutputParameter() const { return outputParameter; }\n+  //! Modify the output parameter.\n+  OutputDataType& OutputParameter() { return outputParameter; }\n+\n+  //! Get the delta.\n+  OutputDataType const& Delta() const { return delta; }\n+  //! Modify the delta.\n+  OutputDataType& Delta() { return delta; }\n+\n+  /**\n+   * Serialize the layer.\n+   */\n+  template<typename Archive>\n+  void serialize(Archive& /* ar */, const unsigned int /* version */)\n+  {\n+    /* Nothing to do here */","path":"src/mlpack/methods/ann/layer/subview.hpp","position":110,"original_position":110,"commit_id":"0a77b3567d1b5a1be09ebc9f66720adb0124f5eb","original_commit_id":"0a77b3567d1b5a1be09ebc9f66720adb0124f5eb","user":{"login":"zoq","id":4209744,"node_id":"MDQ6VXNlcjQyMDk3NDQ=","avatar_url":"https://avatars3.githubusercontent.com/u/4209744?v=4","gravatar_id":"","url":"https://api.github.com/users/zoq","html_url":"https://github.com/zoq","followers_url":"https://api.github.com/users/zoq/followers","following_url":"https://api.github.com/users/zoq/following{/other_user}","gists_url":"https://api.github.com/users/zoq/gists{/gist_id}","starred_url":"https://api.github.com/users/zoq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zoq/subscriptions","organizations_url":"https://api.github.com/users/zoq/orgs","repos_url":"https://api.github.com/users/zoq/repos","events_url":"https://api.github.com/users/zoq/events{/privacy}","received_events_url":"https://api.github.com/users/zoq/received_events","type":"User","site_admin":false},"body":"Right, nice catch, let me fix that.","created_at":"2018-06-14T17:22:10Z","updated_at":"2018-06-14T17:22:10Z","html_url":"https://github.com/mlpack/mlpack/pull/1428#discussion_r195505530","pull_request_url":"https://api.github.com/repos/mlpack/mlpack/pulls/1428","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/mlpack/mlpack/pulls/comments/195505530"},"html":{"href":"https://github.com/mlpack/mlpack/pull/1428#discussion_r195505530"},"pull_request":{"href":"https://api.github.com/repos/mlpack/mlpack/pulls/1428"}},"in_reply_to_id":195492380},"pull_request":{"url":"https://api.github.com/repos/mlpack/mlpack/pulls/1428","id":193842586,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkzODQyNTg2","html_url":"https://github.com/mlpack/mlpack/pull/1428","diff_url":"https://github.com/mlpack/mlpack/pull/1428.diff","patch_url":"https://github.com/mlpack/mlpack/pull/1428.patch","issue_url":"https://api.github.com/repos/mlpack/mlpack/issues/1428","number":1428,"state":"closed","locked":false,"title":"subview layer addition","user":{"login":"haritha1313","id":18036057,"node_id":"MDQ6VXNlcjE4MDM2MDU3","avatar_url":"https://avatars3.githubusercontent.com/u/18036057?v=4","gravatar_id":"","url":"https://api.github.com/users/haritha1313","html_url":"https://github.com/haritha1313","followers_url":"https://api.github.com/users/haritha1313/followers","following_url":"https://api.github.com/users/haritha1313/following{/other_user}","gists_url":"https://api.github.com/users/haritha1313/gists{/gist_id}","starred_url":"https://api.github.com/users/haritha1313/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haritha1313/subscriptions","organizations_url":"https://api.github.com/users/haritha1313/orgs","repos_url":"https://api.github.com/users/haritha1313/repos","events_url":"https://api.github.com/users/haritha1313/events{/privacy}","received_events_url":"https://api.github.com/users/haritha1313/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-06-10T19:35:13Z","updated_at":"2018-06-14T17:22:10Z","closed_at":"2018-06-14T10:59:29Z","merged_at":"2018-06-14T10:59:29Z","merge_commit_sha":"86bcca6f7b7eef2ad431180872d6b5fbe275f439","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/mlpack/mlpack/pulls/1428/commits","review_comments_url":"https://api.github.com/repos/mlpack/mlpack/pulls/1428/comments","review_comment_url":"https://api.github.com/repos/mlpack/mlpack/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mlpack/mlpack/issues/1428/comments","statuses_url":"https://api.github.com/repos/mlpack/mlpack/statuses/0a77b3567d1b5a1be09ebc9f66720adb0124f5eb","head":{"label":"haritha1313:SubviewLayer","ref":"SubviewLayer","sha":"0a77b3567d1b5a1be09ebc9f66720adb0124f5eb","user":{"login":"haritha1313","id":18036057,"node_id":"MDQ6VXNlcjE4MDM2MDU3","avatar_url":"https://avatars3.githubusercontent.com/u/18036057?v=4","gravatar_id":"","url":"https://api.github.com/users/haritha1313","html_url":"https://github.com/haritha1313","followers_url":"https://api.github.com/users/haritha1313/followers","following_url":"https://api.github.com/users/haritha1313/following{/other_user}","gists_url":"https://api.github.com/users/haritha1313/gists{/gist_id}","starred_url":"https://api.github.com/users/haritha1313/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haritha1313/subscriptions","organizations_url":"https://api.github.com/users/haritha1313/orgs","repos_url":"https://api.github.com/users/haritha1313/repos","events_url":"https://api.github.com/users/haritha1313/events{/privacy}","received_events_url":"https://api.github.com/users/haritha1313/received_events","type":"User","site_admin":false},"repo":{"id":113683272,"node_id":"MDEwOlJlcG9zaXRvcnkxMTM2ODMyNzI=","name":"mlpack","full_name":"haritha1313/mlpack","owner":{"login":"haritha1313","id":18036057,"node_id":"MDQ6VXNlcjE4MDM2MDU3","avatar_url":"https://avatars3.githubusercontent.com/u/18036057?v=4","gravatar_id":"","url":"https://api.github.com/users/haritha1313","html_url":"https://github.com/haritha1313","followers_url":"https://api.github.com/users/haritha1313/followers","following_url":"https://api.github.com/users/haritha1313/following{/other_user}","gists_url":"https://api.github.com/users/haritha1313/gists{/gist_id}","starred_url":"https://api.github.com/users/haritha1313/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haritha1313/subscriptions","organizations_url":"https://api.github.com/users/haritha1313/orgs","repos_url":"https://api.github.com/users/haritha1313/repos","events_url":"https://api.github.com/users/haritha1313/events{/privacy}","received_events_url":"https://api.github.com/users/haritha1313/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/haritha1313/mlpack","description":"mlpack: a scalable C++ machine learning library -- ","fork":true,"url":"https://api.github.com/repos/haritha1313/mlpack","forks_url":"https://api.github.com/repos/haritha1313/mlpack/forks","keys_url":"https://api.github.com/repos/haritha1313/mlpack/keys{/key_id}","collaborators_url":"https://api.github.com/repos/haritha1313/mlpack/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/haritha1313/mlpack/teams","hooks_url":"https://api.github.com/repos/haritha1313/mlpack/hooks","issue_events_url":"https://api.github.com/repos/haritha1313/mlpack/issues/events{/number}","events_url":"https://api.github.com/repos/haritha1313/mlpack/events","assignees_url":"https://api.github.com/repos/haritha1313/mlpack/assignees{/user}","branches_url":"https://api.github.com/repos/haritha1313/mlpack/branches{/branch}","tags_url":"https://api.github.com/repos/haritha1313/mlpack/tags","blobs_url":"https://api.github.com/repos/haritha1313/mlpack/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/haritha1313/mlpack/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/haritha1313/mlpack/git/refs{/sha}","trees_url":"https://api.github.com/repos/haritha1313/mlpack/git/trees{/sha}","statuses_url":"https://api.github.com/repos/haritha1313/mlpack/statuses/{sha}","languages_url":"https://api.github.com/repos/haritha1313/mlpack/languages","stargazers_url":"https://api.github.com/repos/haritha1313/mlpack/stargazers","contributors_url":"https://api.github.com/repos/haritha1313/mlpack/contributors","subscribers_url":"https://api.github.com/repos/haritha1313/mlpack/subscribers","subscription_url":"https://api.github.com/repos/haritha1313/mlpack/subscription","commits_url":"https://api.github.com/repos/haritha1313/mlpack/commits{/sha}","git_commits_url":"https://api.github.com/repos/haritha1313/mlpack/git/commits{/sha}","comments_url":"https://api.github.com/repos/haritha1313/mlpack/comments{/number}","issue_comment_url":"https://api.github.com/repos/haritha1313/mlpack/issues/comments{/number}","contents_url":"https://api.github.com/repos/haritha1313/mlpack/contents/{+path}","compare_url":"https://api.github.com/repos/haritha1313/mlpack/compare/{base}...{head}","merges_url":"https://api.github.com/repos/haritha1313/mlpack/merges","archive_url":"https://api.github.com/repos/haritha1313/mlpack/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/haritha1313/mlpack/downloads","issues_url":"https://api.github.com/repos/haritha1313/mlpack/issues{/number}","pulls_url":"https://api.github.com/repos/haritha1313/mlpack/pulls{/number}","milestones_url":"https://api.github.com/repos/haritha1313/mlpack/milestones{/number}","notifications_url":"https://api.github.com/repos/haritha1313/mlpack/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/haritha1313/mlpack/labels{/name}","releases_url":"https://api.github.com/repos/haritha1313/mlpack/releases{/id}","deployments_url":"https://api.github.com/repos/haritha1313/mlpack/deployments","created_at":"2017-12-09T16:21:16Z","updated_at":"2018-06-10T18:38:31Z","pushed_at":"2018-06-14T15:44:54Z","git_url":"git://github.com/haritha1313/mlpack.git","ssh_url":"git@github.com:haritha1313/mlpack.git","clone_url":"https://github.com/haritha1313/mlpack.git","svn_url":"https://github.com/haritha1313/mlpack","homepage":"http://www.mlpack.org/","size":243702,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mlpack:master","ref":"master","sha":"1959b50ccb9b2c3fa4dfea02abf3910cc6f88881","user":{"login":"mlpack","id":10216045,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEwMjE2MDQ1","avatar_url":"https://avatars0.githubusercontent.com/u/10216045?v=4","gravatar_id":"","url":"https://api.github.com/users/mlpack","html_url":"https://github.com/mlpack","followers_url":"https://api.github.com/users/mlpack/followers","following_url":"https://api.github.com/users/mlpack/following{/other_user}","gists_url":"https://api.github.com/users/mlpack/gists{/gist_id}","starred_url":"https://api.github.com/users/mlpack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mlpack/subscriptions","organizations_url":"https://api.github.com/users/mlpack/orgs","repos_url":"https://api.github.com/users/mlpack/repos","events_url":"https://api.github.com/users/mlpack/events{/privacy}","received_events_url":"https://api.github.com/users/mlpack/received_events","type":"Organization","site_admin":false},"repo":{"id":28149409,"node_id":"MDEwOlJlcG9zaXRvcnkyODE0OTQwOQ==","name":"mlpack","full_name":"mlpack/mlpack","owner":{"login":"mlpack","id":10216045,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEwMjE2MDQ1","avatar_url":"https://avatars0.githubusercontent.com/u/10216045?v=4","gravatar_id":"","url":"https://api.github.com/users/mlpack","html_url":"https://github.com/mlpack","followers_url":"https://api.github.com/users/mlpack/followers","following_url":"https://api.github.com/users/mlpack/following{/other_user}","gists_url":"https://api.github.com/users/mlpack/gists{/gist_id}","starred_url":"https://api.github.com/users/mlpack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mlpack/subscriptions","organizations_url":"https://api.github.com/users/mlpack/orgs","repos_url":"https://api.github.com/users/mlpack/repos","events_url":"https://api.github.com/users/mlpack/events{/privacy}","received_events_url":"https://api.github.com/users/mlpack/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mlpack/mlpack","description":"mlpack: a scalable C++ machine learning library -- ","fork":false,"url":"https://api.github.com/repos/mlpack/mlpack","forks_url":"https://api.github.com/repos/mlpack/mlpack/forks","keys_url":"https://api.github.com/repos/mlpack/mlpack/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mlpack/mlpack/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mlpack/mlpack/teams","hooks_url":"https://api.github.com/repos/mlpack/mlpack/hooks","issue_events_url":"https://api.github.com/repos/mlpack/mlpack/issues/events{/number}","events_url":"https://api.github.com/repos/mlpack/mlpack/events","assignees_url":"https://api.github.com/repos/mlpack/mlpack/assignees{/user}","branches_url":"https://api.github.com/repos/mlpack/mlpack/branches{/branch}","tags_url":"https://api.github.com/repos/mlpack/mlpack/tags","blobs_url":"https://api.github.com/repos/mlpack/mlpack/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mlpack/mlpack/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mlpack/mlpack/git/refs{/sha}","trees_url":"https://api.github.com/repos/mlpack/mlpack/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mlpack/mlpack/statuses/{sha}","languages_url":"https://api.github.com/repos/mlpack/mlpack/languages","stargazers_url":"https://api.github.com/repos/mlpack/mlpack/stargazers","contributors_url":"https://api.github.com/repos/mlpack/mlpack/contributors","subscribers_url":"https://api.github.com/repos/mlpack/mlpack/subscribers","subscription_url":"https://api.github.com/repos/mlpack/mlpack/subscription","commits_url":"https://api.github.com/repos/mlpack/mlpack/commits{/sha}","git_commits_url":"https://api.github.com/repos/mlpack/mlpack/git/commits{/sha}","comments_url":"https://api.github.com/repos/mlpack/mlpack/comments{/number}","issue_comment_url":"https://api.github.com/repos/mlpack/mlpack/issues/comments{/number}","contents_url":"https://api.github.com/repos/mlpack/mlpack/contents/{+path}","compare_url":"https://api.github.com/repos/mlpack/mlpack/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mlpack/mlpack/merges","archive_url":"https://api.github.com/repos/mlpack/mlpack/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mlpack/mlpack/downloads","issues_url":"https://api.github.com/repos/mlpack/mlpack/issues{/number}","pulls_url":"https://api.github.com/repos/mlpack/mlpack/pulls{/number}","milestones_url":"https://api.github.com/repos/mlpack/mlpack/milestones{/number}","notifications_url":"https://api.github.com/repos/mlpack/mlpack/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mlpack/mlpack/labels{/name}","releases_url":"https://api.github.com/repos/mlpack/mlpack/releases{/id}","deployments_url":"https://api.github.com/repos/mlpack/mlpack/deployments","created_at":"2014-12-17T18:16:59Z","updated_at":"2018-06-14T14:19:47Z","pushed_at":"2018-06-14T13:31:16Z","git_url":"git://github.com/mlpack/mlpack.git","ssh_url":"git@github.com:mlpack/mlpack.git","clone_url":"https://github.com/mlpack/mlpack.git","svn_url":"https://github.com/mlpack/mlpack","homepage":"http://www.mlpack.org/","size":243709,"stargazers_count":2229,"watchers_count":2229,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":815,"mirror_url":null,"archived":false,"open_issues_count":104,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":815,"open_issues":104,"watchers":2229,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mlpack/mlpack/pulls/1428"},"html":{"href":"https://github.com/mlpack/mlpack/pull/1428"},"issue":{"href":"https://api.github.com/repos/mlpack/mlpack/issues/1428"},"comments":{"href":"https://api.github.com/repos/mlpack/mlpack/issues/1428/comments"},"review_comments":{"href":"https://api.github.com/repos/mlpack/mlpack/pulls/1428/comments"},"review_comment":{"href":"https://api.github.com/repos/mlpack/mlpack/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mlpack/mlpack/pulls/1428/commits"},"statuses":{"href":"https://api.github.com/repos/mlpack/mlpack/statuses/0a77b3567d1b5a1be09ebc9f66720adb0124f5eb"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"zoq"}}