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-13 01:48:55 +00:00
committed by PyTorch MergeBot
parent a33f85e791
commit 8de85896e0
78 changed files with 166 additions and 164 deletions

View File

@ -428,7 +428,7 @@ def percentile(
interpolation: NotImplementedType = None,
):
# np.percentile(float_tensor, 30) : q.dtype is int64 => q / 100.0 is float32
if _dtypes_impl.python_type_for_torch(q.dtype) == int:
if _dtypes_impl.python_type_for_torch(q.dtype) is int:
q = q.to(_dtypes_impl.default_dtypes().float_dtype)
qq = q / 100.0