定义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的维度,
Reference
李宏毅 Machine Learning 课程