{"action":"closed","issue":{"url":"https://api.github.com/repos/fchollet/keras/issues/2102","repository_url":"https://api.github.com/repos/fchollet/keras","labels_url":"https://api.github.com/repos/fchollet/keras/issues/2102/labels{/name}","comments_url":"https://api.github.com/repos/fchollet/keras/issues/2102/comments","events_url":"https://api.github.com/repos/fchollet/keras/issues/2102/events","html_url":"https://github.com/fchollet/keras/issues/2102","id":143933355,"number":2102,"title":"memory leak when using tensorflow","user":{"login":"tzachar","id":4946827,"avatar_url":"https://avatars.githubusercontent.com/u/4946827?v=3","gravatar_id":"","url":"https://api.github.com/users/tzachar","html_url":"https://github.com/tzachar","followers_url":"https://api.github.com/users/tzachar/followers","following_url":"https://api.github.com/users/tzachar/following{/other_user}","gists_url":"https://api.github.com/users/tzachar/gists{/gist_id}","starred_url":"https://api.github.com/users/tzachar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tzachar/subscriptions","organizations_url":"https://api.github.com/users/tzachar/orgs","repos_url":"https://api.github.com/users/tzachar/repos","events_url":"https://api.github.com/users/tzachar/events{/privacy}","received_events_url":"https://api.github.com/users/tzachar/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2016-03-28T09:07:05Z","updated_at":"2016-07-19T21:35:18Z","closed_at":"2016-07-19T21:35:18Z","body":"Hello.\r\n\r\nWhen using tensorflow, all ops are entered into the global tf graph. This results in memory leaks and loooong compilation times when  building several models, one after the other, in the same python process (think ipython, cross validation, etc.)\r\n\r\nFor now, I solve this on my end by doing the following:\r\n```\r\nimport keras.backend.tensorflow_backend\r\nif keras.backend.tensorflow_backend._SESSION:\r\n   import tensorflow as tf\r\n   tf.reset_default_graph() \r\n   keras.backend.tensorflow_backend._SESSION.close()\r\n   keras.backend.tensorflow_backend._SESSION = None\r\n```\r\n\r\nMaybe we should incorporate this into a keras.reset() function?\r\n"}}
{"actor":{"display_login":"fchollet"}}