mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
[2/N] Fix ruff warnings (#164460)
Apply ruff `SIM` rules. Pull Request resolved: https://github.com/pytorch/pytorch/pull/164460 Approved by: https://github.com/ezyang
This commit is contained in:
committed by
PyTorch MergeBot
parent
34042a9145
commit
35c4130fd1
@ -132,7 +132,7 @@ def _infer_device_type(*args):
|
||||
|
||||
def add_device_types(arg):
|
||||
nonlocal device_types
|
||||
if isinstance(arg, torch.Tensor) and not arg.device.type == "cpu":
|
||||
if isinstance(arg, torch.Tensor) and arg.device.type != "cpu":
|
||||
device_types.append(arg.device.type)
|
||||
tree_map(add_device_types, args)
|
||||
|
||||
|
@ -119,7 +119,7 @@ PIP_PATTERNS = [
|
||||
|
||||
def run(command):
|
||||
"""Return (return-code, stdout, stderr)."""
|
||||
shell = True if type(command) is str else False
|
||||
shell = type(command) is str
|
||||
p = subprocess.Popen(
|
||||
command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=shell
|
||||
)
|
||||
|
@ -228,7 +228,7 @@ CUDA_NOT_FOUND_MESSAGE = (
|
||||
)
|
||||
ROCM_HOME = _find_rocm_home() if (torch.cuda._is_compiled() and torch.version.hip) else None
|
||||
HIP_HOME = _join_rocm_home('hip') if ROCM_HOME else None
|
||||
IS_HIP_EXTENSION = True if ((ROCM_HOME is not None) and (torch.version.hip is not None)) else False
|
||||
IS_HIP_EXTENSION = bool(ROCM_HOME is not None and torch.version.hip is not None)
|
||||
ROCM_VERSION = None
|
||||
if torch.version.hip is not None:
|
||||
ROCM_VERSION = tuple(int(v) for v in torch.version.hip.split('.')[:2])
|
||||
|
Reference in New Issue
Block a user