【发布时间】:2016-07-04 11:10:19
【问题描述】:
我正在尝试在 tensorflow 中使用 LSTM 创建多层 RNN。我在 Ubuntu 14.04 上使用 Tensorflow 版本 0.9.0 和 python 2.7。
但是,我不断收到以下错误:
tensorflow.python.framework.errors.InvalidArgumentError: Expected begin[1] in [0, 2000], but got 4000
当我使用时
rnn_cell.MultiRNNCell([cell]*num_layers)
如果 num_layers 大于 1。
我的代码:
size = 1000
config.forget_bias = 1
and config.num_layers = 3
cell = rnn_cell.LSTMCell(size,forget_bias=config.forget_bias)
cell_layers = rnn_cell.MultiRNNCell([cell]*config.num_layers)
我也希望能够切换到使用 GRU 单元,但这给了我同样的错误:
Expected begin[1] in [0, 1000], but got 2000
我试过明确设置
num_proj = 1000
这也没有帮助。
这与我使用串联状态有关吗?正如我试图设置的那样
state_is_tuple=True
给出:
`ValueError: Some cells return tuples of states, but the flag state_is_tuple is not set. State sizes are: [LSTMStateTuple(c=1000, h=1000), LSTMStateTuple(c=1000, h=1000), LSTMStateTuple(c=1000, h=1000)]`
任何帮助将不胜感激!
【问题讨论】:
标签: python-2.7 tensorflow