mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Enable all PIE rules on ruff (#165814)
This PR enables all PIE rules on ruff, there are already some enabled rules from this family, the new added rules are
```
PIE796 Enum contains duplicate value: {value}
PIE808 Unnecessary start argument in range
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/165814
Approved by: https://github.com/ezyang
This commit is contained in:
committed by
PyTorch MergeBot
parent
a0948d4d23
commit
fdab48a7c1
@ -243,7 +243,7 @@ class TestTEFuser(JitTestCase):
|
||||
return x2.sum()
|
||||
|
||||
with texpr_reductions_enabled():
|
||||
a = torch.tensor(list(range(0, 15)), dtype=torch.float, device="cpu")
|
||||
a = torch.tensor(list(range(15)), dtype=torch.float, device="cpu")
|
||||
a = a.reshape(5, 3)
|
||||
scripted = self.checkScript(func, (a,))
|
||||
self.assertLastGraphAllFused()
|
||||
@ -259,7 +259,7 @@ class TestTEFuser(JitTestCase):
|
||||
return x.sum((-2,)) * 2
|
||||
|
||||
with texpr_reductions_enabled():
|
||||
a = torch.tensor(list(range(0, 15)), dtype=torch.float, device="cpu")
|
||||
a = torch.tensor(list(range(15)), dtype=torch.float, device="cpu")
|
||||
a = a.reshape(5, 3)
|
||||
scripted = self.checkScript(func, (a,))
|
||||
self.assertLastGraphAllFused()
|
||||
@ -271,7 +271,7 @@ class TestTEFuser(JitTestCase):
|
||||
return x.sum((0,), keepdim=True, dtype=torch.double) * 2
|
||||
|
||||
with texpr_reductions_enabled():
|
||||
a = torch.tensor(list(range(0, 15)), dtype=torch.float, device="cpu")
|
||||
a = torch.tensor(list(range(15)), dtype=torch.float, device="cpu")
|
||||
a = a.reshape(5, 3)
|
||||
|
||||
self.checkScript(func, (a,))
|
||||
@ -2234,7 +2234,7 @@ class TestTEFuser(JitTestCase):
|
||||
|
||||
indices = [0, 1, 2, 3]
|
||||
sets = []
|
||||
for i in range(0, len(indices) + 1):
|
||||
for i in range(len(indices) + 1):
|
||||
for subset in combinations(indices, i):
|
||||
sets.append(subset) # noqa: PERF402
|
||||
|
||||
|
||||
Reference in New Issue
Block a user