Enable all SIM rules except disabled ones (#164645)

`SIM` rules are useful for simplifying boolean expressions and enhances code readability.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/164645
Approved by: https://github.com/ezyang, https://github.com/mlazos
This commit is contained in:
Yuanyuan Chen
2025-10-17 07:27:06 +00:00
committed by PyTorch MergeBot
parent f1d882212a
commit e925dfcc6b
54 changed files with 98 additions and 134 deletions

View File

@ -111,7 +111,7 @@ class TestAutocast(JitTestCase):
def test_runtime_autocast_state_expr(self):
@torch.jit.script
def fn(a, b):
with autocast(enabled=True if a[0][0] > 0.5 else False):
with autocast(enabled=bool((a[0][0] > 0.5).item())):
return torch.mm(a, b)
# runtime values for autocast enable argument are not supported
with self.assertRaises(RuntimeError):