Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
21f068ab
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看板
提交
21f068ab
编写于
5月 29, 2018
作者:
Q
qiaolongfei
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
optimize the name of table_grad_list
上级
16027ea1
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
10 addition
and
9 deletion
+10
-9
python/paddle/fluid/transpiler/distribute_transpiler.py
python/paddle/fluid/transpiler/distribute_transpiler.py
+10
-9
未找到文件。
python/paddle/fluid/transpiler/distribute_transpiler.py
浏览文件 @
21f068ab
...
@@ -257,7 +257,7 @@ class DistributeTranspiler:
...
@@ -257,7 +257,7 @@ class DistributeTranspiler:
][
0
]
][
0
]
table_grad_var
=
self
.
table_param_grad
[
1
]
table_grad_var
=
self
.
table_param_grad
[
1
]
if
self
.
sync_mode
:
if
self
.
sync_mode
:
self
.
table_grad_list
=
[
self
.
t
rainer_side_t
able_grad_list
=
[
program
.
global_block
().
create_var
(
program
.
global_block
().
create_var
(
name
=
"%s.trainer_%d.pserver_%d"
%
name
=
"%s.trainer_%d.pserver_%d"
%
(
table_grad_var
.
name
,
trainer_id
,
index
),
(
table_grad_var
.
name
,
trainer_id
,
index
),
...
@@ -267,7 +267,7 @@ class DistributeTranspiler:
...
@@ -267,7 +267,7 @@ class DistributeTranspiler:
for
index
in
range
(
len
(
self
.
pserver_endpoints
))
for
index
in
range
(
len
(
self
.
pserver_endpoints
))
]
]
else
:
else
:
self
.
table_grad_list
=
[
self
.
t
rainer_side_t
able_grad_list
=
[
program
.
global_block
().
create_var
(
program
.
global_block
().
create_var
(
name
=
"%s.pserver_%d"
%
(
table_grad_var
.
name
,
index
),
name
=
"%s.pserver_%d"
%
(
table_grad_var
.
name
,
index
),
type
=
table_grad_var
.
type
,
type
=
table_grad_var
.
type
,
...
@@ -648,11 +648,11 @@ class DistributeTranspiler:
...
@@ -648,11 +648,11 @@ class DistributeTranspiler:
inputs
=
{
inputs
=
{
'Ids'
:
[
program
.
global_block
().
vars
[
table_grad_name
]]
'Ids'
:
[
program
.
global_block
().
vars
[
table_grad_name
]]
},
},
outputs
=
{
"Out"
:
self
.
table_grad_list
})
outputs
=
{
"Out"
:
self
.
t
rainer_side_t
able_grad_list
})
program
.
global_block
().
insert_op
(
program
.
global_block
().
insert_op
(
index
=
op_index
+
2
,
index
=
op_index
+
2
,
type
=
"send_vars"
,
type
=
"send_vars"
,
inputs
=
{
'X'
:
self
.
table_grad_list
},
inputs
=
{
'X'
:
self
.
t
rainer_side_t
able_grad_list
},
outputs
=
{
"RPCClient"
:
rpc_client_var
},
outputs
=
{
"RPCClient"
:
rpc_client_var
},
attrs
=
{
"sync_send"
:
True
,
attrs
=
{
"sync_send"
:
True
,
"epmap"
:
pserver_endpoints
})
"epmap"
:
pserver_endpoints
})
...
@@ -717,7 +717,7 @@ class DistributeTranspiler:
...
@@ -717,7 +717,7 @@ class DistributeTranspiler:
if
self
.
sync_mode
:
if
self
.
sync_mode
:
# create grad vars in pserver program
# create grad vars in pserver program
table_grad_var
=
self
.
table_param_grad
[
1
]
table_grad_var
=
self
.
table_param_grad
[
1
]
table_grad_list
=
[
pserver_side_
table_grad_list
=
[
pserver_program
.
global_block
().
create_var
(
pserver_program
.
global_block
().
create_var
(
name
=
"%s.trainer_%d.pserver_%d"
%
name
=
"%s.trainer_%d.pserver_%d"
%
(
table_grad_var
.
name
,
index
,
pserver_index
),
(
table_grad_var
.
name
,
index
,
pserver_index
),
...
@@ -727,15 +727,16 @@ class DistributeTranspiler:
...
@@ -727,15 +727,16 @@ class DistributeTranspiler:
for
index
in
range
(
self
.
trainer_num
)
for
index
in
range
(
self
.
trainer_num
)
]
]
# append sum op for table_grad_list
# append sum op for
pserver_side_
table_grad_list
table_opt_block
.
append_op
(
table_opt_block
.
append_op
(
type
=
"sum"
,
type
=
"sum"
,
inputs
=
{
"X"
:
table_grad_list
},
inputs
=
{
"X"
:
pserver_side_
table_grad_list
},
outputs
=
{
"Out"
:
[
grad_var
]})
outputs
=
{
"Out"
:
[
grad_var
]})
else
:
else
:
# in async_mode, for table gradient, it also need to be splited to each parameter server
# in async_mode, for table gradient, it also need to be splited to each parameter server
origin_grad_name
=
grad_var
.
name
origin_grad_name
=
grad_var
.
name
splited_grad_name
=
self
.
table_grad_list
[
pserver_index
].
name
splited_grad_name
=
self
.
trainer_side_table_grad_list
[
pserver_index
].
name
if
not
splited_grad_name
.
startswith
(
origin_grad_name
):
if
not
splited_grad_name
.
startswith
(
origin_grad_name
):
raise
ValueError
(
"origin_grad_var: "
+
splited_grad_name
+
raise
ValueError
(
"origin_grad_var: "
+
splited_grad_name
+
" grad_var:"
+
grad_var
.
name
)
" grad_var:"
+
grad_var
.
name
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录