Skip to content

Commit

Permalink
Fix hierarchical paths to sub-layers in RecLayer
Browse files Browse the repository at this point in the history
  • Loading branch information
Zettelkasten committed Nov 24, 2020
1 parent 74c70a5 commit 793d46c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions returnn/tf/layers/rec.py
Original file line number Diff line number Diff line change
Expand Up @@ -3132,6 +3132,13 @@ def get_layer(name):
:param str name:
:rtype: LayerBase
"""
if '/' in name:
# It may be a hierarchical path to a sub-layer, which should have been found by get_layer()
# but maybe it's not constructed yet, so try constructing the root layer.
root_layer = get_layer(name.split('/')[0])
sub_layer = root_layer.get_sub_layer('/'.join(name.split('/')[1:])) # get the sub-layer from the root-layer
if sub_layer:
return sub_layer
if name.startswith("prev:"):
return get_prev_layer(name[len("prev:"):])
if name.startswith("base:"):
Expand Down

1 comment on commit 793d46c

@albertz
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also put this commit as a separate PR?

Please sign in to comment.