mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
[BE] Apply almost all remaining flake8-comprehension checks (#94676)
Applies the remaining flake8-comprehension fixes and checks. This changes replace all remaining unnecessary generator expressions with list/dict/set comprehensions which are more succinct, performant, and better supported by our torch.jit compiler. It also removes useless generators such as 'set(a for a in b)`, resolving it into just the set call. Pull Request resolved: https://github.com/pytorch/pytorch/pull/94676 Approved by: https://github.com/ezyang
This commit is contained in:
committed by
PyTorch MergeBot
parent
54c0f37646
commit
67d9790985
@ -27,7 +27,7 @@ if GRAPH_EXECUTOR == ProfilingMode.PROFILING:
|
||||
|
||||
|
||||
def strip_profiling_nodes(nodes):
|
||||
profiling_opcodes = set(['prim::BailoutTemplate', 'prim::BailOut'])
|
||||
profiling_opcodes = {'prim::BailoutTemplate', 'prim::BailOut'}
|
||||
return [n for n in nodes if n.kind() not in profiling_opcodes]
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user