{"action":"created","comment":{"url":"https://api.github.com/repos/chainer/chainer/pulls/comments/226816325","pull_request_review_id":166737898,"id":226816325,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyNjgxNjMyNQ==","diff_hunk":"@@ -60,37 +60,45 @@ def dump_graph(root_name, out_name='cg.dot',\n        for the ``variable_style`` and ``function_style`` arguments.\n \n     \"\"\"\n-    def trigger(trainer):\n-        return trainer.updater.iteration == 1\n-\n-    if variable_style is None:\n-        variable_style = _var_style\n-    if function_style is None:\n-        function_style = _func_style\n-\n-    original_flag = [None]\n-\n-    def initializer(_):\n-        original_flag[0] = configuration.config.keep_graph_on_report\n-        configuration.config.keep_graph_on_report = True\n \n-    @extension.make_extension(trigger=trigger, initializer=initializer)\n-    def dump_graph(trainer):\n+    def __init__(self, root_name, out_name='cg.dot',\n+                 variable_style=None, function_style=None):\n+        self._root_name = root_name\n+        self._out_name = out_name\n+        self._variable_style = variable_style or _var_style","path":"chainer/training/extensions/computational_graph.py","position":37,"original_position":37,"commit_id":"d0c6c13208bcdc4216cab330937fbb120de8728f","original_commit_id":"d0c6c13208bcdc4216cab330937fbb120de8728f","user":{"login":"hitsgub","id":20672723,"node_id":"MDQ6VXNlcjIwNjcyNzIz","avatar_url":"https://avatars1.githubusercontent.com/u/20672723?v=4","gravatar_id":"","url":"https://api.github.com/users/hitsgub","html_url":"https://github.com/hitsgub","followers_url":"https://api.github.com/users/hitsgub/followers","following_url":"https://api.github.com/users/hitsgub/following{/other_user}","gists_url":"https://api.github.com/users/hitsgub/gists{/gist_id}","starred_url":"https://api.github.com/users/hitsgub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hitsgub/subscriptions","organizations_url":"https://api.github.com/users/hitsgub/orgs","repos_url":"https://api.github.com/users/hitsgub/repos","events_url":"https://api.github.com/users/hitsgub/events{/privacy}","received_events_url":"https://api.github.com/users/hitsgub/received_events","type":"User","site_admin":false},"body":"Thank you for your recommendation, I will fix here.","created_at":"2018-10-20T04:34:45Z","updated_at":"2018-10-20T04:34:46Z","html_url":"https://github.com/chainer/chainer/pull/5538#discussion_r226816325","pull_request_url":"https://api.github.com/repos/chainer/chainer/pulls/5538","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/chainer/chainer/pulls/comments/226816325"},"html":{"href":"https://github.com/chainer/chainer/pull/5538#discussion_r226816325"},"pull_request":{"href":"https://api.github.com/repos/chainer/chainer/pulls/5538"}},"in_reply_to_id":226815412},"pull_request":{"url":"https://api.github.com/repos/chainer/chainer/pulls/5538","id":224293002,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI0MjkzMDAy","html_url":"https://github.com/chainer/chainer/pull/5538","diff_url":"https://github.com/chainer/chainer/pull/5538.diff","patch_url":"https://github.com/chainer/chainer/pull/5538.patch","issue_url":"https://api.github.com/repos/chainer/chainer/issues/5538","number":5538,"state":"open","locked":false,"title":"Fix `dump_graph` not to memory leak","user":{"login":"hitsgub","id":20672723,"node_id":"MDQ6VXNlcjIwNjcyNzIz","avatar_url":"https://avatars1.githubusercontent.com/u/20672723?v=4","gravatar_id":"","url":"https://api.github.com/users/hitsgub","html_url":"https://github.com/hitsgub","followers_url":"https://api.github.com/users/hitsgub/followers","following_url":"https://api.github.com/users/hitsgub/following{/other_user}","gists_url":"https://api.github.com/users/hitsgub/gists{/gist_id}","starred_url":"https://api.github.com/users/hitsgub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hitsgub/subscriptions","organizations_url":"https://api.github.com/users/hitsgub/orgs","repos_url":"https://api.github.com/users/hitsgub/repos","events_url":"https://api.github.com/users/hitsgub/events{/privacy}","received_events_url":"https://api.github.com/users/hitsgub/received_events","type":"User","site_admin":false},"body":"## Problem\r\nThe current version of `dump_graph` set a flag `keep_graph_on_report` in `initializer()` even when restored from a snapshot.\r\nIt will keep every variables in each iterations and it cause a memory leak problem.\r\n\r\n## Solution\r\nChanging the extension definition from using decorator to direct class definition.\r\nI added the new attribute `self._flag_called` in order to run the extension surely only once.\r\nThe flag is the execution condition for `initialize` and `__call__`,  disabled in `trigger`, and serialized.","created_at":"2018-10-19T13:46:49Z","updated_at":"2018-10-20T04:34:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"19f78d60405673b14440d94726116cb92caf4483","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/chainer/chainer/pulls/5538/commits","review_comments_url":"https://api.github.com/repos/chainer/chainer/pulls/5538/comments","review_comment_url":"https://api.github.com/repos/chainer/chainer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/chainer/chainer/issues/5538/comments","statuses_url":"https://api.github.com/repos/chainer/chainer/statuses/d0c6c13208bcdc4216cab330937fbb120de8728f","head":{"label":"hitsgub:fix_dump_graph","ref":"fix_dump_graph","sha":"d0c6c13208bcdc4216cab330937fbb120de8728f","user":{"login":"hitsgub","id":20672723,"node_id":"MDQ6VXNlcjIwNjcyNzIz","avatar_url":"https://avatars1.githubusercontent.com/u/20672723?v=4","gravatar_id":"","url":"https://api.github.com/users/hitsgub","html_url":"https://github.com/hitsgub","followers_url":"https://api.github.com/users/hitsgub/followers","following_url":"https://api.github.com/users/hitsgub/following{/other_user}","gists_url":"https://api.github.com/users/hitsgub/gists{/gist_id}","starred_url":"https://api.github.com/users/hitsgub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hitsgub/subscriptions","organizations_url":"https://api.github.com/users/hitsgub/orgs","repos_url":"https://api.github.com/users/hitsgub/repos","events_url":"https://api.github.com/users/hitsgub/events{/privacy}","received_events_url":"https://api.github.com/users/hitsgub/received_events","type":"User","site_admin":false},"repo":{"id":153788565,"node_id":"MDEwOlJlcG9zaXRvcnkxNTM3ODg1NjU=","name":"chainer","full_name":"hitsgub/chainer","private":false,"owner":{"login":"hitsgub","id":20672723,"node_id":"MDQ6VXNlcjIwNjcyNzIz","avatar_url":"https://avatars1.githubusercontent.com/u/20672723?v=4","gravatar_id":"","url":"https://api.github.com/users/hitsgub","html_url":"https://github.com/hitsgub","followers_url":"https://api.github.com/users/hitsgub/followers","following_url":"https://api.github.com/users/hitsgub/following{/other_user}","gists_url":"https://api.github.com/users/hitsgub/gists{/gist_id}","starred_url":"https://api.github.com/users/hitsgub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hitsgub/subscriptions","organizations_url":"https://api.github.com/users/hitsgub/orgs","repos_url":"https://api.github.com/users/hitsgub/repos","events_url":"https://api.github.com/users/hitsgub/events{/privacy}","received_events_url":"https://api.github.com/users/hitsgub/received_events","type":"User","site_admin":false},"html_url":"https://github.com/hitsgub/chainer","description":"A flexible framework of neural networks for deep learning","fork":true,"url":"https://api.github.com/repos/hitsgub/chainer","forks_url":"https://api.github.com/repos/hitsgub/chainer/forks","keys_url":"https://api.github.com/repos/hitsgub/chainer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hitsgub/chainer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hitsgub/chainer/teams","hooks_url":"https://api.github.com/repos/hitsgub/chainer/hooks","issue_events_url":"https://api.github.com/repos/hitsgub/chainer/issues/events{/number}","events_url":"https://api.github.com/repos/hitsgub/chainer/events","assignees_url":"https://api.github.com/repos/hitsgub/chainer/assignees{/user}","branches_url":"https://api.github.com/repos/hitsgub/chainer/branches{/branch}","tags_url":"https://api.github.com/repos/hitsgub/chainer/tags","blobs_url":"https://api.github.com/repos/hitsgub/chainer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hitsgub/chainer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hitsgub/chainer/git/refs{/sha}","trees_url":"https://api.github.com/repos/hitsgub/chainer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hitsgub/chainer/statuses/{sha}","languages_url":"https://api.github.com/repos/hitsgub/chainer/languages","stargazers_url":"https://api.github.com/repos/hitsgub/chainer/stargazers","contributors_url":"https://api.github.com/repos/hitsgub/chainer/contributors","subscribers_url":"https://api.github.com/repos/hitsgub/chainer/subscribers","subscription_url":"https://api.github.com/repos/hitsgub/chainer/subscription","commits_url":"https://api.github.com/repos/hitsgub/chainer/commits{/sha}","git_commits_url":"https://api.github.com/repos/hitsgub/chainer/git/commits{/sha}","comments_url":"https://api.github.com/repos/hitsgub/chainer/comments{/number}","issue_comment_url":"https://api.github.com/repos/hitsgub/chainer/issues/comments{/number}","contents_url":"https://api.github.com/repos/hitsgub/chainer/contents/{+path}","compare_url":"https://api.github.com/repos/hitsgub/chainer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hitsgub/chainer/merges","archive_url":"https://api.github.com/repos/hitsgub/chainer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hitsgub/chainer/downloads","issues_url":"https://api.github.com/repos/hitsgub/chainer/issues{/number}","pulls_url":"https://api.github.com/repos/hitsgub/chainer/pulls{/number}","milestones_url":"https://api.github.com/repos/hitsgub/chainer/milestones{/number}","notifications_url":"https://api.github.com/repos/hitsgub/chainer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hitsgub/chainer/labels{/name}","releases_url":"https://api.github.com/repos/hitsgub/chainer/releases{/id}","deployments_url":"https://api.github.com/repos/hitsgub/chainer/deployments","created_at":"2018-10-19T13:39:45Z","updated_at":"2018-10-19T13:39:50Z","pushed_at":"2018-10-20T02:48:19Z","git_url":"git://github.com/hitsgub/chainer.git","ssh_url":"git@github.com:hitsgub/chainer.git","clone_url":"https://github.com/hitsgub/chainer.git","svn_url":"https://github.com/hitsgub/chainer","homepage":"https://chainer.org","size":31676,"stargazers_count":0,"watchers_count":0,"language":"Python","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":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"chainer:master","ref":"master","sha":"5643d31dcbb531a69360c8fbbd786741d4750c7f","user":{"login":"chainer","id":23183003,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIzMTgzMDAz","avatar_url":"https://avatars3.githubusercontent.com/u/23183003?v=4","gravatar_id":"","url":"https://api.github.com/users/chainer","html_url":"https://github.com/chainer","followers_url":"https://api.github.com/users/chainer/followers","following_url":"https://api.github.com/users/chainer/following{/other_user}","gists_url":"https://api.github.com/users/chainer/gists{/gist_id}","starred_url":"https://api.github.com/users/chainer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chainer/subscriptions","organizations_url":"https://api.github.com/users/chainer/orgs","repos_url":"https://api.github.com/users/chainer/repos","events_url":"https://api.github.com/users/chainer/events{/privacy}","received_events_url":"https://api.github.com/users/chainer/received_events","type":"Organization","site_admin":false},"repo":{"id":36914478,"node_id":"MDEwOlJlcG9zaXRvcnkzNjkxNDQ3OA==","name":"chainer","full_name":"chainer/chainer","private":false,"owner":{"login":"chainer","id":23183003,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIzMTgzMDAz","avatar_url":"https://avatars3.githubusercontent.com/u/23183003?v=4","gravatar_id":"","url":"https://api.github.com/users/chainer","html_url":"https://github.com/chainer","followers_url":"https://api.github.com/users/chainer/followers","following_url":"https://api.github.com/users/chainer/following{/other_user}","gists_url":"https://api.github.com/users/chainer/gists{/gist_id}","starred_url":"https://api.github.com/users/chainer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chainer/subscriptions","organizations_url":"https://api.github.com/users/chainer/orgs","repos_url":"https://api.github.com/users/chainer/repos","events_url":"https://api.github.com/users/chainer/events{/privacy}","received_events_url":"https://api.github.com/users/chainer/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/chainer/chainer","description":"A flexible framework of neural networks for deep learning","fork":false,"url":"https://api.github.com/repos/chainer/chainer","forks_url":"https://api.github.com/repos/chainer/chainer/forks","keys_url":"https://api.github.com/repos/chainer/chainer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chainer/chainer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chainer/chainer/teams","hooks_url":"https://api.github.com/repos/chainer/chainer/hooks","issue_events_url":"https://api.github.com/repos/chainer/chainer/issues/events{/number}","events_url":"https://api.github.com/repos/chainer/chainer/events","assignees_url":"https://api.github.com/repos/chainer/chainer/assignees{/user}","branches_url":"https://api.github.com/repos/chainer/chainer/branches{/branch}","tags_url":"https://api.github.com/repos/chainer/chainer/tags","blobs_url":"https://api.github.com/repos/chainer/chainer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chainer/chainer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chainer/chainer/git/refs{/sha}","trees_url":"https://api.github.com/repos/chainer/chainer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chainer/chainer/statuses/{sha}","languages_url":"https://api.github.com/repos/chainer/chainer/languages","stargazers_url":"https://api.github.com/repos/chainer/chainer/stargazers","contributors_url":"https://api.github.com/repos/chainer/chainer/contributors","subscribers_url":"https://api.github.com/repos/chainer/chainer/subscribers","subscription_url":"https://api.github.com/repos/chainer/chainer/subscription","commits_url":"https://api.github.com/repos/chainer/chainer/commits{/sha}","git_commits_url":"https://api.github.com/repos/chainer/chainer/git/commits{/sha}","comments_url":"https://api.github.com/repos/chainer/chainer/comments{/number}","issue_comment_url":"https://api.github.com/repos/chainer/chainer/issues/comments{/number}","contents_url":"https://api.github.com/repos/chainer/chainer/contents/{+path}","compare_url":"https://api.github.com/repos/chainer/chainer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chainer/chainer/merges","archive_url":"https://api.github.com/repos/chainer/chainer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chainer/chainer/downloads","issues_url":"https://api.github.com/repos/chainer/chainer/issues{/number}","pulls_url":"https://api.github.com/repos/chainer/chainer/pulls{/number}","milestones_url":"https://api.github.com/repos/chainer/chainer/milestones{/number}","notifications_url":"https://api.github.com/repos/chainer/chainer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chainer/chainer/labels{/name}","releases_url":"https://api.github.com/repos/chainer/chainer/releases{/id}","deployments_url":"https://api.github.com/repos/chainer/chainer/deployments","created_at":"2015-06-05T05:50:37Z","updated_at":"2018-10-20T03:50:37Z","pushed_at":"2018-10-20T03:50:19Z","git_url":"git://github.com/chainer/chainer.git","ssh_url":"git@github.com:chainer/chainer.git","clone_url":"https://github.com/chainer/chainer.git","svn_url":"https://github.com/chainer/chainer","homepage":"https://chainer.org","size":31667,"stargazers_count":4211,"watchers_count":4211,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1115,"mirror_url":null,"archived":false,"open_issues_count":238,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":1115,"open_issues":238,"watchers":4211,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/chainer/chainer/pulls/5538"},"html":{"href":"https://github.com/chainer/chainer/pull/5538"},"issue":{"href":"https://api.github.com/repos/chainer/chainer/issues/5538"},"comments":{"href":"https://api.github.com/repos/chainer/chainer/issues/5538/comments"},"review_comments":{"href":"https://api.github.com/repos/chainer/chainer/pulls/5538/comments"},"review_comment":{"href":"https://api.github.com/repos/chainer/chainer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/chainer/chainer/pulls/5538/commits"},"statuses":{"href":"https://api.github.com/repos/chainer/chainer/statuses/d0c6c13208bcdc4216cab330937fbb120de8728f"}},"author_association":"NONE"}}
{"actor":{"display_login":"hitsgub"}}