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
This commit is contained in:
Xuehai Pan
2024-06-08 11:57:11 +00:00
committed by PyTorch MergeBot
parent 917387f66d
commit 348b181a97
22 changed files with 54 additions and 47 deletions

View File

@ -287,7 +287,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]