tflearn中的多层动态LSTM

时间:2017-08-21 03:26:31

标签: tensorflow deep-learning lstm tflearn rnn

我想用多层动态LSTM网络提供IMDB数据集,但似乎下一个LSTM图层无法解析先前的图层输出。

代码:

net = tflearn.input_data([None, 100])
net = tflearn.embedding(net, input_dim=6819, output_dim=256)
net = tflearn.lstm(net, 256, weights_init="xavier", dynamic=True, return_seq=True)
net = tflearn.dropout(net, 0.8)
net = tflearn.lstm(net, 256, weights_init="xavier", dynamic=True)
net = tflearn.dropout(net, 0.8)
net = tflearn.fully_connected(net, 2, activation='softmax')

错误:

Traceback (most recent call last):
  File "train.py", line 65, in <module>
    model.fit(train_x, train_y, validation_set=(test_x, test_y), show_metric=True, batch_size=32)
  File ".../tflearn/models/dnn.py", line 216, in fit
    callbacks=callbacks)
  File ".../tflearn/helpers/trainer.py", line 339, in fit
    show_metric)
  File ".../tflearn/helpers/trainer.py", line 818, in _train
    feed_batch)
  File ".../tensorflow/python/client/session.py", line 895, in run
    run_metadata_ptr)
  File ".../tensorflow/python/client/session.py", line 1100, in _run
    % (np_val.shape, subfeed_t.name, str(subfeed_t.get_shape())))
ValueError: Cannot feed value of shape (32, 2) for Tensor u'TargetsData/Y:0', which has shape '(100, 2)'

0 个答案:

没有答案