【发布时间】:2018-08-29 14:17:46
【问题描述】:
我运行了tutorial 的代码,但出现以下错误
我读了一些类似的帖子,但它并没有真正帮助我
ValueError: 尺寸必须相等,但为 128 和 364 'RNN_forward/rnn/while/rnn/multi_rnn_cell/cell_0/basic_lstm_cell/MatMul_1'(操作:'MatMul'),输入形状:[250,128]、[364,256]。
这是教程末尾的代码:
n_words = len(word_index)
embed_size = 300
batch_size = 250
lstm_size = 128
num_layers = 2
dropout = 0.5
learning_rate = 0.001
epochs = 100
multiple_fc = False
fc_units = 256
# Train the model with the desired tuning parameters# Train
for lstm_size in [64,128]:
for multiple_fc in [True, False]:
for fc_units in [128, 256]:
log_string = 'ru={},fcl={},fcu={}'.format(lstm_size,
multiple_fc,
fc_units)
model = build_rnn(n_words = n_words,
embed_size = embed_size,
batch_size = batch_size,
lstm_size = lstm_size,
num_layers = num_layers,
dropout = dropout,
learning_rate = learning_rate,
multiple_fc = multiple_fc,
fc_units = fc_units)
train(model, epochs, log_string)
我更改了应用分析的数据集,并尝试对其进行调整。 你知道我该如何解决这个错误吗?
我读过一些类似的帖子,但它并没有真正帮助我。
非常感谢
【问题讨论】:
-
能否请您也打印 n_words 值
-
n_words 值为 5971
标签: python tensorflow