fully connected layer作为lstm输入问题
Created by: hyo009
多个全联接层作为序列输入lstm 网络结构至fully connected layers部分都能跑通,但加入lstm后,出现如下错误:
F0306 06:04:09.414822 1037 LstmLayer.cpp:155] Check failed: input.sequenceStartPositions
*** Check failure stack trace: ***
@ 0x7f5e44ff8a5d google::LogMessage::Fail()
@ 0x7f5e44ffc50c google::LogMessage::SendToLog()
@ 0x7f5e44ff8583 google::LogMessage::Flush()
@ 0x7f5e44ffda1e google::LogMessageFatal::~LogMessageFatal()
@ 0x7f5e44d49882 paddle::LstmLayer::forward()
@ 0x7f5e44bd7e3d paddle::NeuralNetwork::forward()
@ 0x7f5e44bd8a93 paddle::GradientMachine::forwardBackward()
@ 0x7f5e44fd4764 GradientMachine::forwardBackward()
@ 0x7f5e44b70fc9 _wrap_GradientMachine_forwardBackward
@ 0x4c30ce PyEval_EvalFrameEx
@ 0x4b9ab6 PyEval_EvalCodeEx
@ 0x4c1e6f PyEval_EvalFrameEx
@ 0x4b9ab6 PyEval_EvalCodeEx
@ 0x4c16e7 PyEval_EvalFrameEx
@ 0x4b9ab6 PyEval_EvalCodeEx
@ 0x4c16e7 PyEval_EvalFrameEx
@ 0x4b9ab6 PyEval_EvalCodeEx
@ 0x4c1e6f PyEval_EvalFrameEx
@ 0x4b9ab6 PyEval_EvalCodeEx
@ 0x4eb30f (unknown)
@ 0x4e5422 PyRun_FileExFlags
@ 0x4e3cd6 PyRun_SimpleFileExFlags
@ 0x493ae2 Py_Main
@ 0x7f5e61cde830 __libc_start_main
@ 0x4933e9 _start
@ (nil) (unknown)
Aborted (core dumped)
加入lstm的模型结构如下:
...
fc_layer_1_dict = {}
for iter in range(13):
fc_1 = paddle.layer.fc(input=pool_layer_4_dict[iter], size=10*4, act=paddle.activation.Relu())
fc_layer_1_dict[iter] = fc_1
lstm_layer_1_dict = {}
lstm = paddle.layer.lstmemory(input=fc_layer_1_dict[0],bias_attr=paddle.attr.Param(initial_std=0., l2_rate=0.))
lstm_layer_1_dict[0] = lstm
inputs = [fc_layer_1_dict[0],lstm]
for iter in range(1,13):
fc = paddle.layer.fc(input=[fc_layer_1_dict[iter],lstm],
size=10*4,
act=paddle.activation.Linear())
lstm_layer_1_dict[iter] = paddle.layer.lstmemory(input=fc,bias_attr=paddle.attr.Param(initial_std=0., l2_rate=0.))
inputs = [fc, lstm_layer_1_dict[iter]]
fc_last = paddle.layer.pooling(input=inputs[0], pooling_type=paddle.pooling.Max())
lstm_last = paddle.layer.pooling(input=inputs[1], pooling_type=paddle.pooling.Max())