update docs (#4739)

This commit is contained in:
chaton 2020-11-19 16:53:10 +00:00 committed by GitHub
parent 18730e307f
commit 8e8263ab6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -1475,6 +1475,11 @@ with the hidden
# hiddens are the hiddens from the previous truncated backprop step
out, hiddens = self.lstm(data, hiddens)
# remember to detach() hiddens.
# If you don't, you will get a RuntimeError: Trying to backward through
# the graph a second time...
# Using hiddens.detach() allows each split to be disconnected.
return {
"loss": ...,
"hiddens": hiddens # remember to detach() this
@ -1702,4 +1707,3 @@ The metrics sent to the progress bar.
progress_bar_metrics = trainer.progress_bar_metrics
assert progress_bar_metrics['a_val'] == 2