Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
e64418c7
P
Paddle
项目概览
Crayon鑫
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
e64418c7
编写于
4月 09, 2017
作者:
Q
qiaolongfei
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
support beam_search, fix mix bug
上级
30aded19
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
25 addition
and
9 deletion
+25
-9
python/paddle/v2/config_base.py
python/paddle/v2/config_base.py
+0
-4
python/paddle/v2/layer.py
python/paddle/v2/layer.py
+25
-5
未找到文件。
python/paddle/v2/config_base.py
浏览文件 @
e64418c7
...
@@ -76,10 +76,6 @@ class Layer(object):
...
@@ -76,10 +76,6 @@ class Layer(object):
"""
"""
function to set proto attribute
function to set proto attribute
"""
"""
print
"======"
# print self.name
print
self
.
__parent_layers__
# print self.__context__
self
.
__context__
=
context
self
.
__context__
=
context
# short cut if myself is parsed before.
# short cut if myself is parsed before.
...
...
python/paddle/v2/layer.py
浏览文件 @
e64418c7
...
@@ -135,10 +135,14 @@ class WithExtraParent(Layer):
...
@@ -135,10 +135,14 @@ class WithExtraParent(Layer):
"""
"""
function to set proto attribute
function to set proto attribute
"""
"""
print
"*************"
# short cut if myself is parsed before.
# print context
if
self
.
context_name
()
in
context
:
print
self
.
name
if
self
.
use_context_name
():
print
self
.
__extra_parent__
return
context
[
self
.
context_name
()]
else
:
return
context
[
self
.
name
]
# parse parents
kwargs
=
dict
()
kwargs
=
dict
()
for
p
in
self
.
__extra_parent__
:
for
p
in
self
.
__extra_parent__
:
p
.
to_proto
(
context
=
context
)
p
.
to_proto
(
context
=
context
)
...
@@ -153,12 +157,27 @@ class WithExtraParent(Layer):
...
@@ -153,12 +157,27 @@ class WithExtraParent(Layer):
self
.
__parent_layers__
[
layer_name
])
self
.
__parent_layers__
[
layer_name
])
kwargs
[
layer_name
]
=
v1_layer
kwargs
[
layer_name
]
=
v1_layer
# parse self
if
self
.
context_name
()
is
None
:
if
self
.
context_name
()
is
None
:
return
self
.
to_proto_impl
(
context
=
context
,
**
kwargs
)
return
self
.
to_proto_impl
(
context
=
context
,
**
kwargs
)
elif
self
.
context_name
()
not
in
context
:
elif
self
.
context_name
()
not
in
context
:
context
[
self
.
context_name
()]
=
self
.
to_proto_impl
(
context
[
self
.
context_name
()]
=
self
.
to_proto_impl
(
context
=
context
,
**
kwargs
)
context
=
context
,
**
kwargs
)
# parse children.
aaa
=
self
.
__children_layers__
for
layer
,
pnames
in
self
.
__children_layers__
:
drop
=
False
# child will only be parsed if all parents are in context.
for
pname
in
pnames
:
if
pname
not
in
context
:
drop
=
True
break
if
drop
:
continue
layer
.
to_proto
(
context
=
context
)
if
self
.
use_context_name
():
if
self
.
use_context_name
():
return
context
[
self
.
context_name
()]
return
context
[
self
.
context_name
()]
else
:
else
:
...
@@ -456,7 +475,8 @@ def recurrent_group(step, input, name=None):
...
@@ -456,7 +475,8 @@ def recurrent_group(step, input, name=None):
size
=
static_input
.
input
.
calculate_size
,
size
=
static_input
.
input
.
calculate_size
,
act
=
activation
.
Identity
())
as
mix
:
act
=
activation
.
Identity
())
as
mix
:
mix
+=
identity_projection
(
input
=
mem
)
mix
+=
identity_projection
(
input
=
mem
)
rnn_input
.
insert
(
input
.
index
(
static_input
),
mix
)
mem
.
append_child
(
layer
=
mix
,
parent_names
=
[
mem
.
context_name
()])
rnn_input
.
insert
(
input
.
index
(
static_input
),
mem
)
return
step
(
*
rnn_input
)
return
step
(
*
rnn_input
)
actual_output
=
__real_step__
(
*
actual_input
)
actual_output
=
__real_step__
(
*
actual_input
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录