[BE]: Simplify some list comps to generators C419 (#132578)

Simplifies some list comprehensions to generator which is more efficient. Automatically applied diffs for the most part with ruff

Pull Request resolved: https://github.com/pytorch/pytorch/pull/132578
Approved by: https://github.com/ezyang
This commit is contained in:
Aaron Gokaslan
2024-08-04 17:46:24 +00:00
committed by PyTorch MergeBot
parent 4226ed1585
commit fd4b649e6c
7 changed files with 26 additions and 42 deletions

View File

@ -414,8 +414,8 @@ def jagged_from_list(
)
# compute this now since it's easy
min_seqlen = min([t.shape[0] for t in tensors])
max_seqlen = max([t.shape[0] for t in tensors])
min_seqlen = min(t.shape[0] for t in tensors)
max_seqlen = max(t.shape[0] for t in tensors)
ret_nt = nested_view_from_values_offsets(
values, offsets, min_seqlen=min_seqlen, max_seqlen=max_seqlen
)