Fix test/test_optim.py error message. (#153076)

Fixes an error message in test/test_optim.py

Current behavior: If running the test with Adagrad, the error message reads: "SGD does not currently support capturable".

Fix: The error message now says correctly: "Adagrad does not currently support capturable".
Pull Request resolved: https://github.com/pytorch/pytorch/pull/153076
Approved by: https://github.com/janeyx99
This commit is contained in:
Meet Patel 2025-05-07 22:46:00 +00:00 committed by PyTorch MergeBot
parent 7706074ece
commit 4270517cbf

View File

@ -1179,7 +1179,7 @@ class TestOptimRenewed(TestCase):
opt_name = optim_cls.__name__
if opt_name in ("SGD", "Adagrad") and impl == "capturable":
# Capturable SGD/Adagrad does not exist
self.skipTest("SGD does not currently support capturable")
self.skipTest(f"{opt_name} does not currently support capturable")
if _get_device_type(device) == "cpu":
self.skipTest("Test is only for non-cpu devices")
elif (