Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
FluidDoc
提交
53dd140d
F
FluidDoc
项目概览
PaddlePaddle
/
FluidDoc
通知
10
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
23
列表
看板
标记
里程碑
合并请求
111
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
FluidDoc
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
23
Issue
23
列表
看板
标记
里程碑
合并请求
111
合并请求
111
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
53dd140d
编写于
3月 26, 2020
作者:
X
Xing Wu
提交者:
GitHub
3月 26, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix lstm doc error (#1943)
* fix lstm doc error * fix lstm doc error * remove unused line in lstm doc
上级
54db6cf0
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
5 addition
and
6 deletion
+5
-6
doc/fluid/api_cn/layers_cn/LSTMCell_cn.rst
doc/fluid/api_cn/layers_cn/LSTMCell_cn.rst
+2
-2
doc/fluid/api_cn/layers_cn/lstm_cn.rst
doc/fluid/api_cn/layers_cn/lstm_cn.rst
+3
-4
未找到文件。
doc/fluid/api_cn/layers_cn/LSTMCell_cn.rst
浏览文件 @
53dd140d
...
...
@@ -38,7 +38,7 @@ LSTMCell
.. code-block:: python
import paddle.fluid.layers as layers
cell = layers.
rnn.
LSTMCell(hidden_size=256)
cell = layers.LSTMCell(hidden_size=256)
.. py:method:: call(inputs, states)
...
...
@@ -61,4 +61,4 @@ LSTMCell的 :code:`state_shape` 是一个具有两个形状的列表::math:`[[
返回:LSTMCell的 :code:`state_shape`
返回类型:list
\ No newline at end of file
返回类型:list
doc/fluid/api_cn/layers_cn/lstm_cn.rst
浏览文件 @
53dd140d
...
...
@@ -57,7 +57,7 @@ lstm
返回: 经过lstm运算输出的三个Tensor的tuple,包括
- rnn_out:LSTM hidden的输出结果的Tensor,数据类型与input一致,维度为 :math:`[
seq\_len, batch\_size, hidden\_size]` 。如果 ``is_bidirec`` 设置为True,则维度为 :math:`[seq\_len, batch\_size
, hidden\_size*2]`
- rnn_out:LSTM hidden的输出结果的Tensor,数据类型与input一致,维度为 :math:`[
batch\_size, seq\_len, hidden\_size]` 。如果 ``is_bidirec`` 设置为True,则维度为 :math:`[batch\_size, seq\_len
, hidden\_size*2]`
- last_h:LSTM最后一步的hidden状态的Tensor,数据类型与input一致,维度为 :math:`[num\_layers, batch\_size, hidden\_size]` 。如果 ``is_bidirec`` 设置为True,则维度为 :math:`[num\_layers*2, batch\_size, hidden\_size]`
- last_c:LSTM最后一步的cell状态的Tensor,数据类型与input一致,维度为 :math:`[num\_layers, batch\_size, hidden\_size]` 。如果 ``is_bidirec`` 设置为True,则维度为 :math:`[num\_layers*2, batch\_size, hidden\_size]`
...
...
@@ -73,12 +73,11 @@ lstm
emb_dim = 256
vocab_size = 10000
data = fluid.layers.data(name='x', shape=[-1, 100, 1],
dtype='int
32
')
dtype='int
64
')
emb = fluid.layers.embedding(input=data, size=[vocab_size, emb_dim], is_sparse=True)
batch_size = 20
max_len = 100
dropout_prob = 0.2
seq_len = 100
hidden_size = 150
num_layers = 1
init_h = layers.fill_constant( [num_layers, batch_size, hidden_size], 'float32', 0.0 )
...
...
@@ -87,7 +86,7 @@ lstm
rnn_out, last_h, last_c = layers.lstm(emb, init_h, init_c, max_len, hidden_size, num_layers, dropout_prob=dropout_prob)
rnn_out.shape # (-1, 100, 150)
last_h.shape # (1, 20, 150)
la
y
t_c.shape # (1, 20, 150)
la
s
t_c.shape # (1, 20, 150)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录