{"action":"created","comment":{"url":"https://api.github.com/repos/bartvm/blocks/pulls/comments/25856475","id":25856475,"diff_hunk":"@@ -161,8 +162,37 @@ def replace(self, replacements):\n             substitutes.\n \n         \"\"\"\n-        return ComputationGraph(theano.clone(self.outputs,\n-                                             replace=replacements))\n+        # Due to theano specifics we have to make one replacement in time\n+        replacements = OrderedDict(replacements)\n+        # Replacements with previous replacements\n+        replacements_cur = replacements\n+        # Links to current keys\n+        replacement_keys = OrderedDict(zip(replacements.keys(),\n+                                           replacements_cur.keys()))\n+        vars_sorted = theano.gof.graph.io_toposort(self.inputs, self.outputs)\n+        outputs_cur = self.outputs\n+        # Replace step-by-step in topological order\n+        for var in vars_sorted:\n+            for input in var.inputs:\n+                if input not in replacements:","path":"blocks/graph.py","position":32,"original_position":32,"commit_id":"959d7952dab8003094251219fa005bdeeed38ea9","original_commit_id":"959d7952dab8003094251219fa005bdeeed38ea9","user":{"login":"rizar","id":654434,"avatar_url":"https://avatars.githubusercontent.com/u/654434?v=3","gravatar_id":"","url":"https://api.github.com/users/rizar","html_url":"https://github.com/rizar","followers_url":"https://api.github.com/users/rizar/followers","following_url":"https://api.github.com/users/rizar/following{/other_user}","gists_url":"https://api.github.com/users/rizar/gists{/gist_id}","starred_url":"https://api.github.com/users/rizar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rizar/subscriptions","organizations_url":"https://api.github.com/users/rizar/orgs","repos_url":"https://api.github.com/users/rizar/repos","events_url":"https://api.github.com/users/rizar/events{/privacy}","received_events_url":"https://api.github.com/users/rizar/received_events","type":"User","site_admin":false},"body":"Please use `input_`.","created_at":"2015-03-05T11:22:36Z","updated_at":"2015-03-05T11:22:36Z","html_url":"https://github.com/bartvm/blocks/pull/407#discussion_r25856475","pull_request_url":"https://api.github.com/repos/bartvm/blocks/pulls/407","_links":{"self":{"href":"https://api.github.com/repos/bartvm/blocks/pulls/comments/25856475"},"html":{"href":"https://github.com/bartvm/blocks/pull/407#discussion_r25856475"},"pull_request":{"href":"https://api.github.com/repos/bartvm/blocks/pulls/407"}}},"pull_request":{"url":"https://api.github.com/repos/bartvm/blocks/pulls/407","id":30424297,"html_url":"https://github.com/bartvm/blocks/pull/407","diff_url":"https://github.com/bartvm/blocks/pull/407.diff","patch_url":"https://github.com/bartvm/blocks/pull/407.patch","issue_url":"https://api.github.com/repos/bartvm/blocks/issues/407","number":407,"state":"open","locked":false,"title":"WIP: Dropout","user":{"login":"dmitriy-serdyuk","id":2872615,"avatar_url":"https://avatars.githubusercontent.com/u/2872615?v=3","gravatar_id":"","url":"https://api.github.com/users/dmitriy-serdyuk","html_url":"https://github.com/dmitriy-serdyuk","followers_url":"https://api.github.com/users/dmitriy-serdyuk/followers","following_url":"https://api.github.com/users/dmitriy-serdyuk/following{/other_user}","gists_url":"https://api.github.com/users/dmitriy-serdyuk/gists{/gist_id}","starred_url":"https://api.github.com/users/dmitriy-serdyuk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmitriy-serdyuk/subscriptions","organizations_url":"https://api.github.com/users/dmitriy-serdyuk/orgs","repos_url":"https://api.github.com/users/dmitriy-serdyuk/repos","events_url":"https://api.github.com/users/dmitriy-serdyuk/events{/privacy}","received_events_url":"https://api.github.com/users/dmitriy-serdyuk/received_events","type":"User","site_admin":false},"body":"- [x] Make graph replacement work with dependent variables.\r\n- [x] Implement dropout itself.\r\n- [x] Add tags to variables.\r\n- [ ] Test dropout","created_at":"2015-03-03T23:34:27Z","updated_at":"2015-03-05T11:22:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"73aee99e554755fcd60737255ef56b64430000c6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/bartvm/blocks/pulls/407/commits","review_comments_url":"https://api.github.com/repos/bartvm/blocks/pulls/407/comments","review_comment_url":"https://api.github.com/repos/bartvm/blocks/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bartvm/blocks/issues/407/comments","statuses_url":"https://api.github.com/repos/bartvm/blocks/statuses/959d7952dab8003094251219fa005bdeeed38ea9","head":{"label":"dmitriy-serdyuk:dropout","ref":"dropout","sha":"959d7952dab8003094251219fa005bdeeed38ea9","user":{"login":"dmitriy-serdyuk","id":2872615,"avatar_url":"https://avatars.githubusercontent.com/u/2872615?v=3","gravatar_id":"","url":"https://api.github.com/users/dmitriy-serdyuk","html_url":"https://github.com/dmitriy-serdyuk","followers_url":"https://api.github.com/users/dmitriy-serdyuk/followers","following_url":"https://api.github.com/users/dmitriy-serdyuk/following{/other_user}","gists_url":"https://api.github.com/users/dmitriy-serdyuk/gists{/gist_id}","starred_url":"https://api.github.com/users/dmitriy-serdyuk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmitriy-serdyuk/subscriptions","organizations_url":"https://api.github.com/users/dmitriy-serdyuk/orgs","repos_url":"https://api.github.com/users/dmitriy-serdyuk/repos","events_url":"https://api.github.com/users/dmitriy-serdyuk/events{/privacy}","received_events_url":"https://api.github.com/users/dmitriy-serdyuk/received_events","type":"User","site_admin":false},"repo":{"id":27456006,"name":"blocks","full_name":"dmitriy-serdyuk/blocks","owner":{"login":"dmitriy-serdyuk","id":2872615,"avatar_url":"https://avatars.githubusercontent.com/u/2872615?v=3","gravatar_id":"","url":"https://api.github.com/users/dmitriy-serdyuk","html_url":"https://github.com/dmitriy-serdyuk","followers_url":"https://api.github.com/users/dmitriy-serdyuk/followers","following_url":"https://api.github.com/users/dmitriy-serdyuk/following{/other_user}","gists_url":"https://api.github.com/users/dmitriy-serdyuk/gists{/gist_id}","starred_url":"https://api.github.com/users/dmitriy-serdyuk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmitriy-serdyuk/subscriptions","organizations_url":"https://api.github.com/users/dmitriy-serdyuk/orgs","repos_url":"https://api.github.com/users/dmitriy-serdyuk/repos","events_url":"https://api.github.com/users/dmitriy-serdyuk/events{/privacy}","received_events_url":"https://api.github.com/users/dmitriy-serdyuk/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dmitriy-serdyuk/blocks","description":"","fork":true,"url":"https://api.github.com/repos/dmitriy-serdyuk/blocks","forks_url":"https://api.github.com/repos/dmitriy-serdyuk/blocks/forks","keys_url":"https://api.github.com/repos/dmitriy-serdyuk/blocks/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dmitriy-serdyuk/blocks/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dmitriy-serdyuk/blocks/teams","hooks_url":"https://api.github.com/repos/dmitriy-serdyuk/blocks/hooks","issue_events_url":"https://api.github.com/repos/dmitriy-serdyuk/blocks/issues/events{/number}","events_url":"https://api.github.com/repos/dmitriy-serdyuk/blocks/events","assignees_url":"https://api.github.com/repos/dmitriy-serdyuk/blocks/assignees{/user}","branches_url":"https://api.github.com/repos/dmitriy-serdyuk/blocks/branches{/branch}","tags_url":"https://api.github.com/repos/dmitriy-serdyuk/blocks/tags","blobs_url":"https://api.github.com/repos/dmitriy-serdyuk/blocks/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dmitriy-serdyuk/blocks/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dmitriy-serdyuk/blocks/git/refs{/sha}","trees_url":"https://api.github.com/repos/dmitriy-serdyuk/blocks/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dmitriy-serdyuk/blocks/statuses/{sha}","languages_url":"https://api.github.com/repos/dmitriy-serdyuk/blocks/languages","stargazers_url":"https://api.github.com/repos/dmitriy-serdyuk/blocks/stargazers","contributors_url":"https://api.github.com/repos/dmitriy-serdyuk/blocks/contributors","subscribers_url":"https://api.github.com/repos/dmitriy-serdyuk/blocks/subscribers","subscription_url":"https://api.github.com/repos/dmitriy-serdyuk/blocks/subscription","commits_url":"https://api.github.com/repos/dmitriy-serdyuk/blocks/commits{/sha}","git_commits_url":"https://api.github.com/repos/dmitriy-serdyuk/blocks/git/commits{/sha}","comments_url":"https://api.github.com/repos/dmitriy-serdyuk/blocks/comments{/number}","issue_comment_url":"https://api.github.com/repos/dmitriy-serdyuk/blocks/issues/comments{/number}","contents_url":"https://api.github.com/repos/dmitriy-serdyuk/blocks/contents/{+path}","compare_url":"https://api.github.com/repos/dmitriy-serdyuk/blocks/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dmitriy-serdyuk/blocks/merges","archive_url":"https://api.github.com/repos/dmitriy-serdyuk/blocks/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dmitriy-serdyuk/blocks/downloads","issues_url":"https://api.github.com/repos/dmitriy-serdyuk/blocks/issues{/number}","pulls_url":"https://api.github.com/repos/dmitriy-serdyuk/blocks/pulls{/number}","milestones_url":"https://api.github.com/repos/dmitriy-serdyuk/blocks/milestones{/number}","notifications_url":"https://api.github.com/repos/dmitriy-serdyuk/blocks/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dmitriy-serdyuk/blocks/labels{/name}","releases_url":"https://api.github.com/repos/dmitriy-serdyuk/blocks/releases{/id}","created_at":"2014-12-02T22:07:51Z","updated_at":"2015-02-12T00:04:39Z","pushed_at":"2015-03-04T22:58:50Z","git_url":"git://github.com/dmitriy-serdyuk/blocks.git","ssh_url":"git@github.com:dmitriy-serdyuk/blocks.git","clone_url":"https://github.com/dmitriy-serdyuk/blocks.git","svn_url":"https://github.com/dmitriy-serdyuk/blocks","homepage":null,"size":3029,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"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":0,"default_branch":"master"}},"base":{"label":"bartvm:master","ref":"master","sha":"bc7ad50e26f3f78da60b2c4bfe99c5fe62a65e31","user":{"login":"bartvm","id":2299595,"avatar_url":"https://avatars.githubusercontent.com/u/2299595?v=3","gravatar_id":"","url":"https://api.github.com/users/bartvm","html_url":"https://github.com/bartvm","followers_url":"https://api.github.com/users/bartvm/followers","following_url":"https://api.github.com/users/bartvm/following{/other_user}","gists_url":"https://api.github.com/users/bartvm/gists{/gist_id}","starred_url":"https://api.github.com/users/bartvm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bartvm/subscriptions","organizations_url":"https://api.github.com/users/bartvm/orgs","repos_url":"https://api.github.com/users/bartvm/repos","events_url":"https://api.github.com/users/bartvm/events{/privacy}","received_events_url":"https://api.github.com/users/bartvm/received_events","type":"User","site_admin":false},"repo":{"id":24829371,"name":"blocks","full_name":"bartvm/blocks","owner":{"login":"bartvm","id":2299595,"avatar_url":"https://avatars.githubusercontent.com/u/2299595?v=3","gravatar_id":"","url":"https://api.github.com/users/bartvm","html_url":"https://github.com/bartvm","followers_url":"https://api.github.com/users/bartvm/followers","following_url":"https://api.github.com/users/bartvm/following{/other_user}","gists_url":"https://api.github.com/users/bartvm/gists{/gist_id}","starred_url":"https://api.github.com/users/bartvm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bartvm/subscriptions","organizations_url":"https://api.github.com/users/bartvm/orgs","repos_url":"https://api.github.com/users/bartvm/repos","events_url":"https://api.github.com/users/bartvm/events{/privacy}","received_events_url":"https://api.github.com/users/bartvm/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bartvm/blocks","description":"A Theano framework for building and training neural networks","fork":false,"url":"https://api.github.com/repos/bartvm/blocks","forks_url":"https://api.github.com/repos/bartvm/blocks/forks","keys_url":"https://api.github.com/repos/bartvm/blocks/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bartvm/blocks/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bartvm/blocks/teams","hooks_url":"https://api.github.com/repos/bartvm/blocks/hooks","issue_events_url":"https://api.github.com/repos/bartvm/blocks/issues/events{/number}","events_url":"https://api.github.com/repos/bartvm/blocks/events","assignees_url":"https://api.github.com/repos/bartvm/blocks/assignees{/user}","branches_url":"https://api.github.com/repos/bartvm/blocks/branches{/branch}","tags_url":"https://api.github.com/repos/bartvm/blocks/tags","blobs_url":"https://api.github.com/repos/bartvm/blocks/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bartvm/blocks/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bartvm/blocks/git/refs{/sha}","trees_url":"https://api.github.com/repos/bartvm/blocks/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bartvm/blocks/statuses/{sha}","languages_url":"https://api.github.com/repos/bartvm/blocks/languages","stargazers_url":"https://api.github.com/repos/bartvm/blocks/stargazers","contributors_url":"https://api.github.com/repos/bartvm/blocks/contributors","subscribers_url":"https://api.github.com/repos/bartvm/blocks/subscribers","subscription_url":"https://api.github.com/repos/bartvm/blocks/subscription","commits_url":"https://api.github.com/repos/bartvm/blocks/commits{/sha}","git_commits_url":"https://api.github.com/repos/bartvm/blocks/git/commits{/sha}","comments_url":"https://api.github.com/repos/bartvm/blocks/comments{/number}","issue_comment_url":"https://api.github.com/repos/bartvm/blocks/issues/comments{/number}","contents_url":"https://api.github.com/repos/bartvm/blocks/contents/{+path}","compare_url":"https://api.github.com/repos/bartvm/blocks/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bartvm/blocks/merges","archive_url":"https://api.github.com/repos/bartvm/blocks/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bartvm/blocks/downloads","issues_url":"https://api.github.com/repos/bartvm/blocks/issues{/number}","pulls_url":"https://api.github.com/repos/bartvm/blocks/pulls{/number}","milestones_url":"https://api.github.com/repos/bartvm/blocks/milestones{/number}","notifications_url":"https://api.github.com/repos/bartvm/blocks/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bartvm/blocks/labels{/name}","releases_url":"https://api.github.com/repos/bartvm/blocks/releases{/id}","created_at":"2014-10-06T00:08:32Z","updated_at":"2015-03-05T02:47:21Z","pushed_at":"2015-03-05T02:47:21Z","git_url":"git://github.com/bartvm/blocks.git","ssh_url":"git@github.com:bartvm/blocks.git","clone_url":"https://github.com/bartvm/blocks.git","svn_url":"https://github.com/bartvm/blocks","homepage":"","size":18355,"stargazers_count":109,"watchers_count":109,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":36,"mirror_url":null,"open_issues_count":68,"forks":36,"open_issues":68,"watchers":109,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bartvm/blocks/pulls/407"},"html":{"href":"https://github.com/bartvm/blocks/pull/407"},"issue":{"href":"https://api.github.com/repos/bartvm/blocks/issues/407"},"comments":{"href":"https://api.github.com/repos/bartvm/blocks/issues/407/comments"},"review_comments":{"href":"https://api.github.com/repos/bartvm/blocks/pulls/407/comments"},"review_comment":{"href":"https://api.github.com/repos/bartvm/blocks/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bartvm/blocks/pulls/407/commits"},"statuses":{"href":"https://api.github.com/repos/bartvm/blocks/statuses/959d7952dab8003094251219fa005bdeeed38ea9"}}}}