当我在代码中多次使用tf.nn.dynamic_rnn()
时
ValueError: Dimensions must be equal, but are 80 and 90 for '..scope1/rnn/while/gru_cell/MatMul_4' (op: 'MatMul') with input shapes: [50,80], [90,80].'
发生
我的代码片段是:
gru = tf.contrib.rnn.GRUCell(d)
with tf.variable_scope('scope1'):
_, outputs_1 = tf.nn.dynamic_rnn(gru, inputs, dtype=tf.float32) # inputs:[N, L, V]
with tf.variable_scope('scope2'):
outputs_2 = somefunc(outputs_1)
with tf.variable_scope('scope3'):
_, outputs_3 = tf.nn.dynamic_rnn(gru, outputs_2, dtype=tf.float32) outputs_2:[N, L, d]
如果我将d设置为不等于V,则运行代码会抛出上述错误。如果将d设置为等于V,则没有问题。为什么?两个tf.nn.dynamic\u rnn()不是直接堆叠的。它们应该相互独立
目前没有回答
相关问题 更多 >
编程相关推荐