Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
7c00e164
P
Paddle
项目概览
PaddlePaddle
/
Paddle
1 年多 前同步成功
通知
2302
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看板
提交
7c00e164
编写于
5月 31, 2018
作者:
Y
yuyang18
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add More comments
上级
f9d93bfd
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
37 addition
and
3 deletion
+37
-3
python/paddle/fluid/layers/layer_function_generator.py
python/paddle/fluid/layers/layer_function_generator.py
+10
-3
python/paddle/fluid/layers/nn.py
python/paddle/fluid/layers/nn.py
+27
-0
未找到文件。
python/paddle/fluid/layers/layer_function_generator.py
浏览文件 @
7c00e164
...
@@ -230,15 +230,22 @@ def templatedoc():
...
@@ -230,15 +230,22 @@ def templatedoc():
and AddInput. The ${name} is Python snake style. i.e., xxx_xxx.
and AddInput. The ${name} is Python snake style. i.e., xxx_xxx.
* ${{name}_type}: The type of ${name}.
* ${{name}_type}: The type of ${name}.
Returns:
Returns:
Decorated func
it
on.
Decorated func
ti
on.
"""
"""
def
__impl__
(
func
):
def
__impl__
(
func
):
op_proto
=
OpProtoHolder
.
instance
().
get_op_proto
(
func
.
__name__
)
op_proto
=
OpProtoHolder
.
instance
().
get_op_proto
(
func
.
__name__
)
tmpl
=
string
.
Template
(
func
.
__doc__
)
tmpl
=
string
.
Template
(
func
.
__doc__
)
args
=
{
"comment"
:
" "
.
join
(
op_proto
.
comment
.
split
())}
comment_lines
=
op_proto
.
comment
.
split
(
"
\n
"
)
comment
=
""
for
line
in
comment_lines
:
line
=
line
.
lstrip
()
comment
+=
line
comment
+=
"
\n
"
args
=
{
"comment"
:
comment
}
for
each_input
in
op_proto
.
inputs
:
for
each_input
in
op_proto
.
inputs
:
input_name
=
_convert_
(
each_input
.
name
)
input_name
=
_convert_
(
each_input
.
name
)
args
[
"{0}_comment"
.
format
(
input_name
)]
=
each_input
.
comment
args
[
"{0}_comment"
.
format
(
input_name
)]
=
each_input
.
comment
...
...
python/paddle/fluid/layers/nn.py
浏览文件 @
7c00e164
...
@@ -799,7 +799,22 @@ def gru_unit(input,
...
@@ -799,7 +799,22 @@ def gru_unit(input,
return
updated_hidden
,
reset_hidden_pre
,
gate
return
updated_hidden
,
reset_hidden_pre
,
gate
@
templatedoc
()
def
linear_chain_crf
(
input
,
label
,
param_attr
=
None
):
def
linear_chain_crf
(
input
,
label
,
param_attr
=
None
):
"""
Linear Chain CRF.
${comment}
Args:
input(${emission_type}): ${emission_comment}
label(${label_type}): ${label_comment}
param_attr(ParamAttr): The attribute of the learnable parameter.
Returns:
${log_likelihood_comment}
"""
helper
=
LayerHelper
(
'linear_chain_crf'
,
**
locals
())
helper
=
LayerHelper
(
'linear_chain_crf'
,
**
locals
())
size
=
input
.
shape
[
1
]
size
=
input
.
shape
[
1
]
transition
=
helper
.
create_parameter
(
transition
=
helper
.
create_parameter
(
...
@@ -825,7 +840,19 @@ def linear_chain_crf(input, label, param_attr=None):
...
@@ -825,7 +840,19 @@ def linear_chain_crf(input, label, param_attr=None):
return
log_likelihood
return
log_likelihood
@
templatedoc
()
def
crf_decoding
(
input
,
param_attr
,
label
=
None
):
def
crf_decoding
(
input
,
param_attr
,
label
=
None
):
"""
${comment}
Args:
input(${emission_type}): ${emission_comment}
param_attr(ParamAttr): The parameter attribute for training.
label(${label_type}): ${label_comment}
Returns:
${viterbi_path_comment}
"""
helper
=
LayerHelper
(
'crf_decoding'
,
**
locals
())
helper
=
LayerHelper
(
'crf_decoding'
,
**
locals
())
transition
=
helper
.
get_parameter
(
param_attr
.
name
)
transition
=
helper
.
get_parameter
(
param_attr
.
name
)
viterbi_path
=
helper
.
create_tmp_variable
(
dtype
=
helper
.
input_dtype
())
viterbi_path
=
helper
.
create_tmp_variable
(
dtype
=
helper
.
input_dtype
())
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录