Python ValueError登录和标签必须具有与(2,2,10)相同的形状(?,10)

Python ValueError登录和标签必须具有与(2,2,10)相同的形状(?,10),python,tensorflow,deep-learning,lstm,valueerror,Python,Tensorflow,Deep Learning,Lstm,Valueerror,我想用2个LSTM单元更新一个简单的神经网络。 旧体系结构(有效):输入=>RNN=>输出 新架构(带有值错误):输入=>LSTM=>LSTM=>Output layers = 2 units = 10 outputs = 10 X = tf.placeholder (tf.float32,[None,nr_steps, nr_inputs]) y = tf.placeholder (tf.float32,[None,outputs]) cells = [tf.nn.rnn_cell.Basic

我想用2个LSTM单元更新一个简单的神经网络。 旧体系结构(有效):输入=>RNN=>输出 新架构(带有值错误):输入=>LSTM=>LSTM=>Output

layers = 2
units = 10
outputs = 10
X = tf.placeholder (tf.float32,[None,nr_steps, nr_inputs])
y = tf.placeholder (tf.float32,[None,outputs])
cells = [tf.nn.rnn_cell.BasicLSTMCell (num_units = units)
        for _ in range(layers)]
neurons = tf.nn.rnn_cell.MultiRNNCell(cells)
rnn_outputs, rnn_states = tf.nn.dynamic_rnn (neurons, X, dtype = tf.float32)
使用
basicrncell
时,代码正常工作,但是在转换之后,我收到了错误

ValueError Shapes (?, 10) and (2,2,?,10) must have the same rank
ValueError Shapes (?, 10) and (2,2,?,10) are not compatible
ValueError logits and labels must have the same shape Shapes (?, 10) vs (2,2,?,10) 

有人能帮我吗?我认为第一个22,2,,,10)来自LSTM单元(但为什么?),第二个2(2,2,,?,10)来自网络的两层(但为什么?),我如何处理这个错误,为我们提供。这是最低限度的代码。您还需要哪些信息?问题出现在最后一行rnn_输出中,rnn_states=tf.nn.dynamic_rnnI无法执行代码。我需要添加导入、会话等。您还需要提供,即示例必须完整且可验证。