Skip to content

Conversation

@hughperkins
Copy link
Contributor

@soumith
Copy link
Contributor

soumith commented Jul 13, 2017

@apaszke is likely going to reject this PR :)
Regardless, this is a good POC.
I think the right approach is to do it somewhere deep inside the autograd engine.

@hughperkins
Copy link
Contributor Author

(added unit test)

@hughperkins
Copy link
Contributor Author

(ah, our comments crossed en-route, or rather, I just wrote and pasted without noticing there were new comments :-) )

@hughperkins
Copy link
Contributor Author

alright, fair enough. Can we keep this open until someone implement/proposes a better solution (no need to merge, but at least its a place-holder to remind us to find a better way to do something similar?)

@hughperkins
Copy link
Contributor Author

hughperkins commented Jul 13, 2017

(or ... could we merge for now, and then replace the user API method, ie retain_grad() with a better implementation, at some indefinite point in the future?)

@soumith
Copy link
Contributor

soumith commented Jul 13, 2017

I'll chat with @apaszke today and discuss, we'll keep this open for now.

@soumith
Copy link
Contributor

soumith commented Jul 14, 2017

@apaszke 's main reservations with this PR is that the PR in it's current state creates a reference cycle (which means higher memory usage until the GC kicks in). instead of holding onto self, you can create a weakref on self instead.

@apaszke
Copy link
Contributor

apaszke commented Jul 14, 2017

Also, the method can insert the same hook multiple times, which is unnecessary

@soumith
Copy link
Contributor

soumith commented Jul 26, 2017

closing in favor of #2199
Hugh's attribution has been preserved.

@soumith soumith closed this Jul 26, 2017
@hughperkins
Copy link
Contributor Author

Awesome, thanks! :-)

@hughperkins hughperkins deleted the retain-grad branch July 26, 2017 22:42
zou3519 pushed a commit to zou3519/pytorch that referenced this pull request Mar 30, 2018
…ddppq (pytorch#2078)

* Fix cmake dependency error in static library case. Peer coded with @bddppq

* Temporarily add back the private dependencies to the binary targets
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants