Skip to content

Commit 8e3cac4

Browse files
committed
control flow ctx workaround
1 parent 61c8444 commit 8e3cac4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

returnn/tf/layers/base.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,12 @@ def fixup_out_data(cls, output, network):
394394
assert output.batch
395395
output.batch = output.batch.copy_set_beam(output.beam)
396396
if output.control_flow_ctx != network.get_control_flow_ctx():
397+
x = output.placeholder
397398
output = output.copy_template_set_ctx(network.get_control_flow_ctx())
399+
if x is not None:
400+
# Some layers might just copy the input. But the input might have buggy ctx.
401+
# Just leave the placeholder as-is. Most layers should anyway reset this.
402+
output.placeholder = x
398403
return output
399404

400405
def get_full_ctx_name(self):

0 commit comments

Comments
 (0)