lstm与sequence_cnn结合使用报错:Error: Only support one level sequence now.
Created by: lliqi-echo
序列数据分类,想要将CNN和lstm结合使用
模型设置如下:
def cnnlstm(data, input_dim=4, emb_dim=128, hid_dim=512): emb = fluid.embedding( input=data, size=[input_dim, emb_dim], is_sparse=True) conv_3 = fluid.nets.sequence_conv_pool( input=emb, num_filters=hid_dim, filter_size=3, act="relu", pool_type="max") conv_4 = fluid.nets.sequence_conv_pool( input=emb, num_filters=hid_dim, filter_size=4, act="relu", pool_type="max") fc = fluid.layers.fc(input=[conv_3, conv_4], size=512, act='relu') lstm, cell1 = fluid.layers.dynamic_lstm(input=fc, size=512) drop = fluid.layers.dropout(x=lstm, dropout_prob=0.5, seed=None) prediction = fluid.layers.fc(input=drop, size=2, act="softmax") return prediction
数据类型:
seq = fluid.layers.data(name='seq', shape=[None], dtype='int64',lod_level=1)
运行报错:
Error Message Summary:
Error: Only support one level sequence now. [Hint: Expected lods.size() == 1UL, but received lods.size():0 != 1UL:1.] at (/paddle/paddle/fluid/operators/math/sequence2batch.h:79) [operator < lstm > error]
望能解答,谢谢!