mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-21 05:34:18 +08:00
[BE]: FURB142 - Remove set mutations. Use set update (#124551)
Uses set mutation methods instead of manually reimplementing (update, set_difference etc). Pull Request resolved: https://github.com/pytorch/pytorch/pull/124551 Approved by: https://github.com/ezyang
This commit is contained in:
committed by
PyTorch MergeBot
parent
5a1216bb2e
commit
29cc293725
@ -9523,8 +9523,7 @@ tensor([[[1.+1.j, 1.+1.j, 1.+1.j, ..., 1.+1.j, 1.+1.j, 1.+1.j],
|
||||
|
||||
device_set = {'cpu', 'cpu:0', 'cuda', 'cuda:0', 'cuda:1', 'cuda:10', 'cuda:100'}
|
||||
device_hash_set = set()
|
||||
for device in device_set:
|
||||
device_hash_set.add(hash(torch.device(device)))
|
||||
device_hash_set.update(hash(torch.device(device)) for device in device_set)
|
||||
self.assertEqual(len(device_set), len(device_hash_set))
|
||||
|
||||
def get_expected_device_repr(device):
|
||||
|
Reference in New Issue
Block a user