所以,这是我现有代码的一部分:
def lstm(i,o, state):
input_gate = tf.sigmoid(tf.matmul(i, w_ii) + tf.matmul(o,w_io) + b_i)
output_gate = tf.sigmoid(tf.matmul(i, w_oi) + tf.matmul(o,w_oo) + b_o)
forget_gate = tf.sigmoid(tf.matmul(i, w_fi) + tf.matmul(o,w_fo) + b_f)
memory_cell = tf.sigmoid(tf.matmul(i, w_ci) + tf.matmul(o,w_co) + b_c)
state = forget_gate * state + input_gate * memory_cell
output = output_gate * tf.tanh(state)
return output, state
output = tf.zeros([batch_size, hidden_nodes])
state = tf.zeros([batch_size, hidden_nodes])
for i in range(len_section):
output, state = lstm(data[:,i,:],output, state)
我已经开始运行,这是一个不错的开始,但我希望模仿另一个使用3个LSTM单元的模型。我不太确定我知道如何编码。
会是这样的:
for i in range(len_section):
output, state = lstm(data[:,i,:],output, state)
output, state = lstm(data[:,i,:],output, state)
output, state = lstm(data[:,i,:],output, state)
非常感谢任何反馈