Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CompGraph class destructor not called #40

Open
timmeinhardt opened this issue Aug 31, 2017 · 0 comments
Open

CompGraph class destructor not called #40

timmeinhardt opened this issue Aug 31, 2017 · 0 comments

Comments

@timmeinhardt
Copy link

timmeinhardt commented Aug 31, 2017

For my last project I had to perform an extensive hyperparameter optimisation during which I regularly ran out of memory. After spending some time to find the memory leak, I came across the CompGraph class which has a self reference cycle. Such a cycle prevents a class from being deleted.

The problem is the self injected into the other objects in those two lines:

self.forward_log = TimingsLog(self.nodes + [self])
self.adjoint_log = TimingsLog(self.nodes + [self])

To fix the problem I changed the code to [str(self)] which then only injects a string. Since there is generally only one computational graph, time logging stills works (exact object references should only be necessary for graph elements which appear more than once). But there is probably a more elegant way to resolve this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant