{"action":"closed","number":52,"pull_request":{"url":"https://api.github.com/repos/benanne/Lasagne/pulls/52","id":24553254,"html_url":"https://github.com/benanne/Lasagne/pull/52","diff_url":"https://github.com/benanne/Lasagne/pull/52.diff","patch_url":"https://github.com/benanne/Lasagne/pull/52.patch","issue_url":"https://api.github.com/repos/benanne/Lasagne/issues/52","number":52,"state":"closed","locked":false,"title":"Allow Layers to be constructed from input shapes","user":{"login":"f0k","id":629706,"avatar_url":"https://avatars.githubusercontent.com/u/629706?v=3","gravatar_id":"","url":"https://api.github.com/users/f0k","html_url":"https://github.com/f0k","followers_url":"https://api.github.com/users/f0k/followers","following_url":"https://api.github.com/users/f0k/following{/other_user}","gists_url":"https://api.github.com/users/f0k/gists{/gist_id}","starred_url":"https://api.github.com/users/f0k/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/f0k/subscriptions","organizations_url":"https://api.github.com/users/f0k/orgs","repos_url":"https://api.github.com/users/f0k/repos","events_url":"https://api.github.com/users/f0k/events{/privacy}","received_events_url":"https://api.github.com/users/f0k/received_events","type":"User","site_admin":false},"body":"As discussed in #17, it seemed to be a good idea to allow Layer instances to be constructed from input shapes rather than other Layer instances. While `get_output()` would not work for such layers, they could still be used standalone with `get_output_for()` and `get_output_shape_for()` -- after all, a layer only needs to know about its input and input shape to function.\r\n\r\nWe thought that implementing this would only touch the `Layer` base class (and the `MultipleInputsLayer` base class). However, while implementing it, I found that several other layer implementations rely on `self.input_layer.get_output_shape()` to work. There are about four ways of solving it:\r\n1. Distinguishing between `self.input_layer` being a shape tuple or a layer in each of these cases\r\n2. Moving this distinction into a new `get_input_shape()` method in the base class\r\n3. Relying on this distinction being present in `Layer.get_output_shape()` and using `super(XYZLayer, self).get_output_shape()` instead of `self.input_layer.get_output_shape()` (this only works for classes directly derived from `Layer`, because in this case the super `get_output_shape()` will just return the input shape, so that's both ugly and fragile)\r\n4. Wrapping a shape tuple in something that implements `get_output_shape()`\r\n\r\nIt turns out that we have a ready-made class for option 4, which is `InputLayer`. By wrapping shape tuples given in the constructor in `InputLayer` instances, only the base classes need to be changed. However, it feels like an unnecessary / misplaced shortcut now... what do we gain compared to requiring the user to provide an `InputLayer` instance herself or himself? Should we possibly choose option 2 instead? Should we create an `InputShape` class that really just wraps a shape tuple with a `get_output_shape()` method? Or is this proposal a good solution anyway?","created_at":"2014-11-17T17:48:33Z","updated_at":"2015-01-30T13:42:13Z","closed_at":"2015-01-30T13:42:13Z","merged_at":"2015-01-30T13:42:13Z","merge_commit_sha":"0a4e91aaf9620d6850e8f988c9171809faf9b5f7","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/benanne/Lasagne/pulls/52/commits","review_comments_url":"https://api.github.com/repos/benanne/Lasagne/pulls/52/comments","review_comment_url":"https://api.github.com/repos/benanne/Lasagne/pulls/comments/{number}","comments_url":"https://api.github.com/repos/benanne/Lasagne/issues/52/comments","statuses_url":"https://api.github.com/repos/benanne/Lasagne/statuses/8a5a8f9dd53353d1082008ca76bcef6258237181","head":{"label":"f0k:input-shape","ref":"input-shape","sha":"8a5a8f9dd53353d1082008ca76bcef6258237181","user":{"login":"f0k","id":629706,"avatar_url":"https://avatars.githubusercontent.com/u/629706?v=3","gravatar_id":"","url":"https://api.github.com/users/f0k","html_url":"https://github.com/f0k","followers_url":"https://api.github.com/users/f0k/followers","following_url":"https://api.github.com/users/f0k/following{/other_user}","gists_url":"https://api.github.com/users/f0k/gists{/gist_id}","starred_url":"https://api.github.com/users/f0k/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/f0k/subscriptions","organizations_url":"https://api.github.com/users/f0k/orgs","repos_url":"https://api.github.com/users/f0k/repos","events_url":"https://api.github.com/users/f0k/events{/privacy}","received_events_url":"https://api.github.com/users/f0k/received_events","type":"User","site_admin":false},"repo":{"id":25348536,"name":"Lasagne","full_name":"f0k/Lasagne","owner":{"login":"f0k","id":629706,"avatar_url":"https://avatars.githubusercontent.com/u/629706?v=3","gravatar_id":"","url":"https://api.github.com/users/f0k","html_url":"https://github.com/f0k","followers_url":"https://api.github.com/users/f0k/followers","following_url":"https://api.github.com/users/f0k/following{/other_user}","gists_url":"https://api.github.com/users/f0k/gists{/gist_id}","starred_url":"https://api.github.com/users/f0k/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/f0k/subscriptions","organizations_url":"https://api.github.com/users/f0k/orgs","repos_url":"https://api.github.com/users/f0k/repos","events_url":"https://api.github.com/users/f0k/events{/privacy}","received_events_url":"https://api.github.com/users/f0k/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/f0k/Lasagne","description":"neural network tools for Theano","fork":true,"url":"https://api.github.com/repos/f0k/Lasagne","forks_url":"https://api.github.com/repos/f0k/Lasagne/forks","keys_url":"https://api.github.com/repos/f0k/Lasagne/keys{/key_id}","collaborators_url":"https://api.github.com/repos/f0k/Lasagne/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/f0k/Lasagne/teams","hooks_url":"https://api.github.com/repos/f0k/Lasagne/hooks","issue_events_url":"https://api.github.com/repos/f0k/Lasagne/issues/events{/number}","events_url":"https://api.github.com/repos/f0k/Lasagne/events","assignees_url":"https://api.github.com/repos/f0k/Lasagne/assignees{/user}","branches_url":"https://api.github.com/repos/f0k/Lasagne/branches{/branch}","tags_url":"https://api.github.com/repos/f0k/Lasagne/tags","blobs_url":"https://api.github.com/repos/f0k/Lasagne/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/f0k/Lasagne/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/f0k/Lasagne/git/refs{/sha}","trees_url":"https://api.github.com/repos/f0k/Lasagne/git/trees{/sha}","statuses_url":"https://api.github.com/repos/f0k/Lasagne/statuses/{sha}","languages_url":"https://api.github.com/repos/f0k/Lasagne/languages","stargazers_url":"https://api.github.com/repos/f0k/Lasagne/stargazers","contributors_url":"https://api.github.com/repos/f0k/Lasagne/contributors","subscribers_url":"https://api.github.com/repos/f0k/Lasagne/subscribers","subscription_url":"https://api.github.com/repos/f0k/Lasagne/subscription","commits_url":"https://api.github.com/repos/f0k/Lasagne/commits{/sha}","git_commits_url":"https://api.github.com/repos/f0k/Lasagne/git/commits{/sha}","comments_url":"https://api.github.com/repos/f0k/Lasagne/comments{/number}","issue_comment_url":"https://api.github.com/repos/f0k/Lasagne/issues/comments/{number}","contents_url":"https://api.github.com/repos/f0k/Lasagne/contents/{+path}","compare_url":"https://api.github.com/repos/f0k/Lasagne/compare/{base}...{head}","merges_url":"https://api.github.com/repos/f0k/Lasagne/merges","archive_url":"https://api.github.com/repos/f0k/Lasagne/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/f0k/Lasagne/downloads","issues_url":"https://api.github.com/repos/f0k/Lasagne/issues{/number}","pulls_url":"https://api.github.com/repos/f0k/Lasagne/pulls{/number}","milestones_url":"https://api.github.com/repos/f0k/Lasagne/milestones{/number}","notifications_url":"https://api.github.com/repos/f0k/Lasagne/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/f0k/Lasagne/labels{/name}","releases_url":"https://api.github.com/repos/f0k/Lasagne/releases{/id}","created_at":"2014-10-17T08:52:10Z","updated_at":"2014-12-25T16:36:23Z","pushed_at":"2015-01-29T18:25:51Z","git_url":"git://github.com/f0k/Lasagne.git","ssh_url":"git@github.com:f0k/Lasagne.git","clone_url":"https://github.com/f0k/Lasagne.git","svn_url":"https://github.com/f0k/Lasagne","homepage":null,"size":457,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"benanne:master","ref":"master","sha":"193e404e1659f7147093f4e0441b6ca3944819d7","user":{"login":"benanne","id":43829,"avatar_url":"https://avatars.githubusercontent.com/u/43829?v=3","gravatar_id":"","url":"https://api.github.com/users/benanne","html_url":"https://github.com/benanne","followers_url":"https://api.github.com/users/benanne/followers","following_url":"https://api.github.com/users/benanne/following{/other_user}","gists_url":"https://api.github.com/users/benanne/gists{/gist_id}","starred_url":"https://api.github.com/users/benanne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benanne/subscriptions","organizations_url":"https://api.github.com/users/benanne/orgs","repos_url":"https://api.github.com/users/benanne/repos","events_url":"https://api.github.com/users/benanne/events{/privacy}","received_events_url":"https://api.github.com/users/benanne/received_events","type":"User","site_admin":false},"repo":{"id":23924195,"name":"Lasagne","full_name":"benanne/Lasagne","owner":{"login":"benanne","id":43829,"avatar_url":"https://avatars.githubusercontent.com/u/43829?v=3","gravatar_id":"","url":"https://api.github.com/users/benanne","html_url":"https://github.com/benanne","followers_url":"https://api.github.com/users/benanne/followers","following_url":"https://api.github.com/users/benanne/following{/other_user}","gists_url":"https://api.github.com/users/benanne/gists{/gist_id}","starred_url":"https://api.github.com/users/benanne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benanne/subscriptions","organizations_url":"https://api.github.com/users/benanne/orgs","repos_url":"https://api.github.com/users/benanne/repos","events_url":"https://api.github.com/users/benanne/events{/privacy}","received_events_url":"https://api.github.com/users/benanne/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/benanne/Lasagne","description":"neural network tools for Theano","fork":false,"url":"https://api.github.com/repos/benanne/Lasagne","forks_url":"https://api.github.com/repos/benanne/Lasagne/forks","keys_url":"https://api.github.com/repos/benanne/Lasagne/keys{/key_id}","collaborators_url":"https://api.github.com/repos/benanne/Lasagne/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/benanne/Lasagne/teams","hooks_url":"https://api.github.com/repos/benanne/Lasagne/hooks","issue_events_url":"https://api.github.com/repos/benanne/Lasagne/issues/events{/number}","events_url":"https://api.github.com/repos/benanne/Lasagne/events","assignees_url":"https://api.github.com/repos/benanne/Lasagne/assignees{/user}","branches_url":"https://api.github.com/repos/benanne/Lasagne/branches{/branch}","tags_url":"https://api.github.com/repos/benanne/Lasagne/tags","blobs_url":"https://api.github.com/repos/benanne/Lasagne/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/benanne/Lasagne/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/benanne/Lasagne/git/refs{/sha}","trees_url":"https://api.github.com/repos/benanne/Lasagne/git/trees{/sha}","statuses_url":"https://api.github.com/repos/benanne/Lasagne/statuses/{sha}","languages_url":"https://api.github.com/repos/benanne/Lasagne/languages","stargazers_url":"https://api.github.com/repos/benanne/Lasagne/stargazers","contributors_url":"https://api.github.com/repos/benanne/Lasagne/contributors","subscribers_url":"https://api.github.com/repos/benanne/Lasagne/subscribers","subscription_url":"https://api.github.com/repos/benanne/Lasagne/subscription","commits_url":"https://api.github.com/repos/benanne/Lasagne/commits{/sha}","git_commits_url":"https://api.github.com/repos/benanne/Lasagne/git/commits{/sha}","comments_url":"https://api.github.com/repos/benanne/Lasagne/comments{/number}","issue_comment_url":"https://api.github.com/repos/benanne/Lasagne/issues/comments/{number}","contents_url":"https://api.github.com/repos/benanne/Lasagne/contents/{+path}","compare_url":"https://api.github.com/repos/benanne/Lasagne/compare/{base}...{head}","merges_url":"https://api.github.com/repos/benanne/Lasagne/merges","archive_url":"https://api.github.com/repos/benanne/Lasagne/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/benanne/Lasagne/downloads","issues_url":"https://api.github.com/repos/benanne/Lasagne/issues{/number}","pulls_url":"https://api.github.com/repos/benanne/Lasagne/pulls{/number}","milestones_url":"https://api.github.com/repos/benanne/Lasagne/milestones{/number}","notifications_url":"https://api.github.com/repos/benanne/Lasagne/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/benanne/Lasagne/labels{/name}","releases_url":"https://api.github.com/repos/benanne/Lasagne/releases{/id}","created_at":"2014-09-11T15:31:41Z","updated_at":"2015-01-30T13:09:09Z","pushed_at":"2015-01-30T13:42:13Z","git_url":"git://github.com/benanne/Lasagne.git","ssh_url":"git@github.com:benanne/Lasagne.git","clone_url":"https://github.com/benanne/Lasagne.git","svn_url":"https://github.com/benanne/Lasagne","homepage":"http://lasagne.readthedocs.org/","size":1310,"stargazers_count":173,"watchers_count":173,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":36,"mirror_url":null,"open_issues_count":39,"forks":36,"open_issues":39,"watchers":173,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/benanne/Lasagne/pulls/52"},"html":{"href":"https://github.com/benanne/Lasagne/pull/52"},"issue":{"href":"https://api.github.com/repos/benanne/Lasagne/issues/52"},"comments":{"href":"https://api.github.com/repos/benanne/Lasagne/issues/52/comments"},"review_comments":{"href":"https://api.github.com/repos/benanne/Lasagne/pulls/52/comments"},"review_comment":{"href":"https://api.github.com/repos/benanne/Lasagne/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/benanne/Lasagne/pulls/52/commits"},"statuses":{"href":"https://api.github.com/repos/benanne/Lasagne/statuses/8a5a8f9dd53353d1082008ca76bcef6258237181"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"benanne","id":43829,"avatar_url":"https://avatars.githubusercontent.com/u/43829?v=3","gravatar_id":"","url":"https://api.github.com/users/benanne","html_url":"https://github.com/benanne","followers_url":"https://api.github.com/users/benanne/followers","following_url":"https://api.github.com/users/benanne/following{/other_user}","gists_url":"https://api.github.com/users/benanne/gists{/gist_id}","starred_url":"https://api.github.com/users/benanne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benanne/subscriptions","organizations_url":"https://api.github.com/users/benanne/orgs","repos_url":"https://api.github.com/users/benanne/repos","events_url":"https://api.github.com/users/benanne/events{/privacy}","received_events_url":"https://api.github.com/users/benanne/received_events","type":"User","site_admin":false},"comments":60,"review_comments":0,"commits":3,"additions":174,"deletions":80,"changed_files":12}}