Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
兽拳
Paddle
提交
a8d44cc5
P
Paddle
项目概览
兽拳
/
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a8d44cc5
编写于
5月 31, 2017
作者:
X
xuwei06
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix size for lstm, identity_projection and concat
上级
3070dd56
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
11 addition
and
12 deletion
+11
-12
python/paddle/trainer_config_helpers/layers.py
python/paddle/trainer_config_helpers/layers.py
+11
-12
未找到文件。
python/paddle/trainer_config_helpers/layers.py
浏览文件 @
a8d44cc5
...
@@ -482,7 +482,7 @@ def table_projection(input, size=0, param_attr=None):
...
@@ -482,7 +482,7 @@ def table_projection(input, size=0, param_attr=None):
return
proj
return
proj
def
identity_projection
(
input
,
offset
=
None
):
def
identity_projection
(
input
,
offset
=
None
,
size
=
None
):
"""
"""
1. IdentityProjection if offset=None. It performs:
1. IdentityProjection if offset=None. It performs:
...
@@ -523,8 +523,10 @@ def identity_projection(input, offset=None):
...
@@ -523,8 +523,10 @@ def identity_projection(input, offset=None):
proj
=
IdentityProjection
(
input_layer_name
=
input
.
name
)
proj
=
IdentityProjection
(
input_layer_name
=
input
.
name
)
proj
.
origin
=
input
proj
.
origin
=
input
else
:
else
:
if
size
is
None
:
size
=
input
.
size
-
offset
proj
=
IdentityOffsetProjection
(
proj
=
IdentityOffsetProjection
(
input_layer_name
=
input
.
name
,
offset
=
offset
)
input_layer_name
=
input
.
name
,
offset
=
offset
,
size
=
size
)
proj
.
origin
=
input
proj
.
origin
=
input
return
proj
return
proj
...
@@ -2797,7 +2799,7 @@ def concat_layer(input, act=None, name=None, layer_attr=None, bias_attr=None):
...
@@ -2797,7 +2799,7 @@ def concat_layer(input, act=None, name=None, layer_attr=None, bias_attr=None):
if
layer_type
==
LayerType
.
CONCAT_LAYER
:
if
layer_type
==
LayerType
.
CONCAT_LAYER
:
assert
not
bias_attr
assert
not
bias_attr
Layer
(
layer
=
Layer
(
name
=
name
,
name
=
name
,
type
=
layer_type
,
type
=
layer_type
,
inputs
=
[
x
.
name
for
x
in
input
]
if
is_concat_layer
else
input
,
inputs
=
[
x
.
name
for
x
in
input
]
if
is_concat_layer
else
input
,
...
@@ -2805,13 +2807,7 @@ def concat_layer(input, act=None, name=None, layer_attr=None, bias_attr=None):
...
@@ -2805,13 +2807,7 @@ def concat_layer(input, act=None, name=None, layer_attr=None, bias_attr=None):
bias
=
ParamAttr
.
to_bias
(
bias_attr
),
bias
=
ParamAttr
.
to_bias
(
bias_attr
),
**
ExtraLayerAttribute
.
to_kwargs
(
layer_attr
))
**
ExtraLayerAttribute
.
to_kwargs
(
layer_attr
))
sz
=
0
sz
=
layer
.
config
.
size
for
each_input
in
input
:
if
each_input
.
size
is
not
None
:
sz
+=
each_input
.
size
else
:
sz
=
None
break
return
LayerOutput
(
return
LayerOutput
(
name
,
name
,
...
@@ -2979,7 +2975,7 @@ def memory(name,
...
@@ -2979,7 +2975,7 @@ def memory(name,
@
layer_support
()
@
layer_support
()
def
lstm_step_layer
(
input
,
def
lstm_step_layer
(
input
,
state
,
state
,
size
,
size
=
None
,
act
=
None
,
act
=
None
,
name
=
None
,
name
=
None
,
gate_act
=
None
,
gate_act
=
None
,
...
@@ -3045,6 +3041,9 @@ def lstm_step_layer(input,
...
@@ -3045,6 +3041,9 @@ def lstm_step_layer(input,
:return: LayerOutput object.
:return: LayerOutput object.
:rtype: LayerOutput
:rtype: LayerOutput
"""
"""
assert
size
is
None
or
state
.
size
==
size
size
=
state
.
size
Layer
(
Layer
(
name
=
name
,
name
=
name
,
type
=
LayerType
.
LSTM_STEP_LAYER
,
type
=
LayerType
.
LSTM_STEP_LAYER
,
...
@@ -3052,7 +3051,7 @@ def lstm_step_layer(input,
...
@@ -3052,7 +3051,7 @@ def lstm_step_layer(input,
active_gate_type
=
gate_act
.
name
,
active_gate_type
=
gate_act
.
name
,
active_state_type
=
state_act
.
name
,
active_state_type
=
state_act
.
name
,
bias
=
ParamAttr
.
to_bias
(
bias_attr
),
bias
=
ParamAttr
.
to_bias
(
bias_attr
),
size
=
size
,
size
=
s
tate
.
s
ize
,
inputs
=
[
input
.
name
,
state
.
name
],
inputs
=
[
input
.
name
,
state
.
name
],
**
ExtraLayerAttribute
.
to_kwargs
(
layer_attr
))
**
ExtraLayerAttribute
.
to_kwargs
(
layer_attr
))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录