gpt4 book ai didi

python - 极其缓慢构建双向 TF Lstm 单元

转载 作者:太空宇宙 更新时间:2023-11-03 21:40:07 29 4
gpt4 key购买 nike

我正在通过 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)

最佳答案

bi Direction_dynamic_rnn 比 static_bi Direction_rnn 更快。

关于python - 极其缓慢构建双向 TF Lstm 单元,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52925048/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com