Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
f727071f
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2299
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
f727071f
编写于
1月 17, 2018
作者:
T
Travis CI
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Deploy to GitHub Pages:
a9899dbe
上级
b5a7f4b4
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
21 addition
and
23 deletion
+21
-23
develop/doc_cn/howto/deep_model/rnn/hrnn_rnn_api_compare_cn.html
.../doc_cn/howto/deep_model/rnn/hrnn_rnn_api_compare_cn.html
+20
-22
develop/doc_cn/searchindex.js
develop/doc_cn/searchindex.js
+1
-1
未找到文件。
develop/doc_cn/howto/deep_model/rnn/hrnn_rnn_api_compare_cn.html
浏览文件 @
f727071f
...
...
@@ -301,8 +301,7 @@
16
17
18
19
</pre></div></td><td
class=
"code"
><div
class=
"highlight"
><pre><span></span><span
class=
"k"
>
def
</span>
<span
class=
"nf"
>
hook
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
settings
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
dict_file
</span><span
class=
"p"
>
,
</span>
<span
class=
"o"
>
**
</span><span
class=
"n"
>
kwargs
</span><span
class=
"p"
>
):
</span>
<span
class=
"n"
>
settings
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
word_dict
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
dict_file
</span>
19
</pre></div></td><td
class=
"code"
><div
class=
"highlight"
><pre><span></span>
<span
class=
"n"
>
settings
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
word_dict
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
dict_file
</span>
<span
class=
"n"
>
settings
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
input_types
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"p"
>
[
</span>
<span
class=
"n"
>
integer_value_sequence
</span><span
class=
"p"
>
(
</span><span
class=
"nb"
>
len
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
settings
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
word_dict
</span><span
class=
"p"
>
)),
</span>
<span
class=
"n"
>
integer_value
</span><span
class=
"p"
>
(
</span><span
class=
"mi"
>
3
</span><span
class=
"p"
>
)
</span>
<span
class=
"p"
>
]
</span>
...
...
@@ -320,6 +319,7 @@
<span
class=
"n"
>
settings
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
word_dict
</span><span
class=
"p"
>
[
</span><span
class=
"n"
>
w
</span><span
class=
"p"
>
]
</span>
<span
class=
"k"
>
for
</span>
<span
class=
"n"
>
w
</span>
<span
class=
"ow"
>
in
</span>
<span
class=
"n"
>
words
</span>
<span
class=
"k"
>
if
</span>
<span
class=
"n"
>
w
</span>
<span
class=
"ow"
>
in
</span>
<span
class=
"n"
>
settings
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
word_dict
</span>
<span
class=
"p"
>
]
</span>
<span
class=
"k"
>
yield
</span>
<span
class=
"n"
>
words
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
label
</span>
</pre></div>
</td></tr></table></div>
<ul
class=
"simple"
>
...
...
@@ -360,9 +360,7 @@
26
27
28
29
30
</pre></div></td><td
class=
"code"
><div
class=
"highlight"
><pre><span></span><span
class=
"c1"
>
## for hierarchical sequence network
</span>
<span
class=
"k"
>
def
</span>
<span
class=
"nf"
>
hook2
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
settings
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
dict_file
</span><span
class=
"p"
>
,
</span>
<span
class=
"o"
>
**
</span><span
class=
"n"
>
kwargs
</span><span
class=
"p"
>
):
</span>
29
</pre></div></td><td
class=
"code"
><div
class=
"highlight"
><pre><span></span><span
class=
"k"
>
def
</span>
<span
class=
"nf"
>
hook2
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
settings
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
dict_file
</span><span
class=
"p"
>
,
</span>
<span
class=
"o"
>
**
</span><span
class=
"n"
>
kwargs
</span><span
class=
"p"
>
):
</span>
<span
class=
"n"
>
settings
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
word_dict
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
dict_file
</span>
<span
class=
"n"
>
settings
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
input_types
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"p"
>
[
</span>
<span
class=
"n"
>
integer_value_sub_sequence
</span><span
class=
"p"
>
(
</span><span
class=
"nb"
>
len
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
settings
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
word_dict
</span><span
class=
"p"
>
)),
</span>
...
...
@@ -628,24 +626,24 @@
15
16
17
18
</pre></div></td><td
class=
"code"
><div
class=
"highlight"
><pre><span></span><span
class=
"n"
>
hidden_dim
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"mi"
>
8
</span>
<span
class=
"n"
>
label_dim
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"mi"
>
2
</span>
<span
class=
"n"
>
speaker1
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
data_layer
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
name
</span><span
class=
"o"
>
=
</span><span
class=
"s2"
>
"
word1
"
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
size
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
dict_dim
</span><span
class=
"p"
>
)
</span>
<span
class=
"n"
>
speaker2
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
data_layer
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
name
</span><span
class=
"o"
>
=
</span><span
class=
"s2"
>
"
word2
"
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
size
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
dict_dim
</span><span
class=
"p"
>
)
</span>
18
</pre></div></td><td
class=
"code"
><div
class=
"highlight"
><pre><span></span>
<span
class=
"k"
>
def
</span>
<span
class=
"nf"
>
calrnn
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
y
</span><span
class=
"p"
>
):
</span>
<span
class=
"n"
>
mem
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
memory
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
name
</span><span
class=
"o"
>
=
</span><span
class=
"s1"
>
'
rnn_state_
'
</span>
<span
class=
"o"
>
+
</span>
<span
class=
"n"
>
y
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
name
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
size
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
hidden_dim
</span><span
class=
"p"
>
)
</span>
<span
class=
"n"
>
out
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fc_layer
</span><span
class=
"p"
>
(
</span>
<span
class=
"nb"
>
input
</span><span
class=
"o"
>
=
</span><span
class=
"p"
>
[
</span><span
class=
"n"
>
y
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
mem
</span><span
class=
"p"
>
],
</span>
<span
class=
"n"
>
size
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
hidden_dim
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
act
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
TanhActivation
</span><span
class=
"p"
>
(),
</span>
<span
class=
"n"
>
bias_attr
</span><span
class=
"o"
>
=
</span><span
class=
"bp"
>
True
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
name
</span><span
class=
"o"
>
=
</span><span
class=
"s1"
>
'
rnn_state_
'
</span>
<span
class=
"o"
>
+
</span>
<span
class=
"n"
>
y
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
name
</span><span
class=
"p"
>
)
</span>
<span
class=
"k"
>
return
</span>
<span
class=
"n"
>
out
</span>
<span
class=
"n"
>
emb1
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
embedding_layer
</span><span
class=
"p"
>
(
</span><span
class=
"nb"
>
input
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
speaker1
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
size
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
word_dim
</span><span
class=
"p"
>
)
</span>
<span
class=
"n"
>
emb2
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
embedding_layer
</span><span
class=
"p"
>
(
</span><span
class=
"nb"
>
input
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
speaker2
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
size
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
word_dim
</span><span
class=
"p"
>
)
</span>
<span
class=
"n"
>
encoder1
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
calrnn
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
x1
</span><span
class=
"p"
>
)
</span>
<span
class=
"n"
>
encoder2
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
calrnn
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
x2
</span><span
class=
"p"
>
)
</span>
<span
class=
"k"
>
return
</span>
<span
class=
"p"
>
[
</span><span
class=
"n"
>
encoder1
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
encoder2
</span><span
class=
"p"
>
]
</span>
<span
class=
"c1"
>
# This hierachical RNN is designed to be equivalent to the RNN in
</span>
<span
class=
"c1"
>
# sequence_nest_rnn_multi_unequalength_inputs.conf
</span>
<span
class=
"n"
>
encoder1_rep
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
encoder2_rep
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
recurrent_group
</span><span
class=
"p"
>
(
</span>
<span
class=
"n"
>
name
</span><span
class=
"o"
>
=
</span><span
class=
"s2"
>
"
stepout
"
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
step
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
step
</span><span
class=
"p"
>
,
</span>
<span
class=
"nb"
>
input
</span><span
class=
"o"
>
=
</span><span
class=
"p"
>
[
</span><span
class=
"n"
>
emb1
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
emb2
</span><span
class=
"p"
>
])
</span>
<span
class=
"k"
>
def
</span>
<span
class=
"nf"
>
step
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
x1
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
x2
</span><span
class=
"p"
>
):
</span>
<span
class=
"k"
>
def
</span>
<span
class=
"nf"
>
calrnn
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
y
</span><span
class=
"p"
>
):
</span>
<span
class=
"n"
>
mem
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
memory
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
name
</span><span
class=
"o"
>
=
</span><span
class=
"s1"
>
'
rnn_state_
'
</span>
<span
class=
"o"
>
+
</span>
<span
class=
"n"
>
y
</span><span
class=
"o"
>
.
</span><span
class=
"n"
>
name
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
size
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
hidden_dim
</span><span
class=
"p"
>
)
</span>
<span
class=
"n"
>
out
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
fc_layer
</span><span
class=
"p"
>
(
</span>
<span
class=
"nb"
>
input
</span><span
class=
"o"
>
=
</span><span
class=
"p"
>
[
</span><span
class=
"n"
>
y
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
mem
</span><span
class=
"p"
>
],
</span>
</pre></div>
</td></tr></table></div>
<ul
class=
"simple"
>
...
...
@@ -690,9 +688,7 @@
37
38
39
40
</pre></div></td><td
class=
"code"
><div
class=
"highlight"
><pre><span></span><span
class=
"k"
>
def
</span>
<span
class=
"nf"
>
outer_step
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
x1
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
x2
</span><span
class=
"p"
>
):
</span>
<span
class=
"n"
>
index
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"p"
>
[
</span><span
class=
"mi"
>
0
</span><span
class=
"p"
>
]
</span>
40
</pre></div></td><td
class=
"code"
><div
class=
"highlight"
><pre><span></span>
<span
class=
"k"
>
def
</span>
<span
class=
"nf"
>
inner_step
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
ipt
</span><span
class=
"p"
>
):
</span>
<span
class=
"n"
>
index
</span><span
class=
"p"
>
[
</span><span
class=
"mi"
>
0
</span><span
class=
"p"
>
]
</span>
<span
class=
"o"
>
+=
</span>
<span
class=
"mi"
>
1
</span>
<span
class=
"n"
>
i
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
index
</span><span
class=
"p"
>
[
</span><span
class=
"mi"
>
0
</span><span
class=
"p"
>
]
</span>
...
...
@@ -730,6 +726,8 @@
<span
class=
"n"
>
step
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
outer_step
</span><span
class=
"p"
>
,
</span>
<span
class=
"nb"
>
input
</span><span
class=
"o"
>
=
</span><span
class=
"p"
>
[
</span><span
class=
"n"
>
SubsequenceInput
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
emb1
</span><span
class=
"p"
>
),
</span>
<span
class=
"n"
>
SubsequenceInput
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
emb2
</span><span
class=
"p"
>
)],
</span>
<span
class=
"n"
>
targetInlink
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
emb2
</span><span
class=
"p"
>
)
</span>
<span
class=
"n"
>
encoder1_last
</span>
<span
class=
"o"
>
=
</span>
<span
class=
"n"
>
last_seq
</span><span
class=
"p"
>
(
</span><span
class=
"nb"
>
input
</span><span
class=
"o"
>
=
</span><span
class=
"n"
>
encoder1_rep
</span><span
class=
"p"
>
)
</span>
</pre></div>
</td></tr></table></div>
<p>
在上面代码中,单层和双层序列的使用和示例2中的示例类似,区别是同时处理了两个输入。而对于双层序列,两个输入的子序列长度也并不相同。但是,我们使用了
<code
class=
"code docutils literal"
><span
class=
"pre"
>
targetInlink
</span></code>
参数设置了外层
<code
class=
"code docutils literal"
><span
class=
"pre"
>
recurrent_group
</span></code>
的输出格式。所以外层输出的序列形状,和
<code
class=
"code docutils literal"
><span
class=
"pre"
>
emb2
</span></code>
的序列形状一致。
</p>
...
...
develop/doc_cn/searchindex.js
浏览文件 @
f727071f
因为 它太大了无法显示 source diff 。你可以改为
查看blob
。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录