def convertLayerWithRNN(self):
'''
use BI-LSTM to get contenxt
'''
lstm_fw_cell = rnn.BasicLSTMCell(self.context_size)
lstm_bw_cell = rnn.BasicLSTMCell(self.context_size)
if self.dropout_keep_prob is not None:
lstm_fw_cell = rnn.DropoutWrapper(lstm_fw_cell,
output_keep_prob = self.dropout_keep_prob)
lstm_bw_cell = rnn.DropoutWrapper(lstm_bw_cell,
output_keep_prob = self.dropout_keep_prob)
outputs,output_states = tf.nn.bidirectional_dynamic_rnn(lstm_fw_cell,
lstm_bw_cell,self.embedded_words,dtype = tf.float32)
output_fw,output_bw = outputs
result_presentation = tf.concat([output_fw,self.embedded_words,output_bw],axis = 2)
return result_presentation
RCNNModelWithLSTM.py 文件源码
python
阅读 21
收藏 0
点赞 0
评论 0
评论列表
文章目录