以字符为单元做LSTM
Created by: hweidream
想请问在以字符为单元进行RNN得到每个词的词表示时训练出core
char = fluid.layers.data( name='char_data', shape=[-1, 1], dtype='int64', lod_level=2) char_fc = fluid.layers.fc(input=char_embedding, size=hidden_dim, act='tanh') clstm_0, _ = fluid.layers.dynamic_lstm(input=char_fc, \ size=hidden_dim, candidate_activation='relu', gate_activation='sigmoid', cell_activation='sigmoid', is_reverse=False) clstm_1, _ = fluid.layers.dynamic_lstm(input=char_fc, \ size=hidden_dim, candidate_activation='relu', gate_activation='sigmoid', cell_activation='sigmoid', is_reverse=True) char_lstm = fluid.layers.sequence_last_step(input=clstm_0) char_lstm_reverse = fluid.layers.sequence_last_step(input=clstm_1)
报错信息如下:
cost = exe.run(main_program, feed=feeder.feed(data), fetch_list=[avg_cost]) File "/home/tools/paddle_fluid/paddle_release_home/python/lib/python2.7/site-packages/paddle/fluid/executor.py", line 472, in run self.executor.run(program.desc, scope, 0, True, True) paddle.fluid.core.EnforceNotMet: Enforce failed. Expected lods.size() == 1UL, but received lods.size():2 != 1UL:1. Only support one level sequence now. at [/paddle/paddle/fluid/operators/math/sequence2batch.h:79]