Deprecate torch._utils.is_compiling() and torch._dynamo.external_utils.is_compiling() (#127690)

This PR is split from PR #126898.

- #126898

------

Pull Request resolved: https://github.com/pytorch/pytorch/pull/127690
Approved by: https://github.com/Skylion007, https://github.com/malfet
This commit is contained in:
Xuehai Pan
2024-11-05 15:29:47 +08:00
committed by PyTorch MergeBot
parent ffb7a08921
commit e84d1121ad
31 changed files with 84 additions and 80 deletions

View File

@ -288,7 +288,7 @@ class TestOptimRenewed(TestCase):
inpt = torch.randn(5, device=device, dtype=dtype)
# avoid endless recompiles by wrapping LR in a tensor if we're compiling
lr = torch.tensor(0.01) if torch._utils.is_compiling() else 0.01
lr = torch.tensor(0.01) if torch.compiler.is_compiling() else 0.01
optimizer = optim_cls([{"params": [weight]}, {"params": [bias], "lr": lr}])
schedulers = [scheduler_c(optimizer) for scheduler_c in schedulers_c]