mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
[BE]: Optimize min/max/sum comprehensions C419 (#123960)
Automatic fixes that replaces certain list comprehensions with generator ones where appropriate so that they are immediately consumed. This is preview functionality in ruff for rule C419 and it was automatically applied. Co-authored-by: Nikita Shulga <2453524+malfet@users.noreply.github.com> Pull Request resolved: https://github.com/pytorch/pytorch/pull/123960 Approved by: https://github.com/malfet
This commit is contained in:
committed by
PyTorch MergeBot
parent
961eb39348
commit
1d6c5972c1
@ -334,9 +334,7 @@ class TestForeach(TestCase):
|
||||
[rhs_arg, tensors], is_cuda=False, expect_fastpath=False
|
||||
)
|
||||
).mean().backward()
|
||||
sum(
|
||||
[ref.func(ref_rhs_arg, t) for t in ref_tensors]
|
||||
).mean().backward()
|
||||
sum(ref.func(ref_rhs_arg, t) for t in ref_tensors).mean().backward()
|
||||
self.assertEqual(
|
||||
[t.grad for t in tensors], [t.grad for t in ref_tensors]
|
||||
)
|
||||
|
Reference in New Issue
Block a user