mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
[2/N] More ruff SIM fixes (#165031)
This is follow-up of #164695 to apply ruff SIM rules to more files. Most changes are about simplifying dict.get because None is already the default value. Pull Request resolved: https://github.com/pytorch/pytorch/pull/165031 Approved by: https://github.com/mlazos
This commit is contained in:
committed by
PyTorch MergeBot
parent
ffc9559d9f
commit
38095fbd13
@ -598,7 +598,7 @@ def _distribute_tensors(
|
||||
if pg is None:
|
||||
pg = dist.distributed_c10d._get_default_group()
|
||||
for key in keys:
|
||||
_local_state = local_state_dict.get(key, None)
|
||||
_local_state = local_state_dict.get(key)
|
||||
if _local_state is None or torch.is_tensor(_local_state):
|
||||
continue
|
||||
|
||||
@ -708,7 +708,7 @@ def _distribute_state_dict(
|
||||
local_state_dict[key] = value.cpu()
|
||||
else:
|
||||
assert isinstance(value, torch.Tensor)
|
||||
local_state = local_state_dict.get(key, None)
|
||||
local_state = local_state_dict.get(key)
|
||||
if local_state is None:
|
||||
continue
|
||||
elif isinstance(local_state, DTensor):
|
||||
|
Reference in New Issue
Block a user