mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
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:
committed by
PyTorch MergeBot
parent
a33f85e791
commit
8de85896e0
@ -2842,7 +2842,7 @@ def _index_add(
|
||||
if alpha != 1:
|
||||
python_type = utils.dtype_to_type(x.dtype)
|
||||
torch._check(
|
||||
python_type == bool
|
||||
python_type is bool
|
||||
or utils.is_weakly_lesser_type(type(alpha), python_type),
|
||||
lambda: f"alpha argument of type {type(alpha)} cannot be safely cast to type {python_type}!",
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user