gpt4 book ai didi

tensorflow - tensorflow dynamic_rnn和rnn有什么区别?

转载 作者:行者123 更新时间:2023-12-03 08:47:43 25 4
gpt4 key购买 nike

tf.nn中有几个与RNN相关的类。在我在网上找到的示例中,tf.nn.dynamic_rnntf.nn.rnn似乎可以互换使用,或者至少我无法弄清楚为什么使用其中一个代替另一个。有什么不同?

最佳答案

摘自Denny Britz的RNNs in Tensorflow, a Practical Guide and Undocumented Features,于2016年8月21日发布。

tf.nn.rnn creates an unrolled graph for a fixed RNN length. That means, if you call tf.nn.rnn with inputs having 200 time steps you are creating a static graph with 200 RNN steps. First, graph creation is slow. Second, you’re unable to pass in longer sequences (> 200) than you’ve originally specified.

tf.nn.dynamic_rnn solves this. It uses a tf.While loop to dynamically construct the graph when it is executed. That means graph creation is faster and you can feed batches of variable size.

关于tensorflow - tensorflow dynamic_rnn和rnn有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39734146/

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