-
Notifications
You must be signed in to change notification settings - Fork 874
Add faq about pack_padded_sequence & pad_packed_sequence API #4066
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Thanks for your contribution! |
docs/faq/train_cn.md
Outdated
|
|
||
| ---------- | ||
|
|
||
| ##### 问题:在paddle中如何实现`torch.nn.utils.rnn.pack_padded_sequence`和`torch.nn.utils.rnn.pad_packed_sequence`这两个API吗? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
为保持语句通顺,建议去掉"吗"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
docs/faq/train_cn.md
Outdated
|
|
||
| + 答复:目前paddle中没有和上述两个API完全对应的实现。关于torch中这两个API的详细介绍可以参考知乎上的文章 [pack_padded_sequence 和 pad_packed_sequence](https://zhuanlan.zhihu.com/p/342685890) : | ||
| `pack_padded_sequence`的功能是将mini-batch数据进行压缩,压缩掉无效的填充值,然后输入RNN网络中;`pad_packed_sequence`则是把RNN网络输出的压紧的序列再填充回来,便于进行后续的处理。 | ||
| 在paddle中,大家可以在GRU、LSTM等RNN网络中输入含有填充值的mini-batch数据的同时传入对应的`sequence_length`参数实现上述等价功能,具体用法可以参考 [RNN API文档](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/nn/RNN_cn.html#rnn) 。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- [RNN API文档] --> [RNN]
- 能否给个示例代码?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- done
- 这个代码示例需要配合很多的torch代码,暂时先不加。
Add faq about pack_padded_sequence & pad_packed_sequence API