定义LSTM单元
lstm_cell_fw = tf.nn.rnn_cell.BasicLSTMCell(self.hidden_dim)
lstm_cell_bw = tf.nn.rnn_cell.BasicLSTMCell(self.hidden_dim)
对比下图
其中\(c_t\)与\(h_t\)的维度是相同的, \(dim(f_t)=dim(c_{t-1})=dim(h_{t-1})\)
这里self.hidden_dim
就是指 图中隐藏向量h的维度,
lstm_cell_fw = tf.nn.rnn_cell.BasicLSTMCell(self.hidden_dim)
lstm_cell_bw = tf.nn.rnn_cell.BasicLSTMCell(self.hidden_dim)
对比下图
其中\(c_t\)与\(h_t\)的维度是相同的, \(dim(f_t)=dim(c_{t-1})=dim(h_{t-1})\)
这里self.hidden_dim
就是指 图中隐藏向量h的维度,