Skip to content

Commit

Permalink
Core: yield from in collect_leaves
Browse files Browse the repository at this point in the history
- use yield from in `collect_leaves` in `core.py` to iterate through
  children
  • Loading branch information
chr5tphr committed Apr 8, 2024
1 parent 60a2c08 commit c71c868
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/zennit/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,7 @@ def collect_leaves(module):
children = module.children()
for child in children:
is_leaf = False
for leaf in collect_leaves(child):
yield leaf
yield from collect_leaves(child)
if is_leaf: # pragma: no branch
yield module

Expand Down

0 comments on commit c71c868

Please sign in to comment.