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

Support for retain_graph=True #356

Closed
momeara opened this issue Oct 11, 2019 · 3 comments
Closed

Support for retain_graph=True #356

momeara opened this issue Oct 11, 2019 · 3 comments
Labels
feature Is an improvement or enhancement help wanted Open to be worked on

Comments

@momeara
Copy link

momeara commented Oct 11, 2019

Is your feature request related to a problem? Please describe.
Some models require retain_graph=True, but it's not possible to set it in the .backward() call inside of Trainer.__run_training_batch(...)

Describe the solution you'd like
Add train_graph member function the LightningModule have the trainer read this option and then pass it into the .backward() call.

Describe alternatives you've considered
Driving a version of Trainer to support retain_graph=True is tough because __run_training_batch and other functions are name-mangled.

@momeara momeara added feature Is an improvement or enhancement help wanted Open to be worked on labels Oct 11, 2019
@williamFalcon
Copy link
Contributor

why don’t we put a hook for the backward pass and you can override if you need retain_graph? that keeps it flexible for anything else someone wants to do later

@momeara
Copy link
Author

momeara commented Oct 12, 2019 via email

@williamFalcon
Copy link
Contributor

@yl1991 @momeara did you guys want to submit a PR for this?

williamFalcon added a commit that referenced this issue Oct 24, 2019
williamFalcon added a commit that referenced this issue Oct 24, 2019
williamFalcon added a commit that referenced this issue Oct 24, 2019
williamFalcon added a commit that referenced this issue Oct 24, 2019
williamFalcon added a commit that referenced this issue Oct 24, 2019
williamFalcon added a commit that referenced this issue Oct 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Is an improvement or enhancement help wanted Open to be worked on
Projects
None yet
Development

No branches or pull requests

2 participants