Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
718642e9
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看板
未验证
提交
718642e9
编写于
2月 28, 2018
作者:
Y
Yancey
提交者:
GitHub
2月 28, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #8659 from Yancey1989/fix_dist_bug
Registry var type infer in split_selected_rows op
上级
e9f20331
7bd16fe1
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
20 addition
and
6 deletion
+20
-6
paddle/fluid/operators/split_selected_rows_op.cc
paddle/fluid/operators/split_selected_rows_op.cc
+12
-1
python/paddle/fluid/distribute_transpiler.py
python/paddle/fluid/distribute_transpiler.py
+8
-5
未找到文件。
paddle/fluid/operators/split_selected_rows_op.cc
浏览文件 @
718642e9
...
@@ -59,6 +59,16 @@ class SplitSelectedRowsOp : public framework::OperatorWithKernel {
...
@@ -59,6 +59,16 @@ class SplitSelectedRowsOp : public framework::OperatorWithKernel {
}
}
};
};
class
SplitSelectedRowsOpInferVarType
:
public
framework
::
VarTypeInference
{
public:
void
operator
()(
const
framework
::
OpDesc
&
op_desc
,
framework
::
BlockDesc
*
block
)
const
override
{
for
(
auto
&
out_var
:
op_desc
.
Output
(
"Out"
))
{
block
->
Var
(
out_var
)
->
SetType
(
framework
::
proto
::
VarType
::
SELECTED_ROWS
);
}
}
};
class
SplitSelectedRowsGradMaker
:
public
framework
::
SingleGradOpDescMaker
{
class
SplitSelectedRowsGradMaker
:
public
framework
::
SingleGradOpDescMaker
{
public:
public:
using
framework
::
SingleGradOpDescMaker
::
SingleGradOpDescMaker
;
using
framework
::
SingleGradOpDescMaker
::
SingleGradOpDescMaker
;
...
@@ -80,7 +90,8 @@ class SplitSelectedRowsGradMaker : public framework::SingleGradOpDescMaker {
...
@@ -80,7 +90,8 @@ class SplitSelectedRowsGradMaker : public framework::SingleGradOpDescMaker {
namespace
ops
=
paddle
::
operators
;
namespace
ops
=
paddle
::
operators
;
REGISTER_OPERATOR
(
split_selected_rows
,
ops
::
SplitSelectedRowsOp
,
REGISTER_OPERATOR
(
split_selected_rows
,
ops
::
SplitSelectedRowsOp
,
ops
::
SplitSelectedRowsOpMaker
,
ops
::
SplitSelectedRowsOpMaker
,
ops
::
SplitSelectedRowsGradMaker
);
ops
::
SplitSelectedRowsGradMaker
,
ops
::
SplitSelectedRowsOpInferVarType
);
REGISTER_OP_CPU_KERNEL
(
REGISTER_OP_CPU_KERNEL
(
split_selected_rows
,
split_selected_rows
,
ops
::
SplitSelectedRowsOpKernel
<
paddle
::
platform
::
CPUPlace
,
float
>
);
ops
::
SplitSelectedRowsOpKernel
<
paddle
::
platform
::
CPUPlace
,
float
>
);
python/paddle/fluid/distribute_transpiler.py
浏览文件 @
718642e9
...
@@ -276,6 +276,7 @@ class DistributeTranspiler:
...
@@ -276,6 +276,7 @@ class DistributeTranspiler:
pserver_program
.
global_block
().
create_var
(
pserver_program
.
global_block
().
create_var
(
name
=
orig_var_name
,
name
=
orig_var_name
,
persistable
=
True
,
persistable
=
True
,
type
=
v
.
type
,
dtype
=
v
.
dtype
,
dtype
=
v
.
dtype
,
shape
=
v
.
shape
)
shape
=
v
.
shape
)
print
(
"create origin var: "
,
orig_var_name
)
print
(
"create origin var: "
,
orig_var_name
)
...
@@ -283,6 +284,7 @@ class DistributeTranspiler:
...
@@ -283,6 +284,7 @@ class DistributeTranspiler:
var
=
pserver_program
.
global_block
().
create_var
(
var
=
pserver_program
.
global_block
().
create_var
(
name
=
"%s.trainer_%d"
%
(
orig_var_name
,
trainer_id
),
name
=
"%s.trainer_%d"
%
(
orig_var_name
,
trainer_id
),
persistable
=
False
,
persistable
=
False
,
type
=
v
.
type
,
dtype
=
v
.
dtype
,
dtype
=
v
.
dtype
,
shape
=
v
.
shape
)
shape
=
v
.
shape
)
recv_inputs
.
append
(
var
)
recv_inputs
.
append
(
var
)
...
@@ -551,6 +553,7 @@ class DistributeTranspiler:
...
@@ -551,6 +553,7 @@ class DistributeTranspiler:
type
=
"sum"
,
type
=
"sum"
,
inputs
=
{
"X"
:
vars2merge
},
inputs
=
{
"X"
:
vars2merge
},
outputs
=
{
"Out"
:
merged_var
})
outputs
=
{
"Out"
:
merged_var
})
if
not
merged_var
.
type
==
core
.
VarDesc
.
VarType
.
SELECTED_ROWS
:
optimize_block
.
append_op
(
optimize_block
.
append_op
(
type
=
"scale"
,
type
=
"scale"
,
inputs
=
{
"X"
:
merged_var
},
inputs
=
{
"X"
:
merged_var
},
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录