Fixes for 123400 (#123406)

Pull Request resolved: https://github.com/pytorch/pytorch/pull/123406
Approved by: https://github.com/janeyx99
ghstack dependencies: #123324, #123404, #123405, #124309
This commit is contained in:
Michael Lazos
2024-04-18 22:32:05 -07:00
committed by PyTorch MergeBot
parent 5050e627dc
commit 68a027f144
2 changed files with 5 additions and 78 deletions

View File

@ -1607,7 +1607,11 @@ class TestOptimRenewed(TestCase):
# Make some state
for _ in range(3):
optimizer.step(closure)
if optim_info.step_requires_closure:
optimizer.step(closure)
else:
closure()
optimizer.step()
self.assertEqual(getPublicAttrs(optimizer), getPublicAttrs(deepcopy(optimizer)))