这样定义算不算一个长短期记忆网络
Created by: yeyupiaoling
我定义了以下一个网络,但这个算不算一个长短期记忆网络呢?
def lstm_net(data, input_dim, class_dim, emb_dim, hid_dim):
emb = fluid.layers.embedding(input=data, size=[input_dim, emb_dim], is_sparse=True)
fc1 = fluid.layers.fc(input=emb, size=hid_dim)
lstm1, _ = fluid.layers.dynamic_lstm(input=fc1, size=hid_dim)
fc2 = fluid.layers.sequence_pool(input=fc1, pool_type='max')
lstm2 = fluid.layers.sequence_pool(input=lstm1, pool_type='max')
out = fluid.layers.fc(input=[fc2, lstm2], size=class_dim, act='softmax')
return out