Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
690cd1f7
P
PaddleDetection
项目概览
PaddlePaddle
/
PaddleDetection
大约 1 年 前同步成功
通知
695
Star
11112
Fork
2696
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
184
列表
看板
标记
里程碑
合并请求
40
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
184
Issue
184
列表
看板
标记
里程碑
合并请求
40
合并请求
40
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
690cd1f7
编写于
4月 14, 2018
作者:
C
chengduoZH
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refine gather and broadcast
上级
494c262a
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
17 addition
and
12 deletion
+17
-12
paddle/fluid/framework/details/broadcast_op_handle.cc
paddle/fluid/framework/details/broadcast_op_handle.cc
+5
-3
paddle/fluid/framework/details/gather_op_handle.cc
paddle/fluid/framework/details/gather_op_handle.cc
+12
-9
未找到文件。
paddle/fluid/framework/details/broadcast_op_handle.cc
浏览文件 @
690cd1f7
...
@@ -99,9 +99,11 @@ void BroadcastOpHandle::RunImpl() {
...
@@ -99,9 +99,11 @@ void BroadcastOpHandle::RunImpl() {
PADDLE_THROW
(
"Var should be LoDTensor or SelectedRows."
);
PADDLE_THROW
(
"Var should be LoDTensor or SelectedRows."
);
}
}
auto
dev_ctx
=
dev_ctxes_
[
out_p
];
RunAndRecordEvent
(
out_p
,
[
in_tensor
,
out_var
,
dev_ctx
,
out_p
]
{
Tensor
*
out_tensor
=
GetTensorFromVar
(
out_var
);
Tensor
*
out_tensor
=
GetTensorFromVar
(
out_var
);
paddle
::
framework
::
TensorCopy
(
*
in_tensor
,
out_p
,
*
(
dev_ctxes_
[
in_place
]),
paddle
::
framework
::
TensorCopy
(
*
in_tensor
,
out_p
,
*
(
dev_ctx
),
out_tensor
);
out_tensor
);
}
);
}
}
}
}
...
...
paddle/fluid/framework/details/gather_op_handle.cc
浏览文件 @
690cd1f7
...
@@ -84,7 +84,7 @@ void GatherOpHandle::RunImpl() {
...
@@ -84,7 +84,7 @@ void GatherOpHandle::RunImpl() {
"The type of input is not consistent."
);
"The type of input is not consistent."
);
PADDLE_ENFORCE_EQ
(
pre_in
.
height
(),
in_sr
.
height
(),
PADDLE_ENFORCE_EQ
(
pre_in
.
height
(),
in_sr
.
height
(),
"The height of inputs is not consistent."
);
"The height of inputs is not consistent."
);
PADDLE_ENFORCE_EQ
(
pre_in
.
GetCompleteDims
(),
in_sr
.
GetCompleteDims
(),
,
PADDLE_ENFORCE_EQ
(
pre_in
.
GetCompleteDims
(),
in_sr
.
GetCompleteDims
(),
"The dims of inputs is not consistent."
);
"The dims of inputs is not consistent."
);
auto
in_sr_rows
=
in_sr
.
rows
();
auto
in_sr_rows
=
in_sr
.
rows
();
...
@@ -110,14 +110,17 @@ void GatherOpHandle::RunImpl() {
...
@@ -110,14 +110,17 @@ void GatherOpHandle::RunImpl() {
Tensor
*
out_tensor
=
out
->
mutable_value
();
Tensor
*
out_tensor
=
out
->
mutable_value
();
// copy
// copy
auto
dev_ctx
=
dev_ctxes_
[
out_place
];
RunAndRecordEvent
(
out_place
,
[
in_tensors
,
out_var
,
dev_ctx
,
out_place
]
{
int
s
=
0
,
e
=
0
;
int
s
=
0
,
e
=
0
;
for
(
size_t
j
=
0
;
j
<
in_tensors
.
size
();
++
j
)
{
for
(
size_t
j
=
0
;
j
<
in_tensors
.
size
();
++
j
)
{
e
+=
in_tensors
[
j
].
dims
()[
0
];
e
+=
in_tensors
[
j
].
dims
()[
0
];
auto
sub_out
=
out_tensor
->
Slice
(
s
,
e
);
auto
sub_out
=
out_tensor
->
Slice
(
s
,
e
);
paddle
::
framework
::
TensorCopy
(
in_tensors
[
j
],
out_place
,
paddle
::
framework
::
TensorCopy
(
in_tensors
[
j
],
out_place
,
*
(
dev_ctx
)
,
*
(
dev_ctxes_
[
in_places
[
j
]]),
&
sub_out
);
&
sub_out
);
s
=
e
;
s
=
e
;
}
}
});
}
}
std
::
string
GatherOpHandle
::
Name
()
const
{
return
"gather"
;
}
std
::
string
GatherOpHandle
::
Name
()
const
{
return
"gather"
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录