Retain_variables option is deprecated and will be removed in 0.3

I just noticed a warning due to the use of loss.backward(retain_variables=True): "UserWarning: retain_variables option is deprecated and will be removed in 0.3. Use retain_graph instead.
warnings.warn("retain_variables option is deprecated and will be removed in 0.3. "

I understand that gradients are typically for one-time update and are discarded to release memory without specifying retain_variables=True. What’s the motivation for removing this API? Will there be some alternative in 0.3?

The retain_graph=True option is the new name for this option. They have the same effect, it is just a name change to be more consistent with the backend and new APIs.

3 Likes

I see. Thanks a lot!