我正在通过Tensorflow构建双向lstm层,但构建过程非常缓慢,需要花费数小时才能完成相对较小的网络构建。我的测试隐藏层大小是16;输入嵌入向量大小为32;输入序列长度为20,词汇量为20000
tf的表现如预期?
附上我用于构建网络的部分以获取更多信息:
cell_fw = tf.contrib.rnn.LSTMCell(hidden_layer_size)
cell_bw = tf.contrib.rnn.LSTMCell(hidden_layer_size)
(emb_encoder_inputs, fw_state, _) = tf.contrib.rnn.static_bidirectional_rnn(
cell_fw, cell_bw, emb_encoder_inputs, dtype=tf.float32,
sequence_length=article_lens)
bidirectional_dynamic_rnn比static_bidirectional_rnn快。