Enable ruff rule E721 (#165162)

`E721` checks for object type comparisons using == and other comparison operators. This is useful because it is recommended to use `is` for type comparisons.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/165162
Approved by: https://github.com/Skylion007
This commit is contained in:
Yuanyuan Chen
2025-10-11 06:43:53 +00:00
committed by PyTorch MergeBot
parent 220a34118f
commit 9e7c19f72b
78 changed files with 166 additions and 164 deletions

View File

@ -878,7 +878,7 @@ def forward(self, scores_1, mask_1, value_1):
zip(real_out, decomp_out, real_out_double)
):
if not isinstance(orig, torch.Tensor):
assert type(orig) == type(decomp)
assert type(orig) is type(decomp)
assert orig == decomp
continue
op_assert_ref(
@ -895,7 +895,7 @@ def forward(self, scores_1, mask_1, value_1):
else:
for orig, decomp in zip(real_out, decomp_out):
if not isinstance(orig, torch.Tensor):
assert type(orig) == type(decomp)
assert type(orig) is type(decomp)
assert orig == decomp
continue
op_assert_equal(