KeyError when using recurrent_group
Created by: gibiansky
I have the following code:
size = 100
boot = paddle.layer.fc(
size=size,
act=paddle.activation.Tanh(),
bias_attr=False,
input=static_input)
def gru_with_static_input(current_input, static_input):
mem = paddle.layer.memory(name='memory', size=size, boot_layer=boot)
gru_inputs = paddle.layer.fc(
act=paddle.activation.Linear(),
size=size * 3, bias_attr=False,
input=[static_input, current_input])
gru_step = paddle.layer.gru_step(
name='gru_decoder',
input=gru_inputs,
output_mem=mem,
size=size)
return gru_step
fwd = paddle.layer.recurrent_group(input=inputs, step=gru_with_static_input, name="fwd")
I get the following error which I don't understand:
File "paddlepaddle.py", line 117, in lstm
fwd = paddle.layer.recurrent_group(input=inputs, step=make_gru_step(size, static), name="fwd")
File "/usr/local/lib/python2.7/dist-packages/paddle/v2/config_base.py", line 52, in wrapped
out = f(*args, **xargs)
File "/usr/local/lib/python2.7/dist-packages/paddle/trainer_config_helpers/default_decorators.py", line 53, in __wrapper__
return func(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/paddle/trainer_config_helpers/layers.py", line 3643, in recurrent_group
RecurrentLayerGroupEnd(name=name)
File "/usr/local/lib/python2.7/dist-packages/paddle/trainer/config_parser.py", line 391, in RecurrentLayerGroupEnd
layer = g_layer_map[pair.layer_name]
KeyError: u'memory@fwd'
This is using the docker image paddlepaddle/book:latest-gpu
.
What is going on? How do I fix this? I took the code from the machine translation notebook and modified it.