我为培训创建了以下模型图:
n_steps = 9
n_inputs = 6
n_neurons = 50
n_outputs = 1
n_layers = 2
learning_rate = 0.0001
batch_size =100
n_epochs = 1000#200
train_set_size = 100
test_set_size = 100
tf.reset_default_graph()
X = tf.placeholder(tf.float32, [None, n_steps, n_inputs],name="input")
y = tf.placeholder(tf.float32, [None, n_outputs],name="output")
layers = [tf.contrib.rnn.LSTMCell(num_units=n_neurons,activation=tf.nn.relu6, use_peepholes = True,name="layer"+str(layer))
for layer in range(n_layers)]
multi_layer_cell = tf.contrib.rnn.MultiRNNCell(layers)
multi_layer_cell_back = tf.contrib.rnn.MultiRNNCell(layers)
rnn_outputs, states = tf.nn.bidirectional_dynamic_rnn(multi_layer_cell,multi_layer_cell_back, X, dtype=tf.float32)
stacked_rnn_outputs = tf.reshape(rnn_outputs, [-1, n_neurons])
stacked_outputs = tf.layers.dense(stacked_rnn_outputs, n_outputs)
outputs = tf.reshape(stacked_outputs, [-1, n_steps, n_outputs])
outputs = outputs[:,n_steps-1,:]
出现以下错误:
InvalidArgumentError: Incompatible shapes: [100,1] vs. [200,1]
[[node hinge_loss/Mul_1 (defined at <ipython-input-146-2bba8c1ac0ac>:45) = Mul[T=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"](hinge_loss/Sub, strided_slice)]]
请让我知道我错过了什么。