[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:
Aaron Gokaslan
2024-04-21 14:12:30 +00:00
committed by PyTorch MergeBot
parent 5a1216bb2e
commit 29cc293725
28 changed files with 71 additions and 90 deletions

View File

@ -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):