def bi_lstm_layer(self,inputs):
with tf.variable_scope("BILSTM"):
fw_cell = rnn.LSTMCell(self.params.neaurl_hidden_dim,use_peepholes=True,initializer=self.initializer)
bw_cell = rnn.LSTMCell(self.params.neaurl_hidden_dim,use_peepholes=True,initializer=self.initializer)
outputs,_ = tf.nn.bidirectional_dynamic_rnn(fw_cell,bw_cell,inputs,dtype=tf.float32,time_major=True)
lstm_features = tf.reshape(outputs, [-1, self.params.neaurl_hidden_dim * 2])
return lstm_features
评论列表
文章目录