You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there a better way to set retain_graph, especially when using two optimizers?
I have read the issue #356 and the corresponding fix, to set it by overriding the backward function.
However, this becomes messy especially when more than 1 optimizers are used, as the function doesn't have the optimizer_idx as an argument.
There are workarounds like naming the optimizer object and using that to set/reset the retain graph, but passing optimizer_idx would be great.
This shouldn't be difficult as the opt_idx variable is available inside the loop in which the backward function is called
Version [0.6.0]
The text was updated successfully, but these errors were encountered:
Is there a better way to set
retain_graph
, especially when using two optimizers?I have read the issue #356 and the corresponding fix, to set it by overriding the
backward
function.However, this becomes messy especially when more than 1 optimizers are used, as the function doesn't have the
optimizer_idx
as an argument.There are workarounds like naming the optimizer object and using that to set/reset the
retain graph
, but passingoptimizer_idx
would be great.This shouldn't be difficult as the
opt_idx
variable is available inside the loop in which thebackward
function is calledThe text was updated successfully, but these errors were encountered: