Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
dc3d2dc8
P
Paddle
项目概览
BaiXuePrincess
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
dc3d2dc8
编写于
4月 20, 2018
作者:
Q
qiaolongfei
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rename grad_map to grad_to_id
上级
260bf5ac
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
7 addition
and
7 deletion
+7
-7
paddle/fluid/operators/async_listen_and_serv_op.cc
paddle/fluid/operators/async_listen_and_serv_op.cc
+2
-2
paddle/fluid/operators/listen_and_serv_op.cc
paddle/fluid/operators/listen_and_serv_op.cc
+4
-4
paddle/fluid/operators/send_recv_op_test.cc
paddle/fluid/operators/send_recv_op_test.cc
+1
-1
未找到文件。
paddle/fluid/operators/async_listen_and_serv_op.cc
浏览文件 @
dc3d2dc8
...
...
@@ -89,7 +89,7 @@ void AsyncListenAndServOp::RunImpl(const framework::Scope &scope,
std
::
unordered_map
<
std
::
string
,
int32_t
>
grad_to_id
;
std
::
unordered_map
<
int32_t
,
std
::
string
>
id_to_grad
;
auto
grad_map_str
=
Attr
<
std
::
vector
<
std
::
string
>>
(
"grad_
map
"
);
auto
grad_map_str
=
Attr
<
std
::
vector
<
std
::
string
>>
(
"grad_
to_id
"
);
for
(
auto
&
grad_and_id
:
grad_map_str
)
{
std
::
vector
<
std
::
string
>
pieces
;
split
(
grad_and_id
,
' '
,
&
pieces
);
...
...
@@ -193,7 +193,7 @@ from send_op and send back variables to recv_op.
.
SetDefault
(
"127.0.0.1:6164"
)
.
AddCustomChecker
([](
const
std
::
string
&
ip
)
{
return
!
ip
.
empty
();
});
AddAttr
<
std
::
vector
<
std
::
string
>>
(
"grad_
map
(['param1@GRAD.block0:1', 'param2@GRAD.blockn:2'])"
,
"grad_
to_id
(['param1@GRAD.block0:1', 'param2@GRAD.blockn:2'])"
,
"a map from grad name to it's optimize block id"
)
.
SetDefault
({});
AddAttr
<
framework
::
BlockDesc
*>
(
kOptimizeBlock
,
...
...
paddle/fluid/operators/listen_and_serv_op.cc
浏览文件 @
dc3d2dc8
...
...
@@ -207,8 +207,8 @@ void ListenAndServOp::RunAsyncLoop(framework::Executor *executor,
std
::
unordered_map
<
std
::
string
,
int32_t
>
grad_to_id
;
std
::
unordered_map
<
int32_t
,
std
::
string
>
id_to_grad
;
auto
grad_
map_str
=
Attr
<
std
::
vector
<
std
::
string
>>
(
"grad_map
"
);
for
(
auto
&
grad_and_id
:
grad_
map
_str
)
{
auto
grad_
to_id_str
=
Attr
<
std
::
vector
<
std
::
string
>>
(
"grad_to_id
"
);
for
(
auto
&
grad_and_id
:
grad_
to_id
_str
)
{
std
::
vector
<
std
::
string
>
pieces
;
split
(
grad_and_id
,
' '
,
&
pieces
);
PADDLE_ENFORCE_EQ
(
pieces
.
size
(),
2
);
...
...
@@ -227,7 +227,7 @@ void ListenAndServOp::RunAsyncLoop(framework::Executor *executor,
block_list
.
push_back
(
blkid
);
}
}
PADDLE_ENFORCE_EQ
(
grad_
map
_str
.
size
(),
block_list
.
size
(),
PADDLE_ENFORCE_EQ
(
grad_
to_id
_str
.
size
(),
block_list
.
size
(),
"grad num should be equal to optimize block num"
);
auto
optimize_prepared
=
executor
->
Prepare
(
*
program
,
block_list
);
...
...
@@ -328,7 +328,7 @@ from send_op and send back variables to recv_op.
.
SetDefault
(
"127.0.0.1:6164"
)
.
AddCustomChecker
([](
const
std
::
string
&
ip
)
{
return
!
ip
.
empty
();
});
AddAttr
<
std
::
vector
<
std
::
string
>>
(
"grad_
map
(['param1@GRAD.block0:1', 'param2@GRAD.blockn:2'])"
,
"grad_
to_id
(['param1@GRAD.block0:1', 'param2@GRAD.blockn:2'])"
,
"a map from grad name to it's optimize block id"
)
.
SetDefault
({});
AddAttr
<
bool
>
(
"sync_mode"
,
"if works at sync_mode or not"
)
...
...
paddle/fluid/operators/send_recv_op_test.cc
浏览文件 @
dc3d2dc8
...
...
@@ -137,7 +137,7 @@ void StartServerNet(bool is_sparse) {
attrs
.
insert
({
"GradList"
,
std
::
vector
<
std
::
string
>
({
"x1"
})});
attrs
.
insert
({
"OptimizeBlock"
,
optimize_block
});
attrs
.
insert
({
"PrefetchBlock"
,
prefetch_block
});
attrs
.
insert
({
"grad_
map
"
,
{}});
attrs
.
insert
({
"grad_
to_id
"
,
{}});
attrs
.
insert
({
"sync_mode"
,
true
});
listen_and_serv_op
=
f
::
OpRegistry
::
CreateOp
(
"listen_and_serv"
,
{{
"X"
,
{
"x1"
}}},
{},
attrs
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录