Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
6159f5db
P
Paddle
项目概览
PaddlePaddle
/
Paddle
1 年多 前同步成功
通知
2307
Star
20932
Fork
5423
代码
文件
提交
分支
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看板
提交
6159f5db
编写于
8月 08, 2017
作者:
Z
zchen0211
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
code style fix
上级
689d5ee1
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
6 addition
and
16 deletion
+6
-16
paddle/operators/gather.h
paddle/operators/gather.h
+6
-16
未找到文件。
paddle/operators/gather.h
浏览文件 @
6159f5db
...
...
@@ -28,11 +28,8 @@ namespace operators {
/* Implementation of CPU copy */
template
<
typename
T
>
void
CPUGather
(
const
T
*
params
,
const
int
*
indices
,
const
int
slice_size
,
const
int
index_size
,
T
*
output
)
{
void
CPUGather
(
const
T
*
params
,
const
int
*
indices
,
const
int
slice_size
,
const
int
index_size
,
T
*
output
)
{
const
size_t
slice_bytes
=
slice_size
*
sizeof
(
T
);
for
(
size_t
i
=
0
;
i
<
index_size
;
++
i
)
{
...
...
@@ -47,11 +44,8 @@ void CPUGather(const T* params,
d = cuda_stream(gpu_id_, stream_id_);
*/
template
<
typename
T
>
void
GPUGather
(
const
T
*
src
,
const
int
*
index
,
const
int
slice_size
,
const
int
index_size
,
T
*
output
);
void
GPUGather
(
const
T
*
src
,
const
int
*
index
,
const
int
slice_size
,
const
int
index_size
,
T
*
output
);
/**
* Return a new tensor from source tensor, gathered according to index
...
...
@@ -60,8 +54,7 @@ void GPUGather(const T* src,
* return: output tensor
*/
template
<
typename
T
>
void
Gather
(
const
platform
::
Place
&
place
,
const
paddle
::
framework
::
Tensor
*
src
,
void
Gather
(
const
platform
::
Place
&
place
,
const
paddle
::
framework
::
Tensor
*
src
,
const
paddle
::
framework
::
Tensor
*
index
,
paddle
::
framework
::
Tensor
*
output
)
{
// check index of shape 1-D
...
...
@@ -78,10 +71,7 @@ void Gather(const platform::Place& place,
// Gathering
if
(
platform
::
is_cpu_place
(
place
))
{
CPUGather
<
T
>
(
src
->
data
<
T
>
(),
index
->
data
<
int
>
(),
slice_size
,
index_size
,
CPUGather
<
T
>
(
src
->
data
<
T
>
(),
index
->
data
<
int
>
(),
slice_size
,
index_size
,
output
->
data
<
T
>
());
}
else
{
// init for GPU
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录