什么是 TensorFlow 中的动态 RNN? [英] What is a dynamic RNN in TensorFlow?

查看:43
本文介绍了什么是 TensorFlow 中的动态 RNN?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对什么是动态 RNN(即 dynamic_rnn)感到困惑.它在 TensorFlow 中返回一个输出和一个状态.这些状态和输出是什么?在 TensorFlow 中,动态 RNN 中的动态是什么?

I am confused about what dynamic RNN (i.e. dynamic_rnn) is. It returns an output and a state in TensorFlow. What are these state and output? What is dynamic in a dynamic RNN, in TensorFlow?

推荐答案

动态 RNN 允许可变序列长度.您可能有一个输入形状 (batch_size, max_sequence_length),但这将允许您在那些短于 max_sequence_length 的序列上以正确数量的时间步长运行 RNN.

Dynamic RNN's allow for variable sequence lengths. You might have an input shape (batch_size, max_sequence_length), but this will allow you to run the RNN for the correct number of time steps on those sequences that are shorter than max_sequence_length.

相比之下,有静态 RNN,它们期望运行整个固定 RNN 长度.在某些情况下,您可能更喜欢这样做,例如,如果您无论如何都要将输入填充到 max_sequence_length.

In contrast, there are static RNNs, which expect to run the entire fixed RNN length. There are cases where you might prefer to do this, such as if you are padding your inputs to max_sequence_length anyway.

简而言之,dynamic_rnn 通常是您想要的可变长度顺序数据.它有一个 sequence_length 参数,它是你的朋友.

In short, dynamic_rnn is usually what you want for variable length sequential data. It has a sequence_length parameter, and it is your friend.

这篇关于什么是 TensorFlow 中的动态 RNN?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆