pytorch
56d1c755 - Make nn.stateless correctly reset parameters if the forward pass fails (#81262)

Commit
2 years ago
Make nn.stateless correctly reset parameters if the forward pass fails (#81262) This bug came up as I was adding new tests for ExpandedWeights If the forwards pass errors when the `_reparametrize_module` context manager is still on, the values from reparameterization will remain on the module outside of the context manager, where it should be the original values. This fixes that by putting a try/finally block around the forward call and call to reset the parameters Pull Request resolved: https://github.com/pytorch/pytorch/pull/81262 Approved by: https://github.com/zou3519
Author
samdow
Committer
Parents
Loading