{"action":"created","comment":{"url":"https://api.github.com/repos/dmlc/mxnet/pulls/comments/116408690","pull_request_review_id":38027101,"id":116408690,"diff_hunk":"@@ -0,0 +1,355 @@\n+# coding: utf-8\n+# pylint: disable= arguments-differ\n+\"\"\"Neural network layers.\"\"\"\n+\n+from ... import symbol, ndarray\n+from ...symbol import Symbol\n+from ...ndarray import NDArray\n+from .parameter import Parameter, ParameterDict\n+\n+\n+class Layer(object):\n+    \"\"\"Base class for all neural network layers and models.\n+\n+    Your models should subclass this class.\n+\n+    Layers can also contain other Layers, allowing you to nest them in a tree\n+    structure. You can assign sublayers as regular attributes::\n+        from mxnet import nn\n+        class Net(nn.Layer):\n+            def __init__(self, prefix=None, params=None):\n+                super(Net, self).__init__(prefix=prefix, params=params)\n+                self.dense1 = nn.Dense(20, in_units=10, prefix=self.prefix+'dense1_')\n+                self.dense2 = nn.Dense(20, in_units=20, prefix=self.prefix+'dense2_')\n+\n+            def forward(self, x):\n+                x = self.dense1(x)\n+                return self.dense2(x)\n+\n+    Sublayers assigned this way will be registered and will have their status changed\n+    too when you call .train() etc.\n+\n+    Parameters\n+    ----------\n+    prefix : str\n+        Prefix acts like a name space. It will be prepended to the name of all Symbols and\n+        Parameters created by this layer. Prefix should be unique within one network\n+        to prevent name collisions.\n+    params : ParameterDict or None\n+        Manages Parameters of this Layer and sublayers. You can make two Layers share\n+        parameter by passing the same dictionary to them. For example::\n+            params = nn.ParameterDict(prefix='dense_')\n+            dense1 = nn.Dense(20, in_units=10, prefix='dense1_', params=params)\n+            dense2 = nn.Dense(20, in_units=10, prefix='dense2_', params=params)\n+\n+        dense1 and dense2 now have shared weights.\n+    \"\"\"\n+    _counter = {}\n+\n+    def __init__(self, prefix=None, params=None):\n+        self._prefix = self._make_prefix(prefix)\n+        self._name = self.prefix[:-1] if self.prefix.endswith('_') else self.prefix\n+        if params is None:\n+            params = ParameterDict(prefix=self.prefix)\n+        self._params = params\n+        self._children = []\n+\n+    def __setattr__(self, name, value):\n+        \"\"\"Automatically register sublayers.\"\"\"\n+        super(Layer, self).__setattr__(name, value)","path":"python/mxnet/contrib/nn/layer.py","position":59,"original_position":59,"commit_id":"97de14bde396e97aaf33c4c4ffbba69075ec8f52","original_commit_id":"5b2994332005d26cef71df9e9e35e71c31642e1c","user":{"login":"pluskid","id":3542,"avatar_url":"https://avatars0.githubusercontent.com/u/3542?v=3","gravatar_id":"","url":"https://api.github.com/users/pluskid","html_url":"https://github.com/pluskid","followers_url":"https://api.github.com/users/pluskid/followers","following_url":"https://api.github.com/users/pluskid/following{/other_user}","gists_url":"https://api.github.com/users/pluskid/gists{/gist_id}","starred_url":"https://api.github.com/users/pluskid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pluskid/subscriptions","organizations_url":"https://api.github.com/users/pluskid/orgs","repos_url":"https://api.github.com/users/pluskid/repos","events_url":"https://api.github.com/users/pluskid/events{/privacy}","received_events_url":"https://api.github.com/users/pluskid/received_events","type":"User","site_admin":false},"body":"prefer `self.add('dense1', nn.Dense(100, in_units=100))`. ","created_at":"2017-05-15T04:32:50Z","updated_at":"2017-05-15T04:32:50Z","html_url":"https://github.com/dmlc/mxnet/pull/5705#discussion_r116408690","pull_request_url":"https://api.github.com/repos/dmlc/mxnet/pulls/5705","_links":{"self":{"href":"https://api.github.com/repos/dmlc/mxnet/pulls/comments/116408690"},"html":{"href":"https://github.com/dmlc/mxnet/pull/5705#discussion_r116408690"},"pull_request":{"href":"https://api.github.com/repos/dmlc/mxnet/pulls/5705"}}},"pull_request":{"url":"https://api.github.com/repos/dmlc/mxnet/pulls/5705","id":114496762,"html_url":"https://github.com/dmlc/mxnet/pull/5705","diff_url":"https://github.com/dmlc/mxnet/pull/5705.diff","patch_url":"https://github.com/dmlc/mxnet/pull/5705.patch","issue_url":"https://api.github.com/repos/dmlc/mxnet/issues/5705","number":5705,"state":"open","locked":false,"title":"symbolic+imperative nn interface","user":{"login":"piiswrong","id":568948,"avatar_url":"https://avatars3.githubusercontent.com/u/568948?v=3","gravatar_id":"","url":"https://api.github.com/users/piiswrong","html_url":"https://github.com/piiswrong","followers_url":"https://api.github.com/users/piiswrong/followers","following_url":"https://api.github.com/users/piiswrong/following{/other_user}","gists_url":"https://api.github.com/users/piiswrong/gists{/gist_id}","starred_url":"https://api.github.com/users/piiswrong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/piiswrong/subscriptions","organizations_url":"https://api.github.com/users/piiswrong/orgs","repos_url":"https://api.github.com/users/piiswrong/repos","events_url":"https://api.github.com/users/piiswrong/events{/privacy}","received_events_url":"https://api.github.com/users/piiswrong/received_events","type":"User","site_admin":false},"body":"a high level NN interface that supports symbolic+imperative use. With a mixed Keras and pytorch flavor.\r\n\r\n@jermainewang @pluskid @sxjscience @yajiedesign @tqchen @mli @madjam ","created_at":"2017-04-05T23:52:08Z","updated_at":"2017-05-15T04:32:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1e6e5abc2ed6350117103b59e02eaab283df8387","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/dmlc/mxnet/pulls/5705/commits","review_comments_url":"https://api.github.com/repos/dmlc/mxnet/pulls/5705/comments","review_comment_url":"https://api.github.com/repos/dmlc/mxnet/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dmlc/mxnet/issues/5705/comments","statuses_url":"https://api.github.com/repos/dmlc/mxnet/statuses/97de14bde396e97aaf33c4c4ffbba69075ec8f52","head":{"label":"piiswrong:nn","ref":"nn","sha":"97de14bde396e97aaf33c4c4ffbba69075ec8f52","user":{"login":"piiswrong","id":568948,"avatar_url":"https://avatars3.githubusercontent.com/u/568948?v=3","gravatar_id":"","url":"https://api.github.com/users/piiswrong","html_url":"https://github.com/piiswrong","followers_url":"https://api.github.com/users/piiswrong/followers","following_url":"https://api.github.com/users/piiswrong/following{/other_user}","gists_url":"https://api.github.com/users/piiswrong/gists{/gist_id}","starred_url":"https://api.github.com/users/piiswrong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/piiswrong/subscriptions","organizations_url":"https://api.github.com/users/piiswrong/orgs","repos_url":"https://api.github.com/users/piiswrong/repos","events_url":"https://api.github.com/users/piiswrong/events{/privacy}","received_events_url":"https://api.github.com/users/piiswrong/received_events","type":"User","site_admin":false},"repo":{"id":44707337,"name":"mxnet","full_name":"piiswrong/mxnet","owner":{"login":"piiswrong","id":568948,"avatar_url":"https://avatars3.githubusercontent.com/u/568948?v=3","gravatar_id":"","url":"https://api.github.com/users/piiswrong","html_url":"https://github.com/piiswrong","followers_url":"https://api.github.com/users/piiswrong/followers","following_url":"https://api.github.com/users/piiswrong/following{/other_user}","gists_url":"https://api.github.com/users/piiswrong/gists{/gist_id}","starred_url":"https://api.github.com/users/piiswrong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/piiswrong/subscriptions","organizations_url":"https://api.github.com/users/piiswrong/orgs","repos_url":"https://api.github.com/users/piiswrong/repos","events_url":"https://api.github.com/users/piiswrong/events{/privacy}","received_events_url":"https://api.github.com/users/piiswrong/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/piiswrong/mxnet","description":"Efficient and Flexible Distributed Deep Learning Framework, for python, R, Julia and more","fork":true,"url":"https://api.github.com/repos/piiswrong/mxnet","forks_url":"https://api.github.com/repos/piiswrong/mxnet/forks","keys_url":"https://api.github.com/repos/piiswrong/mxnet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/piiswrong/mxnet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/piiswrong/mxnet/teams","hooks_url":"https://api.github.com/repos/piiswrong/mxnet/hooks","issue_events_url":"https://api.github.com/repos/piiswrong/mxnet/issues/events{/number}","events_url":"https://api.github.com/repos/piiswrong/mxnet/events","assignees_url":"https://api.github.com/repos/piiswrong/mxnet/assignees{/user}","branches_url":"https://api.github.com/repos/piiswrong/mxnet/branches{/branch}","tags_url":"https://api.github.com/repos/piiswrong/mxnet/tags","blobs_url":"https://api.github.com/repos/piiswrong/mxnet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/piiswrong/mxnet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/piiswrong/mxnet/git/refs{/sha}","trees_url":"https://api.github.com/repos/piiswrong/mxnet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/piiswrong/mxnet/statuses/{sha}","languages_url":"https://api.github.com/repos/piiswrong/mxnet/languages","stargazers_url":"https://api.github.com/repos/piiswrong/mxnet/stargazers","contributors_url":"https://api.github.com/repos/piiswrong/mxnet/contributors","subscribers_url":"https://api.github.com/repos/piiswrong/mxnet/subscribers","subscription_url":"https://api.github.com/repos/piiswrong/mxnet/subscription","commits_url":"https://api.github.com/repos/piiswrong/mxnet/commits{/sha}","git_commits_url":"https://api.github.com/repos/piiswrong/mxnet/git/commits{/sha}","comments_url":"https://api.github.com/repos/piiswrong/mxnet/comments{/number}","issue_comment_url":"https://api.github.com/repos/piiswrong/mxnet/issues/comments{/number}","contents_url":"https://api.github.com/repos/piiswrong/mxnet/contents/{+path}","compare_url":"https://api.github.com/repos/piiswrong/mxnet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/piiswrong/mxnet/merges","archive_url":"https://api.github.com/repos/piiswrong/mxnet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/piiswrong/mxnet/downloads","issues_url":"https://api.github.com/repos/piiswrong/mxnet/issues{/number}","pulls_url":"https://api.github.com/repos/piiswrong/mxnet/pulls{/number}","milestones_url":"https://api.github.com/repos/piiswrong/mxnet/milestones{/number}","notifications_url":"https://api.github.com/repos/piiswrong/mxnet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/piiswrong/mxnet/labels{/name}","releases_url":"https://api.github.com/repos/piiswrong/mxnet/releases{/id}","deployments_url":"https://api.github.com/repos/piiswrong/mxnet/deployments","created_at":"2015-10-21T22:07:57Z","updated_at":"2017-03-30T18:29:29Z","pushed_at":"2017-05-15T00:04:19Z","git_url":"git://github.com/piiswrong/mxnet.git","ssh_url":"git@github.com:piiswrong/mxnet.git","clone_url":"https://github.com/piiswrong/mxnet.git","svn_url":"https://github.com/piiswrong/mxnet","homepage":"http://mxnet.rtfd.org","size":18008,"stargazers_count":1,"watchers_count":1,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"dmlc:master","ref":"master","sha":"2d4367617c86b280c90e9fdb600012e88bcc6f0a","user":{"login":"dmlc","id":11508361,"avatar_url":"https://avatars1.githubusercontent.com/u/11508361?v=3","gravatar_id":"","url":"https://api.github.com/users/dmlc","html_url":"https://github.com/dmlc","followers_url":"https://api.github.com/users/dmlc/followers","following_url":"https://api.github.com/users/dmlc/following{/other_user}","gists_url":"https://api.github.com/users/dmlc/gists{/gist_id}","starred_url":"https://api.github.com/users/dmlc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmlc/subscriptions","organizations_url":"https://api.github.com/users/dmlc/orgs","repos_url":"https://api.github.com/users/dmlc/repos","events_url":"https://api.github.com/users/dmlc/events{/privacy}","received_events_url":"https://api.github.com/users/dmlc/received_events","type":"Organization","site_admin":false},"repo":{"id":34864402,"name":"mxnet","full_name":"dmlc/mxnet","owner":{"login":"dmlc","id":11508361,"avatar_url":"https://avatars1.githubusercontent.com/u/11508361?v=3","gravatar_id":"","url":"https://api.github.com/users/dmlc","html_url":"https://github.com/dmlc","followers_url":"https://api.github.com/users/dmlc/followers","following_url":"https://api.github.com/users/dmlc/following{/other_user}","gists_url":"https://api.github.com/users/dmlc/gists{/gist_id}","starred_url":"https://api.github.com/users/dmlc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmlc/subscriptions","organizations_url":"https://api.github.com/users/dmlc/orgs","repos_url":"https://api.github.com/users/dmlc/repos","events_url":"https://api.github.com/users/dmlc/events{/privacy}","received_events_url":"https://api.github.com/users/dmlc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dmlc/mxnet","description":"Lightweight, Portable, Flexible Distributed/Mobile Deep Learning with Dynamic, Mutation-aware Dataflow Dep Scheduler; for Python, R, Julia, Scala, Go, Javascript and more","fork":false,"url":"https://api.github.com/repos/dmlc/mxnet","forks_url":"https://api.github.com/repos/dmlc/mxnet/forks","keys_url":"https://api.github.com/repos/dmlc/mxnet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dmlc/mxnet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dmlc/mxnet/teams","hooks_url":"https://api.github.com/repos/dmlc/mxnet/hooks","issue_events_url":"https://api.github.com/repos/dmlc/mxnet/issues/events{/number}","events_url":"https://api.github.com/repos/dmlc/mxnet/events","assignees_url":"https://api.github.com/repos/dmlc/mxnet/assignees{/user}","branches_url":"https://api.github.com/repos/dmlc/mxnet/branches{/branch}","tags_url":"https://api.github.com/repos/dmlc/mxnet/tags","blobs_url":"https://api.github.com/repos/dmlc/mxnet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dmlc/mxnet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dmlc/mxnet/git/refs{/sha}","trees_url":"https://api.github.com/repos/dmlc/mxnet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dmlc/mxnet/statuses/{sha}","languages_url":"https://api.github.com/repos/dmlc/mxnet/languages","stargazers_url":"https://api.github.com/repos/dmlc/mxnet/stargazers","contributors_url":"https://api.github.com/repos/dmlc/mxnet/contributors","subscribers_url":"https://api.github.com/repos/dmlc/mxnet/subscribers","subscription_url":"https://api.github.com/repos/dmlc/mxnet/subscription","commits_url":"https://api.github.com/repos/dmlc/mxnet/commits{/sha}","git_commits_url":"https://api.github.com/repos/dmlc/mxnet/git/commits{/sha}","comments_url":"https://api.github.com/repos/dmlc/mxnet/comments{/number}","issue_comment_url":"https://api.github.com/repos/dmlc/mxnet/issues/comments{/number}","contents_url":"https://api.github.com/repos/dmlc/mxnet/contents/{+path}","compare_url":"https://api.github.com/repos/dmlc/mxnet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dmlc/mxnet/merges","archive_url":"https://api.github.com/repos/dmlc/mxnet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dmlc/mxnet/downloads","issues_url":"https://api.github.com/repos/dmlc/mxnet/issues{/number}","pulls_url":"https://api.github.com/repos/dmlc/mxnet/pulls{/number}","milestones_url":"https://api.github.com/repos/dmlc/mxnet/milestones{/number}","notifications_url":"https://api.github.com/repos/dmlc/mxnet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dmlc/mxnet/labels{/name}","releases_url":"https://api.github.com/repos/dmlc/mxnet/releases{/id}","deployments_url":"https://api.github.com/repos/dmlc/mxnet/deployments","created_at":"2015-04-30T16:21:15Z","updated_at":"2017-05-15T04:24:47Z","pushed_at":"2017-05-15T04:31:23Z","git_url":"git://github.com/dmlc/mxnet.git","ssh_url":"git@github.com:dmlc/mxnet.git","clone_url":"https://github.com/dmlc/mxnet.git","svn_url":"https://github.com/dmlc/mxnet","homepage":"http://mxnet.io","size":17636,"stargazers_count":9621,"watchers_count":9621,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3614,"mirror_url":null,"open_issues_count":1669,"forks":3614,"open_issues":1669,"watchers":9621,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dmlc/mxnet/pulls/5705"},"html":{"href":"https://github.com/dmlc/mxnet/pull/5705"},"issue":{"href":"https://api.github.com/repos/dmlc/mxnet/issues/5705"},"comments":{"href":"https://api.github.com/repos/dmlc/mxnet/issues/5705/comments"},"review_comments":{"href":"https://api.github.com/repos/dmlc/mxnet/pulls/5705/comments"},"review_comment":{"href":"https://api.github.com/repos/dmlc/mxnet/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dmlc/mxnet/pulls/5705/commits"},"statuses":{"href":"https://api.github.com/repos/dmlc/mxnet/statuses/97de14bde396e97aaf33c4c4ffbba69075ec8f52"}}}}
{"actor":{"display_login":"pluskid"}}