Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
6849d33b
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看板
未验证
提交
6849d33b
编写于
3月 16, 2022
作者:
Z
Zhong Hui
提交者:
GitHub
3月 16, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[Ops] segment pool op support for int int64 kernel. (#40577)
* segment pool support for int int64 kernel. * add support in python api
上级
2dec25db
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
52 addition
and
14 deletion
+52
-14
paddle/phi/kernels/cpu/segment_pool_grad_kernel.cc
paddle/phi/kernels/cpu/segment_pool_grad_kernel.cc
+3
-1
paddle/phi/kernels/cpu/segment_pool_kernel.cc
paddle/phi/kernels/cpu/segment_pool_kernel.cc
+8
-2
paddle/phi/kernels/funcs/segment_pooling.cc
paddle/phi/kernels/funcs/segment_pooling.cc
+9
-0
paddle/phi/kernels/funcs/segment_pooling.cu
paddle/phi/kernels/funcs/segment_pooling.cu
+9
-0
paddle/phi/kernels/gpu/segment_pool_grad_kernel.cu
paddle/phi/kernels/gpu/segment_pool_grad_kernel.cu
+3
-1
paddle/phi/kernels/gpu/segment_pool_kernel.cu
paddle/phi/kernels/gpu/segment_pool_kernel.cu
+8
-2
python/paddle/incubate/tensor/math.py
python/paddle/incubate/tensor/math.py
+12
-8
未找到文件。
paddle/phi/kernels/cpu/segment_pool_grad_kernel.cc
浏览文件 @
6849d33b
...
@@ -23,4 +23,6 @@ PD_REGISTER_KERNEL(segment_pool_grad,
...
@@ -23,4 +23,6 @@ PD_REGISTER_KERNEL(segment_pool_grad,
ALL_LAYOUT
,
ALL_LAYOUT
,
phi
::
SegmentPoolGradKernel
,
phi
::
SegmentPoolGradKernel
,
float
,
float
,
double
)
{}
double
,
int
,
int64_t
)
{}
paddle/phi/kernels/cpu/segment_pool_kernel.cc
浏览文件 @
6849d33b
...
@@ -18,5 +18,11 @@
...
@@ -18,5 +18,11 @@
#include "paddle/phi/backends/cpu/cpu_context.h"
#include "paddle/phi/backends/cpu/cpu_context.h"
#include "paddle/phi/core/kernel_registry.h"
#include "paddle/phi/core/kernel_registry.h"
PD_REGISTER_KERNEL
(
PD_REGISTER_KERNEL
(
segment_pool
,
segment_pool
,
CPU
,
ALL_LAYOUT
,
phi
::
SegmentPoolKernel
,
float
,
double
)
{}
CPU
,
ALL_LAYOUT
,
phi
::
SegmentPoolKernel
,
float
,
double
,
int
,
int64_t
)
{}
paddle/phi/kernels/funcs/segment_pooling.cc
浏览文件 @
6849d33b
...
@@ -149,10 +149,19 @@ template class SegmentPoolFunctor<CPU, float, int>;
...
@@ -149,10 +149,19 @@ template class SegmentPoolFunctor<CPU, float, int>;
template
class
SegmentPoolFunctor
<
CPU
,
float
,
int64_t
>;
template
class
SegmentPoolFunctor
<
CPU
,
float
,
int64_t
>;
template
class
SegmentPoolFunctor
<
CPU
,
double
,
int
>;
template
class
SegmentPoolFunctor
<
CPU
,
double
,
int
>;
template
class
SegmentPoolFunctor
<
CPU
,
double
,
int64_t
>;
template
class
SegmentPoolFunctor
<
CPU
,
double
,
int64_t
>;
template
class
SegmentPoolFunctor
<
CPU
,
int
,
int
>;
template
class
SegmentPoolFunctor
<
CPU
,
int
,
int64_t
>;
template
class
SegmentPoolFunctor
<
CPU
,
int64_t
,
int
>;
template
class
SegmentPoolFunctor
<
CPU
,
int64_t
,
int64_t
>;
template
class
SegmentPoolGradFunctor
<
CPU
,
float
,
int
>;
template
class
SegmentPoolGradFunctor
<
CPU
,
float
,
int
>;
template
class
SegmentPoolGradFunctor
<
CPU
,
float
,
int64_t
>;
template
class
SegmentPoolGradFunctor
<
CPU
,
float
,
int64_t
>;
template
class
SegmentPoolGradFunctor
<
CPU
,
double
,
int
>;
template
class
SegmentPoolGradFunctor
<
CPU
,
double
,
int
>;
template
class
SegmentPoolGradFunctor
<
CPU
,
double
,
int64_t
>;
template
class
SegmentPoolGradFunctor
<
CPU
,
double
,
int64_t
>;
template
class
SegmentPoolGradFunctor
<
CPU
,
int
,
int
>;
template
class
SegmentPoolGradFunctor
<
CPU
,
int
,
int64_t
>;
template
class
SegmentPoolGradFunctor
<
CPU
,
int64_t
,
int
>;
template
class
SegmentPoolGradFunctor
<
CPU
,
int64_t
,
int64_t
>;
}
// namespace funcs
}
// namespace funcs
}
// namespace phi
}
// namespace phi
paddle/phi/kernels/funcs/segment_pooling.cu
浏览文件 @
6849d33b
...
@@ -453,10 +453,19 @@ template class SegmentPoolFunctor<GPU, float, int>;
...
@@ -453,10 +453,19 @@ template class SegmentPoolFunctor<GPU, float, int>;
template
class
SegmentPoolFunctor
<
GPU
,
float
,
int64_t
>;
template
class
SegmentPoolFunctor
<
GPU
,
float
,
int64_t
>;
template
class
SegmentPoolFunctor
<
GPU
,
double
,
int
>;
template
class
SegmentPoolFunctor
<
GPU
,
double
,
int
>;
template
class
SegmentPoolFunctor
<
GPU
,
double
,
int64_t
>;
template
class
SegmentPoolFunctor
<
GPU
,
double
,
int64_t
>;
template
class
SegmentPoolFunctor
<
GPU
,
int
,
int
>;
template
class
SegmentPoolFunctor
<
GPU
,
int
,
int64_t
>;
template
class
SegmentPoolFunctor
<
GPU
,
int64_t
,
int
>;
template
class
SegmentPoolFunctor
<
GPU
,
int64_t
,
int64_t
>;
template
class
SegmentPoolGradFunctor
<
GPU
,
float
,
int
>;
template
class
SegmentPoolGradFunctor
<
GPU
,
float
,
int
>;
template
class
SegmentPoolGradFunctor
<
GPU
,
float
,
int64_t
>;
template
class
SegmentPoolGradFunctor
<
GPU
,
float
,
int64_t
>;
template
class
SegmentPoolGradFunctor
<
GPU
,
double
,
int
>;
template
class
SegmentPoolGradFunctor
<
GPU
,
double
,
int
>;
template
class
SegmentPoolGradFunctor
<
GPU
,
double
,
int64_t
>;
template
class
SegmentPoolGradFunctor
<
GPU
,
double
,
int64_t
>;
template
class
SegmentPoolGradFunctor
<
GPU
,
int
,
int
>;
template
class
SegmentPoolGradFunctor
<
GPU
,
int
,
int64_t
>;
template
class
SegmentPoolGradFunctor
<
GPU
,
int64_t
,
int
>;
template
class
SegmentPoolGradFunctor
<
GPU
,
int64_t
,
int64_t
>;
}
// namespace funcs
}
// namespace funcs
}
// namespace phi
}
// namespace phi
paddle/phi/kernels/gpu/segment_pool_grad_kernel.cu
浏览文件 @
6849d33b
...
@@ -24,4 +24,6 @@ PD_REGISTER_KERNEL(segment_pool_grad,
...
@@ -24,4 +24,6 @@ PD_REGISTER_KERNEL(segment_pool_grad,
ALL_LAYOUT
,
ALL_LAYOUT
,
phi
::
SegmentPoolGradKernel
,
phi
::
SegmentPoolGradKernel
,
float
,
float
,
double
)
{}
double
,
int
,
int64_t
)
{}
paddle/phi/kernels/gpu/segment_pool_kernel.cu
浏览文件 @
6849d33b
...
@@ -19,5 +19,11 @@
...
@@ -19,5 +19,11 @@
#include "paddle/phi/core/dense_tensor.h"
#include "paddle/phi/core/dense_tensor.h"
#include "paddle/phi/core/kernel_registry.h"
#include "paddle/phi/core/kernel_registry.h"
PD_REGISTER_KERNEL
(
PD_REGISTER_KERNEL
(
segment_pool
,
segment_pool
,
GPU
,
ALL_LAYOUT
,
phi
::
SegmentPoolKernel
,
float
,
double
)
{}
GPU
,
ALL_LAYOUT
,
phi
::
SegmentPoolKernel
,
float
,
double
,
int
,
int64_t
)
{}
python/paddle/incubate/tensor/math.py
浏览文件 @
6849d33b
...
@@ -29,7 +29,7 @@ def segment_sum(data, segment_ids, name=None):
...
@@ -29,7 +29,7 @@ def segment_sum(data, segment_ids, name=None):
where sum is over j such that `segment_ids[j] == i`.
where sum is over j such that `segment_ids[j] == i`.
Args:
Args:
data (Tensor): A tensor, available data type float32, float64.
data (Tensor): A tensor, available data type float32, float64
, int32, int64
.
segment_ids (Tensor): A 1-D tensor, which have the same size
segment_ids (Tensor): A 1-D tensor, which have the same size
with the first dimension of input data.
with the first dimension of input data.
Available data type is int32, int64.
Available data type is int32, int64.
...
@@ -54,7 +54,8 @@ def segment_sum(data, segment_ids, name=None):
...
@@ -54,7 +54,8 @@ def segment_sum(data, segment_ids, name=None):
out
,
tmp
=
_C_ops
.
segment_pool
(
data
,
segment_ids
,
'pooltype'
,
"SUM"
)
out
,
tmp
=
_C_ops
.
segment_pool
(
data
,
segment_ids
,
'pooltype'
,
"SUM"
)
return
out
return
out
check_variable_and_dtype
(
data
,
"X"
,
(
"float32"
,
"float64"
),
"segment_pool"
)
check_variable_and_dtype
(
data
,
"X"
,
(
"float32"
,
"float64"
,
"int32"
,
"int64"
),
"segment_pool"
)
check_variable_and_dtype
(
segment_ids
,
"SegmentIds"
,
(
"int32"
,
"int64"
),
check_variable_and_dtype
(
segment_ids
,
"SegmentIds"
,
(
"int32"
,
"int64"
),
"segment_pool"
)
"segment_pool"
)
...
@@ -82,7 +83,7 @@ def segment_mean(data, segment_ids, name=None):
...
@@ -82,7 +83,7 @@ def segment_mean(data, segment_ids, name=None):
of all index 'segment_ids[j] == i'.
of all index 'segment_ids[j] == i'.
Args:
Args:
data (tensor): a tensor, available data type float32, float64.
data (tensor): a tensor, available data type float32, float64
, int32, int64
.
segment_ids (tensor): a 1-d tensor, which have the same size
segment_ids (tensor): a 1-d tensor, which have the same size
with the first dimension of input data.
with the first dimension of input data.
available data type is int32, int64.
available data type is int32, int64.
...
@@ -107,7 +108,8 @@ def segment_mean(data, segment_ids, name=None):
...
@@ -107,7 +108,8 @@ def segment_mean(data, segment_ids, name=None):
out
,
tmp
=
_C_ops
.
segment_pool
(
data
,
segment_ids
,
'pooltype'
,
"MEAN"
)
out
,
tmp
=
_C_ops
.
segment_pool
(
data
,
segment_ids
,
'pooltype'
,
"MEAN"
)
return
out
return
out
check_variable_and_dtype
(
data
,
"X"
,
(
"float32"
,
"float64"
),
"segment_pool"
)
check_variable_and_dtype
(
data
,
"X"
,
(
"float32"
,
"float64"
,
"int32"
,
"int64"
),
"segment_pool"
)
check_variable_and_dtype
(
segment_ids
,
"SegmentIds"
,
(
"int32"
,
"int64"
),
check_variable_and_dtype
(
segment_ids
,
"SegmentIds"
,
(
"int32"
,
"int64"
),
"segment_pool"
)
"segment_pool"
)
...
@@ -134,7 +136,7 @@ def segment_min(data, segment_ids, name=None):
...
@@ -134,7 +136,7 @@ def segment_min(data, segment_ids, name=None):
where min is over j such that `segment_ids[j] == i`.
where min is over j such that `segment_ids[j] == i`.
Args:
Args:
data (tensor): a tensor, available data type float32, float64.
data (tensor): a tensor, available data type float32, float64
, int32, int64
.
segment_ids (tensor): a 1-d tensor, which have the same size
segment_ids (tensor): a 1-d tensor, which have the same size
with the first dimension of input data.
with the first dimension of input data.
available data type is int32, int64.
available data type is int32, int64.
...
@@ -159,7 +161,8 @@ def segment_min(data, segment_ids, name=None):
...
@@ -159,7 +161,8 @@ def segment_min(data, segment_ids, name=None):
out
,
tmp
=
_C_ops
.
segment_pool
(
data
,
segment_ids
,
'pooltype'
,
"MIN"
)
out
,
tmp
=
_C_ops
.
segment_pool
(
data
,
segment_ids
,
'pooltype'
,
"MIN"
)
return
out
return
out
check_variable_and_dtype
(
data
,
"X"
,
(
"float32"
,
"float64"
),
"segment_pool"
)
check_variable_and_dtype
(
data
,
"X"
,
(
"float32"
,
"float64"
,
"int32"
,
"int64"
),
"segment_pool"
)
check_variable_and_dtype
(
segment_ids
,
"SegmentIds"
,
(
"int32"
,
"int64"
),
check_variable_and_dtype
(
segment_ids
,
"SegmentIds"
,
(
"int32"
,
"int64"
),
"segment_pool"
)
"segment_pool"
)
...
@@ -186,7 +189,7 @@ def segment_max(data, segment_ids, name=None):
...
@@ -186,7 +189,7 @@ def segment_max(data, segment_ids, name=None):
where max is over j such that `segment_ids[j] == i`.
where max is over j such that `segment_ids[j] == i`.
Args:
Args:
data (tensor): a tensor, available data type float32, float64.
data (tensor): a tensor, available data type float32, float64
, int32, int64
.
segment_ids (tensor): a 1-d tensor, which have the same size
segment_ids (tensor): a 1-d tensor, which have the same size
with the first dimension of input data.
with the first dimension of input data.
available data type is int32, int64.
available data type is int32, int64.
...
@@ -211,7 +214,8 @@ def segment_max(data, segment_ids, name=None):
...
@@ -211,7 +214,8 @@ def segment_max(data, segment_ids, name=None):
out
,
tmp
=
_C_ops
.
segment_pool
(
data
,
segment_ids
,
'pooltype'
,
"MAX"
)
out
,
tmp
=
_C_ops
.
segment_pool
(
data
,
segment_ids
,
'pooltype'
,
"MAX"
)
return
out
return
out
check_variable_and_dtype
(
data
,
"X"
,
(
"float32"
,
"float64"
),
"segment_pool"
)
check_variable_and_dtype
(
data
,
"X"
,
(
"float32"
,
"float64"
,
"int32"
,
"int64"
),
"segment_pool"
)
check_variable_and_dtype
(
segment_ids
,
"SegmentIds"
,
(
"int32"
,
"int64"
),
check_variable_and_dtype
(
segment_ids
,
"SegmentIds"
,
(
"int32"
,
"int64"
),
"segment_pool"
)
"segment_pool"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录