mirror of
https://github.com/pytorch/pytorch.git
synced 2025-11-11 22:34:53 +08:00
Remove unnecessary list comprehensions (#164103)
Fixes #ISSUE_NUMBER Pull Request resolved: https://github.com/pytorch/pytorch/pull/164103 Approved by: https://github.com/Lucaskabela, https://github.com/mlazos
This commit is contained in:
committed by
PyTorch MergeBot
parent
ca19815e3c
commit
85012fe167
@ -88,7 +88,7 @@ def normalize_axis_tuple(axis, ndim, argname=None, allow_duplicate=False):
|
||||
except TypeError:
|
||||
pass
|
||||
# Going via an iterator directly is slower than via list comprehension.
|
||||
axis = tuple([normalize_axis_index(ax, ndim, argname) for ax in axis])
|
||||
axis = tuple(normalize_axis_index(ax, ndim, argname) for ax in axis)
|
||||
if not allow_duplicate and len(set(map(int, axis))) != len(axis):
|
||||
if argname:
|
||||
raise ValueError(f"repeated axis in `{argname}` argument")
|
||||
|
||||
Reference in New Issue
Block a user