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
e595136187
commit
c79dfdc655
@ -4738,7 +4738,7 @@ def transpose(a: TensorLikeType, dim0: int, dim1: int) -> TensorLikeType:
|
||||
if a.ndim <= 1 or dim0 == dim1:
|
||||
return aten.alias.default(a)
|
||||
|
||||
_permutation = list(range(0, a.ndim))
|
||||
_permutation = list(range(a.ndim))
|
||||
_permutation[_dim0] = _dim1
|
||||
_permutation[_dim1] = _dim0
|
||||
return torch.permute(a, _permutation)
|
||||
|
Reference in New Issue
Block a user