代码改变世界

biLSTM 函数调用 与模型参照 (Tensorflow)

2018-07-02 10:28  JohnRain  阅读(2329)  评论(0编辑  收藏  举报

定义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 课程