解析时出现意外的EOF。我不知道。
outputs = []
for i in range (batch_size):
batch_state = np.zeros([1, hidden_layer], dtype=np.float32)
batch_output = np.zeros([1, hidden_layer], dtype=np.float32)
for ii in range (window_size):
batch_state, batch_output = LSTM_cell(tf.reshape(inputs[i]
[ii], (-1, 1)), batch_state, batch_output)
outputs.append(tf.matmul(batch_output, weights_output + bias_output_layer)
答案 0 :(得分:0)
如果您修复缩进(仅在for:
之后缩进,请始终使用相同的缩进(4个空格)),请删除第10/11行中的换行符,并在最后一行添加另一个右括号,代码运行时没有解析或语法错误:
outputs = []
for i in range (batch_size):
batch_state = np.zeros([1, hidden_layer], dtype=np.float32)
batch_output = np.zeros([1, hidden_layer], dtype=np.float32)
for ii in range (window_size):
batch_state, batch_output = LSTM_cell(tf.reshape(inputs[i][ii], (-1, 1)), batch_state, batch_output)
outputs.append(tf.matmul(batch_output, weights_output + bias_output_layer))
当然,它仍然无法使用,因为它使用的代码片段未定义。