定義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 課程