前向LSTM和后向LSTM计算公式
时间: 2023-11-07 21:01:50 浏览: 102
前向LSTM的计算公式如下:
1. 输入门(input gate):i_t = σ(W_i * x_t + U_i * h_(t-1) + b_i)
2. 遗忘门(forget gate):f_t = σ(W_f * x_t + U_f * h_(t-1) + b_f)
3. 细胞状态更新(cell state update):g_t = tanh(W_c * x_t + U_c * h_(t-1) + b_c)
4. 细胞状态(cell state)更新:c_t = f_t * c_(t-1) + i_t * g_t
5. 输出门(output gate):o_t = σ(W_o * x_t + U_o * h_(t-1) + b_o)
. 隐状态(hidden state)更新:h_t = o_t * tanh(c_t)
后向LSTM的计算公式与前向LSTM相似,只是输入序列的顺序相反。具体地,
1. 输入门(input gate):i_t = σ(W_i * x_t + U_i * h_(t+1) + b_i)
2. 遗忘门(forget gate):f_t = σ(W_f * x_t + U_f * h_(t+1) + b_f)
3. 细胞状态更新(cell state update):g_t = tanh(W_c * x_t + U_c * h_(t+1) + b_c)
4. 细胞状态(cell state)更新:c_t = f_t * c_(t+1) + i_t * g_t
5. 输出门(output gate):o_t = σ(W_o * x_t + U_o * h_(t+1) + b_o)
6. 隐状态(hidden state)更新:h_t = o_t * tanh(c_t)
阅读全文